MCPcopy Index your code
hub / github.com/CodeGraphContext/CodeGraphContext / mcp_start

Function mcp_start

src/codegraphcontext/cli/main.py:122–149  ·  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, etc.).

()

Source from the content-addressed store, hash-verified

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

Callers 1

startFunction · 0.85

Calls 5

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

Tested by

no test coverage detected