refactor(cli): simplify mcp add options
This commit is contained in:
@@ -434,32 +434,22 @@ Positionals:
|
||||
args URL for remote servers or command and arguments for local servers [array] [default: []]
|
||||
|
||||
Options:
|
||||
-h, --help show help [boolean]
|
||||
-v, --version show version number [boolean]
|
||||
--print-logs print logs to stderr [boolean]
|
||||
--log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
|
||||
--pure run without external plugins [boolean]
|
||||
--type server type: local or remote [string] [choices: "local", "remote"]
|
||||
--env environment variable for local servers (KEY=VALUE) [array]
|
||||
--header HTTP header for remote servers (KEY=VALUE or 'KEY: VALUE') [array]
|
||||
--scope where to save the server [string] [choices: "project", "global"]
|
||||
-g, --global save to global config [boolean]
|
||||
--enabled enable or disable the server on startup [boolean]
|
||||
--timeout timeout in milliseconds for MCP server requests [number]
|
||||
--oauth enable OAuth for remote servers, or use --no-oauth to disable
|
||||
auto-detection [boolean]
|
||||
--oauth-client-id OAuth client ID for remote servers [string]
|
||||
--oauth-client-secret OAuth client secret for remote servers [string]
|
||||
--oauth-scope OAuth scopes to request for remote servers [string]
|
||||
--oauth-callback-port OAuth local callback port for remote servers [number]
|
||||
--oauth-redirect-uri OAuth redirect URI for remote servers [string]
|
||||
-h, --help show help [boolean]
|
||||
-v, --version show version number [boolean]
|
||||
--print-logs print logs to stderr [boolean]
|
||||
--log-level log level [string] [choices: "DEBUG", "INFO", "WARN", "ERROR"]
|
||||
--pure run without external plugins [boolean]
|
||||
--type server type: local or remote [string] [choices: "local", "remote"]
|
||||
--env environment variable for local servers (KEY=VALUE) [array]
|
||||
--header HTTP header for remote servers (KEY=VALUE or 'KEY: VALUE') [array]
|
||||
-g, --global save to global config [boolean]
|
||||
|
||||
Usage:
|
||||
opencode mcp add <name> -- <command> [args...] (local MCP server)
|
||||
opencode mcp add <name> --env KEY=VALUE -- <command> [args...] (local MCP server with env vars)
|
||||
opencode mcp add <name> <url> (remote MCP server)
|
||||
opencode mcp add <name> --header KEY=VALUE <url> (remote MCP server with headers)
|
||||
opencode mcp add <name> --scope project -- <command> [args...] (save to project config)
|
||||
opencode mcp add <name> --global <url> (save to global config)
|
||||
|
||||
Examples:
|
||||
opencode mcp add context7 -- npx -y @upstash/context7-mcp
|
||||
|
||||
@@ -62,28 +62,6 @@ describe("opencode mcp", () => {
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
const noOAuth = yield* opencode.spawn([
|
||||
"mcp",
|
||||
"add",
|
||||
"public",
|
||||
"https://example.com/mcp",
|
||||
"--no-oauth",
|
||||
"--global",
|
||||
])
|
||||
opencode.expectExit(noOAuth, 0, "opencode mcp add no oauth")
|
||||
|
||||
expect(
|
||||
yield* Effect.promise(() => Bun.file(path.join(home, ".config/opencode/opencode.json")).json()),
|
||||
).toMatchObject({
|
||||
mcp: {
|
||||
public: {
|
||||
type: "remote",
|
||||
url: "https://example.com/mcp",
|
||||
oauth: false,
|
||||
},
|
||||
},
|
||||
})
|
||||
}),
|
||||
120_000,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user