codegraph
codegraph copied to clipboard
MCP error -32601: resources/list and prompts/list not implemented
Description
CodeGraph MCP server does not implement the resources/list and prompts/list MCP methods, causing errors at session startup when MCP clients (like OpenCode) attempt to discover available resources and prompts during the handshake.
Error
ERROR service=mcp clientName=codegraph error=MCP error -32601: Method not found: resources/list failed to get resources
ERROR service=mcp clientName=codegraph error=MCP error -32601: Method not found: prompts/list failed to get prompts
Root Cause
Looking at the MCP server implementation in session.ts, the handleMessage method only handles these 5 methods:
initializeinitializedtools/listtools/callping
Any other method (including resources/list and prompts/list) hits the default case and returns Method not found (-32601).
Impact
- MCP clients that perform a full capability discovery during handshake receive errors
- This causes initial tool calls to fail or return empty results in some MCP clients
- Users experience "CodeGraph not working at session start" — tools only work after the client retries
Environment
- CodeGraph version: 0.9.8 (latest)
- Node.js: v20+
- OS: Linux (Ubuntu on WSL2)
- MCP client: OpenCode (oh-my-opencode)
- Project size: ~467 files, ~9000 nodes
Suggested Fix
Implement empty handlers for resources/list and prompts/list that return empty arrays, which is the standard MCP protocol response when a server doesn't support these capabilities:
case 'resources/list':
return { resources: [] };
case 'prompts/list':
return { prompts: [] };
This would make the MCP handshake complete successfully without errors.
Related
- #618 — MCP attached error on v0.9.8
- #613 — Timeout when MCP
- #615 — Daemon MCP mode spin loop