Skip to content

MCP Tools & Resources

RepoRelay implements the Model Context Protocol (MCP) to provide code context directly to LLM agents. The MCP server exposes 7 tools, 2 resources, and 3 prompts.

Server

The MCP server runs as an HTTP service (pnpm dev:mcp), serving the MCP protocol at /mcp and a health check at /health on MCP_SERVER_PORT (default 3000). Clients connect through the MCP proxy, which handles language auto-detection and forwards requests.

Client Configuration

All clients connect via the MCP proxy (npx reporelay --server <url>).

Claude Desktop / Cursor

json
{
  "mcpServers": {
    "reporelay": {
      "command": "npx",
      "args": ["reporelay", "--server", "http://localhost:3000/mcp"]
    }
  }
}

OpenCode

json
{
  "mcp": {
    "reporelay": {
      "type": "local",
      "command": ["npx", "reporelay", "--server", "http://localhost:3000/mcp"]
    }
  }
}

See MCP Integration > Connecting Clients for remote server examples.


Tools

search_code

Hybrid lexical + vector search across indexed repositories. Combines BM25 full-text search with vector similarity via Reciprocal Rank Fusion (RRF).

ParameterTypeRequiredDescription
querystringyesSearch query (min 1 character)
repostringnoFilter by repository name
refstringnoFilter by ref/tag (supports semver constraints)
limitnumbernoMax results, 1-100 (default 20)
languagesstring[]noLanguage filter override (e.g. ["typescript", "javascript"])

Example:

search_code({ query: "authentication middleware", repo: "my-api", limit: 10 })
search_code({ query: "auth", languages: ["typescript", "python"] })

get_file

Retrieve file content by repository and path. Tries raw file from the git mirror first, falls back to indexed chunks. Optionally includes a symbol list with signatures.

ParameterTypeRequiredDescription
repostringyesRepository name
pathstringyesFile path within the repo
refstringnoRef/tag (supports semver constraints)
includeSymbolsbooleannoInclude symbol list with signatures

Example:

get_file({ repo: "my-api", path: "src/auth/login.ts", includeSymbols: true })

get_symbol

Fetch a specific symbol (function, class, interface, etc.) by name. Returns the symbol's source code, location, and optionally which files import it.

ParameterTypeRequiredDescription
repostringyesRepository name
symbolNamestringyesSymbol name to look up
refstringnoRef/tag (supports semver constraints)
includeImportsbooleannoShow files that import this symbol
languagesstring[]noLanguage filter override (e.g. ["typescript", "javascript"])

Example:

get_symbol({ repo: "my-api", symbolName: "buildApp", includeImports: true })

find

Search for files or symbols by a glob-style name pattern.

ParameterTypeRequiredDescription
patternstringyesSearch pattern (glob-style wildcards)
kindstringyes"file" or "symbol"
repostringyesRepository name
refstringnoRef/tag (supports semver constraints)
languagesstring[]noLanguage filter override (e.g. ["typescript", "javascript"])

Example:

find({ pattern: "**/auth/*.ts", kind: "file", repo: "my-api" })
find({ pattern: "create*", kind: "symbol", repo: "my-api" })

find_references

Find files that import a given symbol name. Useful for understanding how a function or class is used across the codebase.

ParameterTypeRequiredDescription
repostringyesRepository name
symbolNamestringyesSymbol name to search for
refstringnoRef/tag (supports semver constraints)

Example:

find_references({ repo: "my-api", symbolName: "login" })

build_context_pack

Build task-specific context packs from indexed code. Four strategies are available:

StrategyDescription
explainUnderstand how a library or module works
implementGet guidance for building with existing patterns
debugDebug an error with relevant code context
recent-changesReview recent changes between two refs (requires fromRef)
ParameterTypeRequiredDescription
repostringyesRepository name
taskstringyesStrategy: explain, implement, debug, recent-changes
refstringnoRef/tag (supports semver constraints)
fromRefstringnoBase ref for recent-changes strategy
querystringnoGuiding query for context gathering
pathsstring[]noSpecific file paths to focus on
maxTokensnumbernoToken budget (default 8192)

Example:

build_context_pack({
  repo: "my-api",
  task: "implement",
  query: "Add rate limiting to the auth endpoints",
  maxTokens: 4096
})

list_repos

List all registered repositories with their indexing status and indexed refs.

ParameterTypeRequiredDescription
languagesstring[]noLanguage filter override (e.g. ["typescript", "javascript"])

Example:

list_repos({})
list_repos({ languages: ["go", "rust"] })

Resources

MCP resources allow clients to browse and read indexed content via URI templates.

File Content

PropertyValue
URI Templatereporelay://{repo}/{ref}/{path+}
MIME Typetext/plain
DescriptionRetrieve indexed file content

Example URI: reporelay://my-api/v1.0.0/src/auth/login.ts

Directory Tree

PropertyValue
URI Templatereporelay://{repo}/{ref}/tree
MIME Typetext/plain
DescriptionList all file paths in a ref

Example URI: reporelay://my-api/v1.0.0/tree

Resource listings enumerate all repositories with ready refs, so clients can browse available content without calling tools first.


Prompts

Prompts provide pre-built templates for common workflows. Each prompt calls build_context_pack internally and returns a formatted message with relevant code context.

explain-library

Understand how a library or module works.

ArgumentTypeRequiredDescription
repostringyesRepository name
querystringnoModule or topic to focus on
refstringnoRef/tag (semver constraints)

Generated message: "Explain the architecture and key concepts of {query or repo}. Use the following indexed code context: ..."

implement-feature

Get guidance for building with existing patterns.

ArgumentTypeRequiredDescription
repostringyesRepository name
querystringyesFeature description
refstringnoRef/tag (semver constraints)

Generated message: "I want to implement: {query}. Follow the existing patterns in the codebase. Here is the relevant context: ..."

debug-issue

Debug an error with relevant code context.

ArgumentTypeRequiredDescription
repostringyesRepository name
querystringyesIssue description
refstringnoRef/tag (semver constraints)

Generated message: "I'm debugging this issue: {query}. Here is the relevant code context: ..."


Semver Support

All tools and resources that accept a ref parameter support semver constraint resolution. Instead of specifying an exact tag, you can use semver ranges:

ref: "^1.0.0"    → resolves to latest matching tag (e.g. v1.5.2)
ref: "~2.1.0"    → resolves to latest patch (e.g. v2.1.7)
ref: ">=3.0.0"   → resolves to latest matching tag

This is useful when agents need "the latest v1.x" without knowing the exact version.


Language Filtering

Four tools (search_code, get_symbol, find, list_repos) accept an optional languages parameter. This allows per-request language filtering — only repos whose indexed refs contain the specified languages above the configured threshold are included in results.

Valid language values: typescript, javascript, python, go, java, kotlin, rust, c, cpp, markdown.

When using the MCP proxy, detected languages from the developer's working directory are automatically injected into these tools. Explicitly provided languages values always take priority over auto-detected ones.

Released under the MIT License.