Skip to content

Commit b9521d9

Browse files
committed
fix: add /mcp commands to help, tab-completion, and history
The /mcp commands were implemented in slash-commands.ts but missing from the COMMANDS registry in commands.ts. This caused: - /help not showing MCP commands - Tab-completion not offering /mcp suggestions - /mcp commands silently dropped from readline history Add 6 MCP command entries to COMMANDS array and 'mcp' GROUP_ALIAS so /help mcp works. Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
1 parent 65567c9 commit b9521d9

1 file changed

Lines changed: 56 additions & 1 deletion

File tree

src/agent/commands.ts

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,60 @@ const COMMANDS: readonly CommandEntry[] = Object.freeze([
313313
"plugin source code. Add --verbose or -v for detailed findings.",
314314
},
315315

316+
// ── MCP Servers ───────────────────────────────────────────
317+
{
318+
completion: "/mcp list",
319+
help: "List configured MCP servers with connection state",
320+
group: "MCP Servers",
321+
detail:
322+
"Shows all MCP servers from ~/.hyperagent/config.json with\n" +
323+
"their current state (idle, connected, error) and tool count.\n" +
324+
"Requires the 'mcp' plugin to be enabled first.",
325+
},
326+
{
327+
completion: "/mcp enable ",
328+
help: "Approve and connect to an MCP server",
329+
group: "MCP Servers",
330+
detail:
331+
"Connects to the named MCP server, spawning its process and\n" +
332+
"discovering available tools. First connection requires approval\n" +
333+
"(command/args shown, env vars masked). Once approved, the\n" +
334+
"server's tools are available as host:mcp-<name> modules.",
335+
},
336+
{
337+
completion: "/mcp disable ",
338+
help: "Disconnect from an MCP server",
339+
group: "MCP Servers",
340+
detail:
341+
"Disconnects from the named server for this session.\n" +
342+
"The server process is terminated. Approval is preserved.",
343+
},
344+
{
345+
completion: "/mcp info ",
346+
help: "Show MCP server tools, schemas, and details",
347+
group: "MCP Servers",
348+
detail:
349+
"Displays the server's discovered tools with their input\n" +
350+
"schemas and descriptions. Useful for understanding what\n" +
351+
"functions are available before writing handler code.",
352+
},
353+
{
354+
completion: "/mcp approve ",
355+
help: "Pre-approve an MCP server without connecting",
356+
group: "MCP Servers",
357+
detail:
358+
"Approves the server's config (command + args hash) so that\n" +
359+
"future /mcp enable calls skip the approval prompt.",
360+
},
361+
{
362+
completion: "/mcp revoke ",
363+
help: "Revoke approval for an MCP server",
364+
group: "MCP Servers",
365+
detail:
366+
"Removes the stored approval. Next /mcp enable will require\n" +
367+
"re-approval with full command/args review.",
368+
},
369+
316370
// ── General ──────────────────────────────────────────────
317371
{
318372
completion: "/profile list",
@@ -404,7 +458,7 @@ const COMMANDS: readonly CommandEntry[] = Object.freeze([
404458
help: "Show this help (or /help <topic> for details)",
405459
detail:
406460
"Use /help alone for the full list.\n" +
407-
"Use /help <group> for a group (e.g. /help plugin, /help timeout).\n" +
461+
"Use /help <group> for a group (e.g. /help plugin, /help mcp, /help timeout).\n" +
408462
"Use /help <command> for one command (e.g. /help show-code).",
409463
},
410464
{
@@ -462,6 +516,7 @@ const GROUP_ALIASES: Readonly<Record<string, string>> = Object.freeze({
462516
sessions: "Session",
463517
plugin: "Plugins",
464518
plugins: "Plugins",
519+
mcp: "MCP Servers",
465520
general: "General",
466521
});
467522

0 commit comments

Comments
 (0)