Skip to content

feat(mcp): expose arch-metrics, memory, export-snapshot, import-snapshot as MCP tools — closes #121#128

Merged
Wolfvin merged 1 commit into
mainfrom
fix/redteam-121-mcp-tools-new-commands
Jul 1, 2026
Merged

feat(mcp): expose arch-metrics, memory, export-snapshot, import-snapshot as MCP tools — closes #121#128
Wolfvin merged 1 commit into
mainfrom
fix/redteam-121-mcp-tools-new-commands

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jul 1, 2026

Copy link
Copy Markdown
Owner

What

Fixes RED TEAM issue #121: MCP server was missing tools for 4 new CLI commands added in #107, #109, #110. AI agents using CodeLens via MCP (Claude Desktop, Cursor, etc.) could not invoke these features.

What changed

Added 4 tool definitions with full JSON Schema parameter specs to scripts/mcp_server.py _TOOL_DEFINITIONS:

Tool Parameters
arch-metrics workspace, format (json/markdown/ai/sarif/compact, default: ai), top (default: 50)
memory workspace, action (write/read/list/delete), name, content
export-snapshot workspace, output
import-snapshot workspace, input, merge (default: False)

MCP tool count: 50 → 54. CLI command count remains 67 (some CLI commands like init, serve, watch are intentionally not exposed as MCP tools because they don't make sense in an MCP context).

Why explicit definitions (vs auto-generation)

The MCP server's _dynamic_tool_definitions() mechanism (line 1387) already auto-generates tool definitions for any CLI command not in _TOOL_DEFINITIONS, but the auto-generated specs lack parameter schemas (everything is treated as opaque workspace + args). The explicit definitions added here give AI agents proper parameter discovery so they can call the tools correctly without trial-and-error.

Verification

>>> from scripts.mcp_server import _TOOL_DEFINITIONS as T
>>> len(T)
54
>>> all(k in T for k in ['arch-metrics', 'memory', 'export-snapshot', 'import-snapshot'])
True
>>> T['memory']['parameters']['properties']['action']['enum']
['write', 'read', 'list', 'delete']

Test suite: 1183 passed, 1 pre-existing failure (#118 — test expectation mismatch, unrelated).

Test plan

  • 4 new tools appear in _TOOL_DEFINITIONS with correct parameter schemas
  • Full test suite: 1183 passed (no new regressions)
  • CI: full test suite passes
  • Manual: MCP client (e.g. Claude Desktop) can invoke the new tools

Risk

Low. Only adds new entries to a dict — no existing tool definitions are modified. The MCP server's tool dispatch already handles these command names via the existing CLI command registry.

…hot as MCP tools — closes #121

PRs #107, #109, #110 added 4 new CLI commands but did not register them
in the MCP server's _TOOL_DEFINITIONS dict. AI agents using CodeLens via
MCP (Claude Desktop, Cursor, etc.) could not invoke these features.

Added 4 tool definitions with full JSON Schema parameter specs:

- arch-metrics: workspace, format, top
- memory: workspace, action (write|read|list|delete), name, content
- export-snapshot: workspace, output
- import-snapshot: workspace, input, merge

MCP tool count: 50 → 54. CLI command count remains 67 (some CLI commands
like 'init', 'serve', 'watch' are intentionally not exposed as MCP tools
because they don't make sense in an MCP context).

The MCP server's _dynamic_tool_definitions() mechanism (line 1387) already
auto-generates tool definitions for any CLI command not in
_TOOL_DEFINITIONS, but the auto-generated specs lack parameter schemas
(everything is treated as opaque 'workspace' + 'args'). The explicit
definitions added here give AI agents proper parameter discovery.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sonarqubecloud

sonarqubecloud Bot commented Jul 1, 2026

Copy link
Copy Markdown

@Wolfvin Wolfvin merged commit 11170f2 into main Jul 1, 2026
5 of 11 checks passed
@Wolfvin Wolfvin deleted the fix/redteam-121-mcp-tools-new-commands branch July 1, 2026 04:56
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