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. - OpenAI API Key: Required for generating embeddings (local embedding support planned) - Git: Must be a git repository (respec
Add this skill
npx mdskills install st3v3nmw/sourcerer-mcpWell-architected semantic code search with clear tool descriptions and solid technical foundation
1# Sourcerer MCP ๐ง23An MCP server for semantic code search & navigation that helps AI agents work4efficiently without burning through costly tokens.5Instead of reading entire files, agents can search conceptually and6jump directly to the specific functions, classes, and code chunks they need.78## Demo910[](https://asciinema.org/a/736638)1112## Requirements1314- **OpenAI API Key**: Required for generating embeddings (local embedding support planned)15- **Git**: Must be a git repository (respects `.gitignore` files)16- **Add `.sourcerer/` to `.gitignore`**: This directory stores the embedded vector database1718## Installation1920### Go2122```shell23go install github.com/st3v3nmw/sourcerer-mcp/cmd/sourcerer@latest24```2526### Homebrew2728```shell29brew tap st3v3nmw/tap30brew install st3v3nmw/tap/sourcerer31```3233## Configuration3435### Claude Code3637```shell38claude mcp add sourcerer -e OPENAI_API_KEY=your-openai-api-key -e SOURCERER_WORKSPACE_ROOT=$(pwd) -- sourcerer39```4041### mcp.json4243```json44{45 "mcpServers": {46 "sourcerer": {47 "command": "sourcerer",48 "env": {49 "OPENAI_API_KEY": "your-openai-api-key",50 "SOURCERER_WORKSPACE_ROOT": "/path/to/your/project"51 }52 }53 }54}55```5657## How it Works5859Sourcerer ๐ง builds a semantic search index of your codebase:6061### 1. Code Parsing & Chunking6263- Uses [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) to parse source files into ASTs64- Extracts meaningful chunks (functions, classes, methods, types) with stable IDs65- Each chunk includes source code, location info, and contextual summaries66- Chunk IDs follow the format: `file.ext::Type::method`6768### 2. File System Integration6970- Watches for file changes using `fsnotify`71- Respects `.gitignore` files via `git check-ignore`72- Automatically re-indexes changed files73- Stores metadata to track modification times7475### 3. Vector Database7677- Uses [chromem-go](https://github.com/philippgille/chromem-go) for persistent vector storage in `.sourcerer/db/`78- Generates embeddings via OpenAI's API for semantic similarity79- Enables conceptual search rather than just text matching80- Maintains chunks, their embeddings, and metadata8182### 4. MCP Tools8384- `semantic_search`: Find relevant code using semantic search85- `get_chunk_code`: Retrieve specific chunks by ID86- `find_similar_chunks`: Find similar chunks87- `index_workspace`: Manually trigger re-indexing88- `get_index_status`: Check indexing progress8990This approach allows AI agents to find relevant code without reading entire files,91dramatically reducing token usage and cognitive load.9293## Supported Languages9495Language support requires writing [Tree-sitter queries](https://github.com/st3v3nmw/sourcerer-mcp/blob/main/internal/parser/go.go) to96identify functions, classes, interfaces, and other code structures for each language.9798**Supported:** Go, JavaScript, Markdown, Python, TypeScript99100**Planned:** C, C++, Java, Ruby, Rust, and others101102## Contributing103104All contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).105106```107$ ls @stephenmwangi.com108- gh:st3v3nmw/obsidian-spaced-repetition109- gh:st3v3nmw/lsfr110```111
Full transparency โ inspect the skill content before installing.