MCP Integration

Overview

sqry MCP gives AI assistants exact answers drawn from your indexed code graph rather than probabilistic guesses. When an AI needs to know who calls a function, which symbols are dead code, whether a dependency cycle exists, or what changed between two git refs, it invokes a sqry tool and receives a precise, structured result. Standalone sqry-mcp exposes the full set of 38 tools covering semantic search, full call hierarchies, callers and callees at any depth, unused-symbol detection, cycle detection, cross-language edges, dependency impact analysis, Go context propagation checks, structural query planning, macro-expansion cache status, workspace-aware index status, and semantic git diff — capabilities that fuzzy text search and LLM inference alone cannot reliably provide.

When connecting through the daemon (sqry-mcp --daemon), the host exposes a curated 16-tool subset optimised for warm-graph workflows: complexity_metrics, dependency_impact, direct_callees, direct_callers, export_graph, find_cycles, find_unused, is_node_in_cycle, rebuild_index, relation_query, semantic_diff, semantic_search, show_dependencies, structural_similar, subgraph, trace_path. Use standalone sqry-mcp (no --daemon) when you need the full 38-tool inventory; use --daemon when you want a long-lived warm index shared across assistant sessions.

Quick setup

Run sqry mcp setup from your project directory. sqry auto-detects installed tools (Claude Code, Codex CLI, Gemini CLI) and writes the correct configuration for each. Then verify with sqry mcp status.

cd /path/to/your/project
sqry index .
sqry mcp setup
sqry mcp status

For repeated assistant calls, keep the graph warm in the daemon and run MCP as a shim client:

sqry daemon start
sqry daemon load .
sqry-mcp --daemon

If sqry-mcp --daemon cannot reach a daemon, it auto-starts one unless SQRY_DAEMON_NO_AUTO_START=1 is set. Use sqry daemon rebuild <path> to refresh a loaded workspace without restarting your assistant session. See the Daemon (sqryd) reference for the full CLI surface, configuration, environment variables, and service installation.

Manual setup — Claude Desktop

Open the Claude Desktop config file for your platform:

Add the sqry server entry:

{
  "mcpServers": {
    "sqry": {
      "command": "/absolute/path/to/sqry-mcp",
      "args": [],
      "env": {
        "SQRY_MCP_WORKSPACE_ROOT": "/path/to/your/project"
      }
    }
  }
}

Use absolute paths — ~ and relative paths are not supported. SQRY_MCP_WORKSPACE_ROOT is optional but recommended: it scopes all queries to your project and blocks path-traversal attempts. Restart Claude Desktop completely after editing the file.

Manual setup — Other tools

Codex CLI

sqry mcp setup --tool codex writes a global entry to ~/.codex/config.toml. To configure manually:

[mcp_servers.sqry]
command = "/absolute/path/to/sqry-mcp"

Codex uses session-scoped workspace resolution in sqry-mcp: explicit path arguments first, then file-bearing arguments, MCP roots, the last resolved workspace, and finally legacy environment/CWD fallback. Start Codex from the project root for the simplest single-repo flow.

Gemini CLI

sqry mcp setup --tool gemini writes to ~/.gemini/settings.json. To configure manually:

{
  "mcpServers": {
    "sqry": {
      "command": "/absolute/path/to/sqry-mcp",
      "args": [],
      "env": {}
    }
  }
}

Gemini also supports a project-level .gemini/settings.json. sqry-mcp uses the same session-scoped workspace resolution flow as Codex, so explicit path arguments are mainly needed for ambiguous multi-root sessions.

Windsurf

Open Settings, navigate to MCP Servers, and add:

{
  "sqry": {
    "command": "/absolute/path/to/sqry-mcp",
    "env": {
      "SQRY_MCP_WORKSPACE_ROOT": "/path/to/your/project"
    }
  }
}

Cursor

Enable MCP support under Settings → Features → Enable MCP Protocol. Create or edit ~/.cursor/mcp_settings.json:

{
  "mcpServers": {
    "sqry": {
      "command": "/absolute/path/to/sqry-mcp",
      "env": {
        "SQRY_MCP_WORKSPACE_ROOT": "/path/to/your/project"
      }
    }
  }
}

Restart Cursor after saving.

What your AI gets

Once connected, your AI assistant has access to MCP tools covering semantic search, call hierarchy traversal, dead-code detection, dependency impact analysis, cross-language edge queries, Go context propagation checks, semantic git diff, macro-expansion cache status, structural query planning, and workspace-aware index status. Each tool returns structured JSON drawn from sqry’s indexed code graph, giving the AI reliable, exact answers rather than inferences from source text.

Surface depends on transport: standalone sqry-mcp exposes all 38 tools; sqry-mcp --daemon exposes the curated 16-tool daemon subset listed above.

Tool responses are truncated at 50 000 bytes by default (UTF-8 boundary safe). Override with SQRY_MCP_MAX_OUTPUT_BYTES=<n> when your transport accepts larger payloads.

See all 38 tools →

Response redaction

When connecting sqry to cloud-hosted AI assistants, you may want to control what data leaves your machine. sqry includes a whitelist-first response redaction library that strips absolute paths, source code, documentation, and unknown fields from MCP responses before they reach the model. Four presets — none, minimal, standard, and strict — cover common deployment scenarios, and every setting is controllable via environment variables.

Redaction reference →

Section Pages

MCP Tools
Complete reference for all 38 sqry MCP tools.
MCP Response Redaction
Control what sensitive data leaves the MCP server with whitelist-first response filtering.