Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 217 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ kdl = "6"
log = "0.4"
miette = { version = "7", features = ["fancy"] }
regex = "1"
rmcp = { version = "2", features = ["server", "transport-io", "macros", "schemars"] }
schemars = "1"
serde = { version = "1", features = ["derive"] }
serde_json = "1.0"
serde_with = "3"
tera = "2"
thiserror = "2"
tokio = { version = "1", features = ["rt", "macros", "io-std"] }
usage-lib = { workspace = true, features = ["clap", "docs", "unstable_choices_env"] }
xx = "2"

Expand Down
23 changes: 23 additions & 0 deletions cli/assets/fig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,29 @@ const completionSpec: Fig.Spec = {
template: "filepaths",
},
},
{
name: ["mcp", "mcp-server"],
description: "Serve a usage spec over the Model Context Protocol",
options: [
{
name: ["-f", "--file"],
description: 'Usage spec file (not "-": stdin is the MCP transport)',
isRepeatable: false,
args: {
name: "file",
template: "filepaths",
},
},
{
name: ["-s", "--spec"],
description: "Raw string spec input",
isRepeatable: false,
args: {
name: "spec",
},
},
],
},
{
name: "powershell",
description: "Execute a shell script using PowerShell",
Expand Down
22 changes: 22 additions & 0 deletions cli/assets/usage.1
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ Generate a type\-safe SDK from a usage spec
\fBlint\fR
Lint a usage spec file for common issues
.TP
\fBmcp\fR
Serve a usage spec over the Model Context Protocol
.RS
\fIAliases: \fRmcp\-server
.RE
.TP
\fBpowershell\fR
Execute a shell script with the specified shell
.TP
Expand Down Expand Up @@ -359,6 +365,22 @@ Treat warnings as errors
.TP
\fB<FILE>\fR
A usage spec file to lint, use "\-" to read from stdin
.SH "USAGE MCP"
Serve a usage spec over the Model Context Protocol

Reads JSON\-RPC over stdin and writes responses to stdout, which is how MCP
clients launch a local server. Point one at `usage mcp \-f mycli.usage.kdl`.
.PP
\fBUsage:\fR usage mcp [OPTIONS]
.PP
\fBOptions:\fR
.PP
.TP
\fB\-f, \-\-file\fR \fI<FILE>\fR
Usage spec file (not "\-": stdin is the MCP transport)
.TP
\fB\-s, \-\-spec\fR \fI<SPEC>\fR
Raw string spec input
.SH "USAGE POWERSHELL"
Execute a shell script with the specified shell

Expand Down
Loading
Loading