You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
0.5.3: MCP initialize fails with "name 'LLM_SYSTEM_PROMPT' is not defined" — stdio server unusable #1451
codegraphcontext 0.5.3 cannot complete the MCP initialize handshake over stdio. Every initialize request returns a JSON-RPC internal error, so no stdio MCP client can connect (Claude Code, Cursor, etc.). 0.5.2 is unaffected — this is a regression introduced and released on the same day.
{"jsonrpc": "2.0", "id": 1, "error": {"code": -32603, "message": "Internal error: name 'LLM_SYSTEM_PROMPT' is not defined"}}
Starting CodeGraphContext Server...
MCP Server is running. Waiting for requests...
{"jsonrpc": "2.0", "id": 1, "error": {"code": -32603, "message": "Internal error: name 'LLM_SYSTEM_PROMPT' is not defined"}}
Expected: an initialize result containing serverInfo and instructions.
Root cause
src/codegraphcontext/server.py references the module-level LLM_SYSTEM_PROMPT when building the initialize response, but no longer imports it:
L19: from .prompts import build_system_prompt
L808: "instructions": LLM_SYSTEM_PROMPT,
Introduced by c9a9f7e ("feat: Add cgc prompt command for custom LLM prompts (#583)", #613), which changed the import from LLM_SYSTEM_PROMPT to build_system_prompt and left the L808 reference in place.
Both names are needed — build_system_prompt() is called at L795, and LLM_SYSTEM_PROMPT is still used at L808.
Scope
The initialize handler at L793 is the only one and is unconditional, so the failure is total for stdio — not intermittent or config-dependent. The server starts and logs normally, which makes it look healthy.
The SSE transport (api/mcp_sse.py) does not reference either symbol and is unaffected. That is plausibly why this got through.
No test covers the initialize handshake — tests/integration/mcp/test_mcp_server.py exercises tool routing only.
Affected versions
Verified by grepping server.py in each published wheel:
Version
Released
server.py L19
Status
0.4.9
2026-05-13
import LLM_SYSTEM_PROMPT
works
0.5.1
2026-06-12
import LLM_SYSTEM_PROMPT
works
0.5.2
2026-07-25
import LLM_SYSTEM_PROMPT
works
0.5.3
2026-07-26
import build_system_prompt
broken
main currently carries the bug as well.
Fix
One line:
from .promptsimportLLM_SYSTEM_PROMPT, build_system_prompt
PR follows, with a regression test that drives _run_loop with a real initialize request (fails before the fix with the exact error above, passes after).
Activity
github-actions commentedon Jul 27, 2026
Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ