MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / mcp_start

Function mcp_start

src/codegraphcontext/cli/main.py:126–154  ·  view source on GitHub ↗

Start the CodeGraphContext MCP server. Starts the server which listens for JSON-RPC requests from stdin. This is used by IDE integrations (VS Code, Cursor, Zed, etc.).

()

Source from the content-addressed store, hash-verified

124
125@mcp_app.command("start")
126def mcp_start():
127 """
128 Start the CodeGraphContext MCP server.
129
130 Starts the server which listens for JSON-RPC requests from stdin.
131 This is used by IDE integrations (VS Code, Cursor, Zed, etc.).
132 """
133 console.print("[bold green]Starting CodeGraphContext Server...[/bold green]")
134 _load_credentials()
135
136 server = None
137 loop = asyncio.new_event_loop()
138 asyncio.set_event_loop(loop)
139 try:
140 server = MCPServer(loop=loop, cwd=Path.cwd())
141 loop.run_until_complete(server.run())
142 except ValueError as e:
143 # This typically happens if credentials are still not found after all checks.
144 console.print(f"[bold red]Configuration Error:[/bold red] {e}")
145 console.print("Please run `cgc neo4j setup` or use FalkorDB (default).")
146 raise typer.Exit(code=1) from e
147 except KeyboardInterrupt:
148 # Handle graceful shutdown on Ctrl+C.
149 console.print("\n[bold yellow]Server stopped by user.[/bold yellow]")
150 finally:
151 # Ensure server and event loop are properly closed.
152 if server:
153 server.shutdown()
154 loop.close()
155
156@mcp_app.command("tools")
157def mcp_tools():

Callers

nothing calls this directly

Calls 6

runMethod · 0.95
shutdownMethod · 0.95
MCPServerClass · 0.90
_load_credentialsFunction · 0.85
printMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected