Skip to main content
Glama
Relace MCP Server

Relace MCP Server

by possible055

Unofficial Relace MCP Server

PyPI Python 3.11+ License: MIT 100% AI-Generated OpenSSF Scorecard

Unofficial — Personal project, not affiliated with Relace.

Built with AI — Developed entirely with AI assistance (Antigravity, Codex, Cursor, Github Copilot, Windsurf).

MCP server providing AI-powered code editing and intelligent codebase exploration tools.

Without

With agentic_search + fast_apply

Manual grep, misses related files

Ask naturally, get precise locations

Edits break imports elsewhere

Traces imports and call chains

Full rewrites burn tokens

Describe changes, no line numbers

Line number errors corrupt code

10,000+ tokens/sec merging

Features

  • Fast Apply — Apply code edits at 10,000+ tokens/sec via Relace API

  • Agentic Search — Agentic codebase exploration with natural language queries

  • Agentic Retrieval — Hybrid semantic hints + live code exploration, with stale-hint support and explicit cloud maintenance (enable with MCP_SEARCH_RETRIEVAL=1; choose the backend with MCP_RETRIEVAL_BACKEND)

  • Cloud Search — Semantic code search over cloud-synced repositories

Related MCP server: code-context

Quick Start

Prerequisites: uv, git, ripgrep (recommended)

Using the relace backend (default): get your API key from Relace Dashboard, then add to your MCP client:

~/.cursor/mcp.json

{
  "mcpServers": {
    "relace": {
      "command": "uv",
      "args": ["tool", "run", "relace-mcp"],
      "env": {
        "RELACE_API_KEY": "rlc-your-api-key",
        "MCP_BASE_DIR": "/absolute/path/to/your/project"
      }
    }
  }
}
claude mcp add relace \
  --env RELACE_API_KEY=rlc-your-api-key \
  --env MCP_BASE_DIR=/absolute/path/to/your/project \
  -- uv tool run relace-mcp

~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "relace": {
      "command": "uv",
      "args": ["tool", "run", "relace-mcp"],
      "env": {
        "RELACE_API_KEY": "rlc-your-api-key",
        "MCP_BASE_DIR": "/absolute/path/to/your/project"
      }
    }
  }
}

.vscode/mcp.json

{
  "mcp": {
    "servers": {
      "relace": {
        "type": "stdio",
        "command": "uv",
        "args": ["tool", "run", "relace-mcp"],
        "env": {
          "RELACE_API_KEY": "rlc-your-api-key",
          "MCP_BASE_DIR": "${workspaceFolder}"
        }
      }
    }
  }
}

~/.codex/config.toml

[mcp_servers.relace]
command = "uv"
args = ["tool", "run", "relace-mcp"]

[mcp_servers.relace.env]
RELACE_API_KEY = "rlc-your-api-key"
MCP_BASE_DIR = "/absolute/path/to/your/project"

Configuration

Variable

Required

Description

RELACE_API_KEY

✅*

API key from Relace Dashboard; required for Relace providers and cloud tools

MCP_SEARCH_RETRIEVAL

❌

Set to 1 to register the agentic_retrieval tool

MCP_RETRIEVAL_BACKEND

❌

Semantic retrieval backend: relace (default), codanna, chunkhound, or none

MCP_RETRIEVAL_HINT_POLICY

❌

Retrieval hint policy: prefer-stale (default) or strict

MCP_BACKGROUND_INDEX_MONITOR

❌

Opt-in periodic refresh monitor for local indexes; requires a pinned MCP_BASE_DIR and a local backend

MCP_BACKGROUND_INDEX_INTERVAL_SECONDS

❌

Periodic local index monitor interval in seconds (default: 300)

MCP_BACKGROUND_INDEX_INITIAL_DELAY_SECONDS

❌

Initial delay before the first periodic local index check in seconds (default: 30)

MCP_SEARCH_TURN_STATUS_MODE

❌

Turn-status user message policy: always (default), final-only, or off

SEARCH_BASH_TOOLS

❌

Enable bash during search runs: 1 (on, default), 0 (off)

SEARCH_LSP_TOOLS

❌

Enable LSP-assisted search: 1 (on), 0 (off, default)

MCP_BASE_DIR

❌

Project root override (auto-detected via MCP Roots → Git → workspace storage → CWD)

MCP_LOGGING

❌

File logging: off (default), safe, full

MCP_DOTENV_PATH

❌

Path to .env file for centralized config

* Optional if both: (1) APPLY_PROVIDER and SEARCH_PROVIDER are non-Relace providers, and (2) MCP_RETRIEVAL_BACKEND is codanna, chunkhound, or none.

For .env usage, encoding settings, custom LLM providers, and more, see docs/advanced.md.

Tools

Always available: fast_apply, agentic_search. agentic_retrieval requires MCP_SEARCH_RETRIEVAL=1. Cloud tools are available only when MCP_RETRIEVAL_BACKEND=relace. index_status is available for relace, codanna, and chunkhound, and hidden when MCP_RETRIEVAL_BACKEND=none.

Use MCP-native discovery surfaces: list_tools() for tools and list_resources() for resources.

For detailed parameters, see docs/tools.md.

Language Support

LSP tools use external language servers installed on your system.

Language

Language Server

Install Command

Python

basedpyright

(bundled)

TypeScript/JS

typescript-language-server

npm i -g typescript-language-server typescript

Go

gopls

go install golang.org/x/tools/gopls@latest

Rust

rust-analyzer

rustup component add rust-analyzer

Dashboard

Real-time terminal UI for monitoring operations.

pip install relace-mcp[tools]
relogs

For detailed usage, see docs/dashboard.md.

Benchmark

Evaluate agentic_search performance using the Loc-Bench code localization dataset.

git clone https://github.com/possible055/relace-mcp.git
cd relace-mcp
uv sync --extra benchmark

# Build dataset from Hugging Face
uv run --extra benchmark python -m benchmark.cli.build_locbench --output artifacts/data/raw/locbench_v1.jsonl

# Run evaluation
uv run --extra benchmark python -m benchmark.cli.run --dataset artifacts/data/raw/locbench_v1.jsonl --limit 20

All benchmark artifacts are written under benchmark/.data/.

For grid search, analysis tools, and metrics interpretation, see docs/benchmark.md.

Platform Support

Platform

Status

Notes

Linux

✅ Fully supported

Primary development platform

macOS

✅ Fully supported

All features available

Windows

⚠️ Partial

bash tool unavailable; use WSL for full functionality

Troubleshooting

Error or message

Solution

RELACE_API_KEY is required ...

Set RELACE_API_KEY when using Relace providers or cloud tools

NEEDS_MORE_CONTEXT

Include 1-3 unique anchor lines near the target block

INVALID_PATH

Verify the path exists and is inside MCP_BASE_DIR or an allowed extra path

FILE_TOO_LARGE

File exceeds 10MB; split the change into smaller files or edits

ENCODING_ERROR

Set RELACE_DEFAULT_ENCODING explicitly for non-UTF-8 projects

AUTH_ERROR

Verify the API key and provider configuration

RATE_LIMIT

Retry later or reduce request volume

NETWORK_ERROR / TIMEOUT_ERROR

Check network access and retry

APPLY_NOOP

Add more specific anchors or concrete new lines so the merge can produce a diff

MARKER_LEAKAGE

Ensure placeholder markers are used only as placeholders, not expected literal output

TRUNCATION_DETECTED

Split large deletion-heavy edits or use explicit remove directives

BLAST_RADIUS_EXCEEDED

Break the change into smaller, more local edits

Development

git clone https://github.com/possible055/relace-mcp.git
cd relace-mcp
uv sync --extra dev --extra benchmark
uv run pytest
uv run --extra dev --extra benchmark pytest benchmark/tests -q

License

MIT

Available Tools

7 tools
cloud_clearA
Destructive

Delete cloud repository and local sync state. IRREVERSIBLE.

Removes all indexed data from Relace Cloud. Use cloud_list to find repo IDs.

Inputs: confirm, repo_id. Returns: object

cloud_listA
Read-onlyIdempotent

[ADMIN] List all repositories in your Relace Cloud account.

Use to find repo_id for cloud_clear. Not needed for normal search/sync workflow. Returns repository IDs, names, and indexing status.

Inputs: no named parameters. Returns: object

cloud_syncA
Idempotent

Upload or refresh codebase to Relace Cloud for semantic search.

Check index_status() first—skip this if cloud freshness is already 'fresh'. Syncs git-tracked files to enable cloud_search. Incremental by default.

Advanced (Relace-specific): force=True Re-upload all files; use after large refactors. force=True+mirror=True Delete cloud files absent locally; use after branch switch.

Returns: {sync_mode (str), files_created (int), files_updated (int), files_deleted (int), files_unchanged (int), warnings (list[str]), repo_id (str), repo_head (str)}. Check warnings[] for truncation or suppressed deletes. Fails if not in a git repo or RELACE_API_KEY is not set.

Inputs: force, mirror. Returns: object

fast_applyA
Destructive

Edit or create a file using intelligent merging.

For new files: writes content directly. For existing files: merges edit_snippet with current content using anchor lines. Anchor lines are verbatim lines copied from the existing file that help locate the exact edit target. Include 1-2 unique lines adjacent to the change. Truncation markers are recommended for larger scoped edits but not required. Markdown files keep fenced code blocks verbatim; outer fence stripping is skipped for .md/.mdx targets.

On error, the response includes a code field:

  • NEEDS_MORE_CONTEXT: merge model could not locate the target - add 1-2 unique anchor lines from immediately around the edit location.

  • APPLY_NOOP: merge returned an identical file even though the snippet contained explicit remove directives or concrete new lines not present in the original.

  • BLAST_RADIUS_EXCEEDED: edit scope too large - split into smaller edits.

  • MARKER_LEAKAGE: placeholder marker text leaked into merged output (treated as literal text).

  • TRUNCATION_DETECTED: merged output shrank drastically and no explicit remove directive was provided.

On success: {status: "ok", diff: str | None (unified diff, None for new files or no-op)}.

Do NOT use this tool to delete files or clear file contents. Use a dedicated file management tool for those operations.

Inputs: path (required), edit_snippet (required), instruction. Returns: object

index_statusA
Read-onlyIdempotent

Inspect the single active indexing backend in read-only mode.

Use this before retrieval when you need to know whether the active backend is fresh and whether semantic hints are usable. Returns active_backend, a single backend status object with freshness and hints_usable, and background_monitor (state, reason). This tool never refreshes indexes; if active_backend is relace and backend.status.needs_sync is true, run cloud_sync().

Inputs: no named parameters. Returns: trace_id, active_backend, base_dir, base_dir_source, +3 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.3/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with descriptions that explicitly differentiate similar tools (e.g., agentic_search vs cloud_search based on query type). There is no functional overlap.

    Naming Consistency3/5

    Cloud operations use a consistent 'cloud_' prefix, but 'agentic_search', 'fast_apply', and 'index_status' break the pattern. Mix of verb_noun and adjective_noun styles reduces predictability.

    Tool Count5/5

    Seven tools is well-scoped for a code search and editing server. Each tool addresses a specific need without redundancy or excessive complexity.

    Completeness3/5

    Covers search (local and cloud) and file editing, but lacks tools for reading full file content, deleting files, or managing local files beyond edits. Users may need to rely on external tools for basic operations.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      F
      maintenance
      Provides AI-powered code intelligence for any codebase using local LLMs and vector search, enabling semantic code search, pattern analysis, and context-optimized code generation with 90% token savings.
      2
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI coding assistants to automatically scan, store, and query API endpoints from codebases, providing instant lookup and semantic search to reduce context switching and token consumption.
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Make any LLM a codebase expert instantly. Provides deep code intelligence through semantic search, architecture mapping, security analysis, and smart context that fits perfectly in token windows.
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents and IDEs to ingest and search code repositories using hybrid retrieval (dense + sparse) with exact line-level citations for precise code analysis.
      1
      -