Skip to content

MCP Server

The Orator MCP (Model Context Protocol) server allows AI tools like Claude to query your codebase context directly. Instead of manually copying context, Claude can call Orator tools to understand your code as part of the conversation.

Installation

Terminal window
npm install -g @orator-dev/mcp

Configuration for Claude Code

Add Orator to your Claude Code MCP settings. Create or edit ~/.claude/claude_desktop_config.json:

{
"mcpServers": {
"orator": {
"command": "orator-mcp",
"env": {
"ORATOR_API_KEY": "orator_your_api_key_here"
}
}
}
}

Then restart Claude Code for the changes to take effect.

Configuration for Claude Desktop

Add Orator to your Claude Desktop MCP settings. The config file is located at:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"orator": {
"command": "orator-mcp",
"env": {
"ORATOR_API_KEY": "orator_your_api_key_here"
}
}
}
}

Restart Claude Desktop after editing the configuration.

Available Tools

Once configured, the following tools become available to Claude:

query_context

Query codebase context with a natural language question. This is the primary tool Claude uses to understand your code.

ParameterTypeRequiredDescription
repoIdstringYesThe repository ID to query
querystringYesNatural language question about the codebase
maxTokensnumberNoMaximum tokens to return (default: 4000)
intentstringNoQuery intent: understand, debug, implement, review

Example usage by Claude: “Let me check how authentication works in this codebase” triggers query_context with query: "how does authentication work?".

get_patterns

Retrieve detected patterns for a repository — error handling, naming conventions, testing strategies, and more.

ParameterTypeRequiredDescription
repoIdstringYesThe repository ID
patternTypestringNoFilter by type: error_handling, naming, testing, logging, api, state_management

Example usage by Claude: Before writing new code, Claude calls get_patterns to ensure it follows your established coding practices.

get_architecture

Retrieve the high-level architecture and knowledge graph summary for a repository.

ParameterTypeRequiredDescription
repoIdstringYesThe repository ID

Example usage by Claude: “What’s the architecture of this project?” triggers get_architecture to get an overview of modules, dependencies, and structure.

search_code

Search for specific code entities (functions, classes, types) in the knowledge graph.

ParameterTypeRequiredDescription
repoIdstringYesThe repository ID
querystringYesSearch query for code entities
nodeTypestringNoFilter by type: function, class, module, type, interface, variable, export

Example usage by Claude: “Find all functions related to payment processing” triggers search_code with query: "payment" and nodeType: "function".

get_conventions

Retrieve the detected conventions for a repository — file structure, naming, import ordering, and more.

ParameterTypeRequiredDescription
repoIdstringYesThe repository ID

Example usage by Claude: Before generating code, Claude calls get_conventions to match your project’s style and structure.

How It Works

When you ask Claude a question about your code:

  1. Claude identifies that it needs codebase context
  2. It calls the appropriate Orator MCP tool (usually query_context)
  3. The MCP server sends the request to the Orator API
  4. Orator returns structured, relevant context from your knowledge graph
  5. Claude uses that context to give you an accurate, project-aware answer

This means Claude understands your specific codebase — not just generic programming knowledge. It knows your patterns, conventions, file structure, and how different parts of your code relate to each other.

Environment Variables

The MCP server supports these environment variables:

VariableDescriptionDefault
ORATOR_API_KEYAPI key for authenticationRequired
ORATOR_API_URLOverride the API base URLhttps://api.orator.dev

Troubleshooting

MCP server not appearing in Claude: Make sure you restarted Claude after editing the config file. Check that the orator-mcp command is available in your PATH by running which orator-mcp.

Authentication errors: Verify your API key is correct and not expired. You can test it with curl -H "Authorization: Bearer orator_your_key" https://api.orator.dev/v1/repos.

No context returned: Make sure the repository has been indexed. Run orator status in your project directory to check.