Skip to content

feat(cli): add read-only /mcp status command#876

Open
fortissolucoescontato-bit wants to merge 3 commits into
CodebuffAI:mainfrom
fortissolucoescontato-bit:feat/mcp-cli-status
Open

feat(cli): add read-only /mcp status command#876
fortissolucoescontato-bit wants to merge 3 commits into
CodebuffAI:mainfrom
fortissolucoescontato-bit:feat/mcp-cli-status

Conversation

@fortissolucoescontato-bit

Copy link
Copy Markdown

Summary

Adds a read-only /mcp command for inspecting configured MCP servers and the current runtime connection state.

The implementation reuses the existing MCP configuration loader and runtime state. It does not introduce a second MCP client, modify MCP configuration files, or initiate connections when rendering the status.

Commands

  • /mcp
  • /mcp list

Unknown subcommands display inline usage information.

Output

The command displays:

  • configured server name;
  • connection status;
  • transport;
  • discovered tool count;
  • sanitized connection errors;
  • sanitized configuration path.

When no servers are configured, it provides a short example using the existing .agents/mcp.json format.

Security

  • Read-only command;
  • does not modify .agents/mcp.json;
  • does not initiate MCP connections;
  • redacts tokens, API keys, credentials and authorization headers;
  • sanitizes credentials embedded in URLs;
  • truncates oversized errors;
  • replaces the user home directory with ~;
  • covers Linux, macOS and Windows path formats.

Implementation

  • Adds a public read-only MCP runtime status API in common;
  • adds the /mcp command handler and formatter in cli;
  • registers /mcp in the command registry and slash-command autocomplete;
  • documents /mcp in the public README.

Verification

  • MCP command tests: 51 passing;
  • related CLI tests: 217 passing (13 files);
  • parser integration tests: PASS;
  • lifecycle tests: PASS;
  • SDK build: PASS;
  • Freebuff build: PASS;
  • local CI (bun run ci): PASS;
  • typecheck: no new errors vs upstream/main;
  • git diff --check: PASS.

Scope

This PR intentionally does not implement:

  • /mcp add;
  • /mcp remove;
  • /mcp reload;
  • /mcp inspect.

Those can be considered separately after the read-only status command is reviewed.

Fortissoluções added 3 commits July 17, 2026 13:57
…th sanitization, and expanded credential redaction

- Switch /mcp from defineCommand to defineCommandWithArgs for subcommand parsing
- Add /mcp unknown subcommand handling that shows inline help with usage
- Add /mcp list to help banner (Tips section)
- Implement proper cross-platform sanitizePath replacing home dir with ~
- Add URL credentials, Basic auth, github_pat_, access_token, refresh_token,
  client_secret, passwd, and Authorization header sanitization patterns
- Remove unused hashMcpConfig and getConnectedMCPClientKeys exports
- Add parser integration tests, path sanitization tests, lifecycle tests,
  and expanded sanitization pattern tests
- Improve JSDoc for McpClientConnectionInfo and getMCPClientConnectionInfo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant