refactor(cli): split mcp add url and command parsing

This commit is contained in:
opencode-agent[bot]
2026-06-01 05:05:37 +00:00
parent 8e0bceaea9
commit 7d97c4c040
3 changed files with 69 additions and 40 deletions
@@ -27,11 +27,11 @@ exports[`opencode CLI help-text snapshots every documented command emits stable
manage MCP (Model Context Protocol) servers
Commands:
opencode mcp add [name] [args..] add an MCP server
opencode mcp list list MCP servers and their status [aliases: ls]
opencode mcp auth [name] authenticate with an OAuth-enabled MCP server
opencode mcp logout [name] remove OAuth credentials for an MCP server
opencode mcp debug <name> debug OAuth connection for an MCP server
opencode mcp add [name] [args...] add an MCP server
opencode mcp list list MCP servers and their status [aliases: ls]
opencode mcp auth [name] authenticate with an OAuth-enabled MCP server
opencode mcp logout [name] remove OAuth credentials for an MCP server
opencode mcp debug <name> debug OAuth connection for an MCP server
Options:
-h, --help show help [boolean]
@@ -425,13 +425,13 @@ Options:
`;
exports[`opencode CLI help-text snapshots every documented command emits stable help text: opencode mcp add --help 1`] = `
"opencode mcp add [name] [args..]
"opencode mcp add [name] [args...]
add an MCP server
Positionals:
name name of the MCP server [string]
args URL for remote servers or command and arguments for local servers [array] [default: []]
args URL for remote servers [array] [default: []]
Options:
-h, --help show help [boolean]
+4
View File
@@ -62,6 +62,10 @@ describe("opencode mcp", () => {
},
},
})
const missingSeparator = yield* opencode.spawn(["mcp", "add", "bad-local", "node", "server.js", "--global"])
expect(missingSeparator.exitCode).not.toBe(0)
expect(missingSeparator.stderr).toContain("Local MCP commands must be passed after --")
}),
120_000,
)