Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

MCP Setup

Lexa ships an MCP server over stdio. It exposes every CLI command as a tool under the same name, plus three recovery tools (reindex, clear_index, status) that the CLI does not have direct equivalents for.

Start the server

lexa index /path/to/project
lexa mcp /path/to/project

By default the server refreshes the graph before startup and watches the project for changes while running. External edits are applied to the same in-memory graph before the next MCP request, so tools always see fresh content without a restart.

If you want a fully rebuilt graph instead of the cheaper startup freshness check, run lexa index first.

The MCP server is a stdio subprocess. In every client config below, the lexa command runs the MCP server. Pass the project root you want it to serve as the first arg. If lexa is not on the client's PATH, replace "lexa" with its absolute path (run which lexa to find it).

Flags

FlagDescription
--no-refreshSkip the startup graph refresh and the runtime watcher.
--debounce <ms>Tune the watcher debounce interval (default: 500ms).
--no-graphRun without loading or persisting a graph (full reindex on every request).
--structured-contentOpt in to JSON structuredContent in every tool response. Alias: --json-output.

The global --json flag also opts in to structured content.

Client configuration

Each section below shows the exact config block to drop in. Replace /path/to/project with the directory whose graph you want the server to expose. If lexa is not on PATH, swap "lexa" for its absolute path (run which lexa to find it).

Claude Code

Drop this in a .mcp.json at your project root, or in ~/.claude.json to make it global:

{
  "mcpServers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

Or add it from the CLI:

claude mcp add lexa -- lexa mcp /path/to/project

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

OpenCode

OpenCode reads opencode.json from the project root, or ~/.config/opencode/config.json for global entries:

{
  "mcp": {
    "lexa": {
      "type": "local",
      "command": ["lexa", "mcp", "/path/to/project"]
    }
  }
}

Codex (OpenAI CLI)

Codex uses TOML. Add a server to ~/.codex/config.toml:

[mcp_servers.lexa]
command = "lexa"
args = ["mcp", "/path/to/project"]

Droid (Factory)

Droid reads ~/.factory/mcp.json (or .factory/mcp.json in the project root for project-scoped servers):

{
  "mcpServers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

Cursor

Edit ~/.cursor/mcp.json (global) or .cursor/mcp.json in the project root:

{
  "mcpServers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

Zed

Edit ~/.config/zed/settings.json. Zed calls MCP servers "context servers":

{
  "context_servers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

Continue

Edit ~/.continue/config.json:

{
  "mcpServers": [
    {
      "name": "lexa",
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  ]
}

Windsurf

Edit ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

Cline

Edit the Cline MCP settings file (Command Palette → "MCP Settings" opens it). On most platforms it lives at ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json on macOS or %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json on Windows:

{
  "mcpServers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"],
      "disabled": false
    }
  }
}

Generic stdio client

Any MCP client that speaks stdio can launch Lexa with this shape:

{
  "mcpServers": {
    "lexa": {
      "command": "lexa",
      "args": ["mcp", "/path/to/project"]
    }
  }
}

See also