feat(cli): Add dotagents mcp add|remove|list subcommands#24
Conversation
MCP servers were previously only configurable by hand-editing agents.toml. This adds CLI subcommands matching the ergonomics of `dotagents add` / `dotagents remove` for skills. - `mcp add` supports stdio (--command) and HTTP (--url) transports with repeatable --args, --header, and --env flags - `mcp remove` removes a server declaration by name - `mcp list` shows declared servers with optional --json output - Refactors internal `removeBlockByName` to parameterized `removeBlockByHeader` to support both [[skills]] and [[mcp]] blocks Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/XcNMOOwdNjMB4tgyLvD_kmWdTcM6ZnsDub9D5Fmk1OI
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
|
||
| while (i < lines.length) { | ||
| if (lines[i]!.trim() === "[[skills]]") { | ||
| if (lines[i]!.trim() === header) { |
There was a problem hiding this comment.
Block removal ignores sub-tables, may corrupt config
Medium Severity
removeBlockByHeader collects block lines only until it hits an empty line or a line starting with [. If smol-toml's stringify serializes the headers record as a TOML sub-table (e.g., [mcp.headers]) rather than an inline table, removeMcpFromConfig would remove only the [[mcp]] header and its direct key-value lines but leave the [mcp.headers] sub-table and its contents behind as orphaned TOML, corrupting the config file. The old removeBlockByName only handled [[skills]] blocks which never had nested objects, so this fragility is newly exposed by reusing it for [[mcp]] blocks that can contain headers.
Additional Locations (1)
|
|
||
| while (i < lines.length) { | ||
| if (lines[i]!.trim() === "[[skills]]") { | ||
| if (lines[i]!.trim() === header) { |
There was a problem hiding this comment.
Name-matching regex fails on lines with leading whitespace
Low Severity
In removeBlockByHeader, the nameLine is found via l.trim().startsWith("name") but the regex ^name\s*=\s*"([^"]+)" is applied to the untrimmed original line. If a user hand-edits agents.toml and indents key-value lines under [[mcp]], the leading whitespace causes the ^name anchor to fail, so removeMcpFromConfig silently keeps the block instead of removing it. The old removeBlockByName had this same issue for [[skills]], but by reusing it for the new [[mcp]] path, the bug is newly exposed for MCP blocks.


MCP servers were previously only configurable by hand-editing
agents.toml. This addsdotagents mcp add|remove|listCLIsubcommands matching the ergonomics of
dotagents add/dotagents removefor skills.Commands:
Changes:
src/cli/commands/mcp.tswith sub-subcommand dispatch foradd/remove/list, validation, and error handling
removeBlockByName→removeBlockByHeaderinsrc/config/writer.tsto support both[[skills]]and[[mcp]]block types (zero behavior change for skills)
addMcpToConfig/removeMcpFromConfigwriter functionsmcpin CLI command indexllms.txtAgent transcript: https://claudescope.sentry.dev/share/FwNRv0iBbvB8cTtCO3O-ws_MdOXK4ZqOwDhsG7lep1c