Skip to content

MCP tools

Run codeweb as a Model Context Protocol server and query the graph from Claude Desktop, Cursor, or any MCP client.

Start the MCP server

Built with the mcp feature, codeweb mcp speaks JSON-RPC over stdio:

cargo build --release --features mcp
codeweb mcp --project /path/to/your/project

Register it in an MCP client, for example Claude Desktop’s claude_desktop_config.json:

{
  "mcpServers": {
    "codeweb": {
      "command": "/path/to/codeweb",
      "args": ["mcp", "--project", "/path/to/your/project"]
    }
  }
}

Lifecycle

The server starts even when the directory has no codeweb.toml yet: queries then return status: "uninitialized" instead of the process exiting.

  1. codeweb_init writes codeweb.toml and .codeweb/ under the served directory. It never analyzes on its own.
  2. codeweb_analyze builds or incrementally refreshes the graph and hot-swaps it into the running server, so later queries see the new graph without a restart.
  3. codeweb_diff lists files added, modified, or deleted since the last analysis.

Tools

ToolParametersDescription
codeweb_initname (optional, defaults to directory name), paths (optional, defaults to ["."])Initialize the project; no analysis
codeweb_analyze—Build/refresh the graph and hot-swap it in
codeweb_diff—Changes since the last analysis
codeweb_stats—Node counts by type, edge count, status; call this first
codeweb_nodessearch, node_type, limit, offsetList nodes with filtering and pagination
codeweb_node_detailids (list), depth (1 direct, 0 unlimited, N hops)Properties, callers, callees
codeweb_tracefrom, depth, max_nodesBidirectional call chain as nested trees
codeweb_search_sqlsqlSearch mapper/sql nodes by SQL text with relevance scoring
codeweb_queryspecExecute a QuerySpec
codeweb_column_analysisprocedure or package (exactly one), table (optional)Same JSON schema as codeweb columns --format json
codeweb_lineagetarget, direction, depthSame functions and JSON shape as codeweb lineage --format json

Security boundaries

Reads may point at any directory listed in analysis.paths, but every write is confined to the served directory: a tampered store.path that escapes it is rejected. The server exposes no shell execution and no file-write tools beyond the lifecycle above.