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. The 36 tools cover semantic search, full call hierarchies, callers and callees at any depth, unused-symbol detection, cycle detection, cross-language edges, dependency impact analysis, 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.
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:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
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 36 MCP tools covering semantic search, call hierarchy traversal, dead-code detection, dependency impact analysis, cross-language edge queries, semantic git diff, macro-expansion cache status, structural query planning, workspace-aware index status, and natural language query translation. Each tool returns structured JSON drawn from sqry’s indexed code graph, giving the AI reliable, exact answers rather than inferences from source text.
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.
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.