Sourcerer MCP 🧙
An MCP server for semantic code search & navigation that helps AI agents work efficiently without burning through costly tokens. Instead of reading entire files, agents can search conceptually and jump directly to the specific functions, classes, and code chunks they need.
Demo
Requirements
- OpenAI API Key: Required for generating embeddings (local embedding support planned)
- Git: Must be a git repository (respects
.gitignore
files) - Add
.sourcerer/
to.gitignore
: This directory stores the embedded vector database
Installation
Go
Homebrew
Configuration
Claude Code
mcp.json
How it Works
Sourcerer builds a semantic search index of your codebase:
1. Code Parsing & Chunking
- Uses Tree-sitter to parse source files into ASTs
- Extracts meaningful chunks (functions, classes, methods, types) with stable IDs
- Each chunk includes source code, location info, and contextual summaries
- Chunk IDs follow the pattern:
file.ext::TypeName::methodName
2. File System Integration
- Watches for file changes using
fsnotify
- Respects
.gitignore
files viagit check-ignore
- Automatically re-indexes changed files
- Stores metadata to track modification times
3. Vector Database
- Uses chromem-go for persistent vector storage in
.sourcerer/db/
- Generates embeddings via OpenAI's API for semantic similarity
- Enables conceptual search rather than just text matching
- Maintains chunks, their embeddings, and metadata
4. MCP Tools
semantic_search
: Find code by concept/functionalityget_source_code
: Retrieve specific chunks by IDindex_workspace
: Manually trigger re-indexingget_index_status
: Check indexing progress
This approach allows AI agents to find relevant code without reading entire files, dramatically reducing token usage and cognitive load.
Supported Languages
Language support requires writing Tree-sitter queries to identify functions, classes, interfaces, and other code structures for each language.
Supported: Go
Planned: Python, TypeScript, JavaScript
Contributing
All contributions welcome!
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
An MCP server for semantic code search & navigation that helps AI agents work efficiently without burning through costly tokens. Instead of reading entire files, agents can search conceptually and jump directly to the specific functions, classes, and code chunks they need.
Related MCP Servers
- -securityAlicense-qualityA Code Indexing MCP Server that connects AI coding assistants to external codebases, providing accurate and up-to-date code snippets to reduce mistakes and hallucinations.Last updated -75PythonApache 2.0
- AsecurityFlicenseAqualityAn MCP server that allows coding agents to look up contextual rules and patterns on demand, providing just-in-time guidance for specific tasks like writing tests or authoring UI.Last updated -29TypeScript
- AsecurityFlicenseAqualityAn MCP server that enhances AI agents' coding capabilities by providing zero hallucinations, improved code quality, security-first approach, high test coverage, and efficient context management.Last updated -151861TypeScript
- AsecurityAlicenseAqualityA comprehensive MCP server providing tools for AI agents to interact with code, including reading symbols, importing modules, replacing text, and sending OS notifications.Last updated -3512TypeScriptMIT License