Add KGraph MCP server orchestration#65
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a local MCP (Model Context Protocol) server for KGraph, exposes the KGraph command surface as typed kgraph_* tools over stdio, and adds VS Code/Copilot setup automation via --mcp during init/integrate.
Changes:
- Add a new
kgraph mcpCLI subcommand backed by an in-process MCP server with typed tool definitions. - Add VS Code MCP config installation (
--mcp) for Copilot integration flows, plus integration tests. - Update docs and integration workflow instructions to route KGraph usage through MCP tools when available.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/mcp.test.ts | New integration tests validating MCP tool listing and basic tool execution. |
| tests/integration/integrate.test.ts | Adds integrate add copilot --mcp test coverage and VS Code MCP config assertions. |
| tests/integration/init-integrations.test.ts | Adds init --integrations copilot --mcp test coverage and VS Code MCP config assertions. |
| tests/fixtures/helpers.ts | Extends CLI test harness with env overrides for VS Code MCP config path and MCP command. |
| src/mcp/server.ts | New MCP server implementation exposing typed tools + command-compat wrapper. |
| src/integrations/workflow-steps.ts | Updates generated workflow guidance to prefer MCP tools when present. |
| src/integrations/vscode-mcp.ts | New VS Code MCP config writer/installer for registering KGraph as a stdio server. |
| src/cli/index.ts | Registers the new mcp command in the CLI program. |
| src/cli/help.ts | Documents kgraph mcp and --mcp integration flows in help output. |
| src/cli/commands/mcp.ts | Adds the kgraph mcp subcommand implementation. |
| src/cli/commands/integrate.ts | Adds --mcp flag to install VS Code MCP server during integrate add. |
| src/cli/commands/init.ts | Adds --mcp flag to install VS Code MCP server during init. |
| README.md | Documents MCP usage and --mcp setup flows. |
| docs/wiki/Roadmap.md | Updates roadmap to reflect MCP expansion beyond VS Code/Copilot. |
| docs/wiki/MCP-Setup.md | New MCP setup guide including VS Code/Copilot instructions and tool list. |
| docs/wiki/Home.md | Adds MCP Setup page to wiki navigation. |
| docs/wiki/Command-Guide.md | Documents kgraph mcp and VS Code setup commands. |
| docs/wiki/AI-Tool-Integrations.md | Adds MCP section pointing to setup guidance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+169
to
+175
| const commandBacked = ( | ||
| name: string, | ||
| description: string, | ||
| mutability: ToolDefinition['mutability'], | ||
| buildArgs: (args: Record<string, unknown>) => string[], | ||
| inputSchema: JsonValue = schema({}), | ||
| ): ToolDefinition => ({ |
Comment on lines
+190
to
+193
| commandBacked('kgraph_scan', 'Refresh deterministic file, symbol, import, and relationship maps.', 'repo-write', (args) => [ | ||
| 'scan', | ||
| ...(booleanParam(args, 'verbose') ? ['--verbose'] : []), | ||
| ]), |
Comment on lines
+194
to
+197
| commandBacked('kgraph_update', 'Process Markdown cognition notes from .kgraph/inbox.', 'repo-write', (args) => [ | ||
| 'update', | ||
| ...(booleanParam(args, 'dryRun') ? ['--dry-run'] : []), | ||
| ]), |
Comment on lines
+266
to
+271
| function vscodeMcpConfigPath(repo: string): string { | ||
| return path.join( | ||
| os.tmpdir(), | ||
| 'kgraph-vscode-mcp-test-' + path.basename(repo), | ||
| 'mcp.json', | ||
| ); |
Comment on lines
+80
to
+86
| function vscodeMcpConfigPath(repo: string): string { | ||
| return path.join( | ||
| os.tmpdir(), | ||
| 'kgraph-vscode-mcp-test-' + path.basename(repo), | ||
| 'mcp.json', | ||
| ); | ||
| } |
Comment on lines
+43
to
+47
| const changed = | ||
| JSON.stringify(previous ?? null) !== JSON.stringify(nextServer); | ||
|
|
||
| await mkdir(path.dirname(configPath), { recursive: true }); | ||
| await writeFile(configPath, `${JSON.stringify(next, null, 2)}\n`, 'utf8'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.