feat(mcp): pare default tool surface to codegraph_explore alone + redux-thunk synthesizer
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
* runs without this block, and consistently with it — including runs
|
||||
* with zero Read/grep fallback.
|
||||
* - **Non-MCP harnesses** — agents with no MCP client at all can still
|
||||
* run the `codegraph explore` / `codegraph node` CLI, which prints the
|
||||
* same output as the MCP tools.
|
||||
* run the `codegraph explore` CLI, which prints the same output as the
|
||||
* MCP tool.
|
||||
*
|
||||
* Keep this block SHORT. The main agent reads it every turn on top of the
|
||||
* server instructions — the #529 duplication-cost argument still bounds
|
||||
@@ -44,8 +44,8 @@ export const CODEGRAPH_INSTRUCTIONS_BLOCK = `${CODEGRAPH_SECTION_START}
|
||||
|
||||
In repositories indexed by CodeGraph (a \`.codegraph/\` directory exists at the repo root), reach for it BEFORE grep/find or reading files when you need to understand or locate code:
|
||||
|
||||
- **MCP tools** (when available): \`codegraph_explore\` answers most code questions in one call — the relevant symbols' verbatim source plus the call paths between them. \`codegraph_node\` returns one symbol's source + callers, or reads a whole file with line numbers. If the tools are listed but deferred, load them by name via tool search.
|
||||
- **Shell** (always works): \`codegraph explore "<symbol names or question>"\` and \`codegraph node <symbol-or-file>\` print the same output.
|
||||
- **MCP tool** (when available): \`codegraph_explore\` answers most code questions in one call — the relevant symbols' verbatim source plus the call paths between them, including dynamic-dispatch hops grep can't follow. Name a file or symbol in the query to read its current line-numbered source. If it's listed but deferred, load it by name via tool search.
|
||||
- **Shell** (always works): \`codegraph explore "<symbol names or question>"\` prints the same output.
|
||||
|
||||
If there is no \`.codegraph/\` directory, skip CodeGraph entirely — indexing is the user's decision.
|
||||
${CODEGRAPH_SECTION_END}`;
|
||||
|
||||
@@ -31,20 +31,21 @@ export function getMcpServerConfig(): { type: string; command: string; args: str
|
||||
|
||||
/**
|
||||
* Permissions list for Claude `settings.json`. Other targets that
|
||||
* have a permissions concept can compose this list directly. The
|
||||
* permission strings follow Claude's `mcp__<server>__<tool>` format.
|
||||
* have a permissions concept can compose this list directly.
|
||||
*
|
||||
* One server-scoped wildcard rather than a per-tool list. By default only
|
||||
* `codegraph_explore` is even LISTED to the agent (see DEFAULT_MCP_TOOLS in
|
||||
* mcp/tools.ts), so in practice explore is the only tool this auto-approves —
|
||||
* but the wildcard means that if a user re-enables another tool via
|
||||
* CODEGRAPH_MCP_TOOLS, it's already pre-approved (no permission prompt, no
|
||||
* hand-editing settings.json), and future tools are covered too. Claude only
|
||||
* honors globs after a literal `mcp__<server>__` prefix, so this exact string
|
||||
* is the way to allow-all for one server; a bare `mcp__codegraph` or `*` is
|
||||
* ignored. The allowlist gates PROMPTING, not visibility, so a superset here
|
||||
* never makes a hidden tool appear.
|
||||
*/
|
||||
export function getCodeGraphPermissions(): string[] {
|
||||
return [
|
||||
'mcp__codegraph__codegraph_explore',
|
||||
'mcp__codegraph__codegraph_search',
|
||||
'mcp__codegraph__codegraph_node',
|
||||
'mcp__codegraph__codegraph_callers',
|
||||
'mcp__codegraph__codegraph_callees',
|
||||
'mcp__codegraph__codegraph_impact',
|
||||
'mcp__codegraph__codegraph_files',
|
||||
'mcp__codegraph__codegraph_status',
|
||||
];
|
||||
return ['mcp__codegraph__*'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user