Thanks for your interest in contributing to the Code Context MCP server!
📖 First time contributing? Please read the main contributing guide first for general setup and workflow.
This guide covers development specific to the MCP server.
# Build MCP server
pnpm build:mcp
# Watch mode for development
pnpm dev:mcp
# Start server
pnpm start
# Run with environment variables
pnpm start:with-envSee README.md for required environment variables.
- Build the server:
pnpm build
- Run with MCP client or directly:
pnpm start
- Use the tools:
index_codebase- Index a sample codebase with optional custom ignore patternssearch_code- Search for code snippetsclear_index- Clear the index
- Create a new branch for your feature/fix
- Edit
src/index.ts- Main MCP server implementation - Verify with MCP clients (Claude Desktop, etc.)
- Follow commit guidelines in the main guide
- Follow MCP specification
- Use stdio transport for compatibility
- Handle errors gracefully with proper MCP responses
- Redirect logs to stderr (not stdout)
path(required): Path to the codebase directoryforce(optional): Force re-indexing even if already indexed (default: false)splitter(optional): Code splitter type - 'ast' or 'langchain' (default: 'ast')ignorePatterns(optional): Additional ignore patterns to add to defaults (default: [])- Examples:
["static/**", "*.tmp", "private/**", "docs/generated/**"] - Merged with default patterns (node_modules, .git, etc.)
- Examples:
path(required): Path to the indexed codebasequery(required): Natural language search querylimit(optional): Maximum number of results (default: 10, max: 50)
path(required): Path to the codebase to clear
- Keep tool interfaces simple and intuitive
- Provide clear error messages
- Validate all user inputs
- Use TypeScript for type safety
You can use the following configuration to configure the MCP server with a development mode.
{
"mcpServers": {
"code-context-hologres-local": {
"command": "node",
"args": ["PATH_TO_CODECONTEXT/packages/mcp/dist/index.js"],
"env": {
"OPENAI_API_KEY": "sk-your-openai-api-key",
"HOLOGRES_HOST": "your-hologres-instance.hologres.aliyuncs.com",
"HOLOGRES_PORT": "80",
"HOLOGRES_DATABASE": "your-database-name",
"HOLOGRES_USER": "your-access-id",
"HOLOGRES_PASSWORD": "your-access-secret"
}
}
}
}claude mcp add code-context-hologres -e OPENAI_API_KEY=sk-your-openai-api-key -e HOLOGRES_HOST=your-hologres-instance.hologres.aliyuncs.com -e HOLOGRES_PORT=80 -e HOLOGRES_DATABASE=your-database-name -e HOLOGRES_USER=your-access-id -e HOLOGRES_PASSWORD=your-access-secret -- node PATH_TO_CODECONTEXT/packages/mcp/dist/index.jsAnd then you can start Claude Code with claude --debug to see the MCP server logs.
Use all three MCP tools:
index_codebase- Index sample repositories with optional custom ignore patterns
Example with ignore patterns:{"path": "/repo/path", "ignorePatterns": ["static/**", "*.tmp"]}search_code- Search with various queriesclear_index- Clear and re-index
- General questions: See main contributing guide
- MCP-specific issues: Open an issue with the
mcplabel