From 31b827c44164dd08ccddceb670d7cf5612bf1ff5 Mon Sep 17 00:00:00 2001 From: andreinknv Date: Sun, 26 Apr 2026 00:57:35 -0400 Subject: [PATCH] docs: README setup snippets for non-Claude MCP clients Adds a "Using with Other MCP Clients" section to the README with copy-pastable config for opencode, Cursor, LangChain (MultiServerMCPClient), and the Claude Agent SDK, plus a generic stdio-MCP fallback. Each client gets the exact field names it actually expects (the existing README only documented the Claude Code / ~/.claude.json shape). Notes: - The CodeGraph MCP server speaks stdio only, so the LangChain example explicitly passes `transport: "stdio"` (the issue reporter had been trying to use SSE config) and there's a closing note pointing SSE-only clients at supergateway as a bridge. - The generic-fallback section documents the `--path` flag for clients that don't send a `rootUri` in the initialize request. Closes #65, #79. Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 105 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fd1ffaba..38a86b12 100644 --- a/README.md +++ b/README.md @@ -316,7 +316,7 @@ fi ## MCP Tools -When running as an MCP server, CodeGraph exposes these tools to Claude Code: +When running as an MCP server, CodeGraph exposes these tools to any MCP-compatible AI assistant: | Tool | Purpose | |------|---------| @@ -331,6 +331,110 @@ When running as an MCP server, CodeGraph exposes these tools to Claude Code: --- +## Using with Other MCP Clients + +The MCP server runs over **stdio** and works with any MCP-compatible client — not just Claude Code. The interactive installer is Claude Code-specific (it writes `~/.claude.json`), so for other clients you'll want the manual setup. + +**Common steps for every client:** + +```bash +npm install -g @colbymchenry/codegraph # so `codegraph` is on PATH +cd your-project +codegraph init -i # initialize + index this project +``` + +Then point your MCP client at `codegraph serve --mcp` using whatever config shape it expects: + +### opencode + +In `opencode.json` (project) or `~/.config/opencode/opencode.json` (global): + +```json +{ + "$schema": "https://opencode.ai/config.json", + "mcp": { + "codegraph": { + "type": "local", + "command": ["codegraph", "serve", "--mcp"], + "enabled": true + } + } +} +``` + +### Cursor + +In `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project): + +```json +{ + "mcpServers": { + "codegraph": { + "command": "codegraph", + "args": ["serve", "--mcp"] + } + } +} +``` + +### LangChain (`MultiServerMCPClient`) + +The CodeGraph server speaks stdio, not SSE — pass `transport: "stdio"`: + +```python +from langchain_mcp_adapters.client import MultiServerMCPClient + +client = MultiServerMCPClient({ + "codegraph": { + "command": "codegraph", + "args": ["serve", "--mcp"], + "transport": "stdio", + } +}) +tools = await client.get_tools() +``` + +### Claude Agent SDK + +Pass the server in `mcpServers` (TypeScript) or `mcp_servers` (Python) when calling `query()`: + +```python +from claude_agent_sdk import query, ClaudeAgentOptions + +options = ClaudeAgentOptions( + mcp_servers={ + "codegraph": { + "command": "codegraph", + "args": ["serve", "--mcp"], + } + }, + allowed_tools=["mcp__codegraph__*"], +) + +async for message in query(prompt="Where is auth handled?", options=options): + ... +``` + +### Anything else (generic stdio MCP) + +Most MCP clients (Continue, Zed, custom integrations, etc.) accept some variation of `command` + `args`. The values are always: + +| Field | Value | +|-------|-------| +| Command | `codegraph` | +| Args | `["serve", "--mcp"]` | +| Transport | `stdio` | + +The server reads the project root from the MCP `initialize` request's `rootUri` (set by the client when it connects). If your client doesn't send a `rootUri`, pass the project path explicitly: + +```bash +codegraph serve --mcp --path /absolute/path/to/project +``` + +> **Note:** CodeGraph's MCP server does **not** speak SSE/HTTP. If your client only supports `url` + `transport: "sse"`, you'll need to wrap stdio with a bridge like [supergateway](https://github.com/supercorp-ai/supergateway). + +--- + ## Library Usage ```typescript