A Model Context Protocol (MCP) server that exposes Sirchmunk's intelligent code and document search capabilities as MCP tools.
-
Multi-Mode Search
- DEEP: Comprehensive knowledge extraction with full context analysis (~10-30s)
- FILENAME_ONLY: Fast filename pattern matching (<1s)
-
Knowledge Cluster Management
- Automatic knowledge extraction and storage
- Semantic similarity-based cluster reuse
- Version tracking and lifecycle management
-
MCP Integration
- Standard MCP protocol support
- Stdio transport (Claude Desktop / Claude Code compatible)
- Streamable HTTP transport (for web-based clients)
pip install sirchmunk[mcp]sirchmunk initThis will:
- Create
~/.sirchmunkdirectory structure - Generate
~/.sirchmunk/.envconfiguration file - Generate
~/.sirchmunk/mcp_config.jsonclient config template - Check dependencies (rga, MCP package)
- Download embedding model
Edit ~/.sirchmunk/.env with your API key:
# Required
LLM_API_KEY=your-api-key
LLM_MODEL_NAME=gpt-5.2
LLM_BASE_URL=https://api.openai.com/v1Anthropic provides a dedicated debugging tool called MCP Inspector (runnable via npx). It simulates a Client's behavior and provides a web-based interface for interaction.
MCP_LOG_LEVEL=INFO npx @modelcontextprotocol/inspector sirchmunk mcp serveYou should see:
Starting MCP inspector...
Proxy server listening on localhost:6277
Session token: a2057c4...
MCP Inspector is up and running at:
http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=a2057c4...
Press Ctrl+C to stop.
How to use:
- Connect -> Tools -> List Tools ->
sirchmunk_search-> Input parameters -> Run Tool - Example input parameters:
query:"transformer attention implementation"paths:["/path/to/your_docs"]
- Check the response for search results.
- Python: 3.10 or higher
- Memory: At least 2GB RAM recommended
- LLM API Key: OpenAI or compatible endpoint
# Create a virtual environment (optional but recommended)
conda create -n sirchmunk python=3.13 -y
conda activate sirchmunk
# Install with MCP support
pip install sirchmunk[mcp]git clone https://github.com/modelscope/sirchmunk.git
cd sirchmunk
pip install -e ".[mcp]"Sirchmunk uses ripgrep-all for document search.
It will be installed automatically during initialization, but you can install it manually, see https://github.com/phiresky/ripgrep-all
After running sirchmunk init, a ~/.sirchmunk/mcp_config.json file is generated. Copy it to your MCP client configuration directory.
Example:
{
"mcpServers": {
"sirchmunk": {
"command": "sirchmunk",
"args": ["mcp", "serve"],
"env": {
"SIRCHMUNK_SEARCH_PATHS": "/path/to/your_docs,/another/path"
}
}
}
}| Parameter | Description |
|---|---|
command |
The command to start the MCP server. Use full path (e.g. /path/to/venv/bin/sirchmunk) if running in a virtual environment. |
args |
Command arguments. ["mcp", "serve"] starts the MCP server in stdio mode. |
env.SIRCHMUNK_SEARCH_PATHS |
Default document search directories (comma-separated). Supports both English , and Chinese οΌ as delimiters. When set, these paths are used as default if no paths parameter is provided during tool invocation. |
Other optional env variables that can be set inline:
| Variable | Default | Description |
|---|---|---|
LLM_API_KEY |
(from ~/.sirchmunk/.env) |
LLM API key. Only needed here if you want to override the .env value. |
LLM_MODEL_NAME |
gpt-5.2 |
LLM model name. |
SIRCHMUNK_WORK_PATH |
~/.sirchmunk |
Working directory for data and cache. |
MCP_LOG_LEVEL |
INFO |
Logging level (DEBUG, INFO, WARNING, ERROR). |
Note: Environment variables set in
envoverride those from~/.sirchmunk/.env. You generally only needSIRCHMUNK_SEARCH_PATHShere; other variables are configured duringsirchmunk init.
Edit ~/.cursor/mcp.json:
{
"mcpServers": {
"sirchmunk": {
"command": "sirchmunk",
"args": ["mcp", "serve"],
"env": {
"SIRCHMUNK_SEARCH_PATHS": "/path/to/your_docs"
}
}
}
}Edit the configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"sirchmunk": {
"command": "sirchmunk",
"args": ["mcp", "serve"],
"env": {
"SIRCHMUNK_SEARCH_PATHS": "/path/to/your_docs",
"MCP_LOG_LEVEL": "INFO"
}
}
}
}Note: If using virtual environment, use the full path:
{
"mcpServers": {
"sirchmunk": {
"command": "/path/to/sirchmunk-env/bin/sirchmunk",
"args": ["mcp", "serve"],
"env": {
"SIRCHMUNK_SEARCH_PATHS": "/path/to/your_docs"
}
}
}
}After configuration, completely quit and restart your Claude client.
User: "Search for transformer attention implementation in my project"
Claude: [Using sirchmunk_search tool]
{
"query": "transformer attention implementation",
"paths": ["/path/to/project"],
"mode": "FAST",
"top_k_files": 3
}
Response: Comprehensive analysis with code snippets and patterns
User: "Find all test files in the project"
Claude: [Using sirchmunk_search tool]
{
"query": "test",
"paths": ["/path/to/project"],
"mode": "FILENAME_ONLY"
}
Response: List of matching files with paths
User: "Show saved knowledge clusters"
Claude: [Using sirchmunk_list_clusters tool]
User: "Show details of cluster C1007"
Claude: [Using sirchmunk_get_cluster tool]
{
"cluster_id": "C1007"
}
Intelligent code and document search.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | Yes | - | Search query or question |
paths |
array | No | configured/cwd | Paths to search in |
mode |
string | No | "FAST" | FAST / DEEP / FILENAME_ONLY |
max_depth |
integer | No | 5 | Directory search depth |
top_k_files |
integer | No | 3 | Files to return |
max_loops |
integer | No | 10 | ReAct iterations (DEEP) |
max_token_budget |
integer | No | 64000 | Token budget (DEEP) |
enable_dir_scan |
boolean | No | true | Directory scanning (DEEP) |
include |
array | No | - | Glob patterns to include |
exclude |
array | No | - | Glob patterns to exclude |
return_context |
boolean | No | false | Return full SearchContext with cluster and telemetry |
Retrieve a saved knowledge cluster by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
cluster_id |
string | Yes | Cluster ID (e.g., 'C1007') |
List all saved knowledge clusters.
| Parameter | Type | Default | Description |
|---|---|---|---|
limit |
integer | 10 | Maximum clusters to return |
sort_by |
string | "last_modified" | hotness/confidence/last_modified |
| Variable | Default | Description |
|---|---|---|
LLM_API_KEY |
(required) | Your LLM API key |
LLM_BASE_URL |
https://api.openai.com/v1 |
LLM API endpoint |
LLM_MODEL_NAME |
gpt-5.2 |
Model to use |
SIRCHMUNK_WORK_PATH |
~/.sirchmunk |
Working directory |
SIRCHMUNK_SEARCH_PATHS |
(empty) | Default search paths (comma-separated) |
SIRCHMUNK_ENABLE_CLUSTER_REUSE |
true |
Enable knowledge reuse |
CLUSTER_SIM_THRESHOLD |
0.85 |
Similarity threshold |
DEFAULT_MAX_DEPTH |
5 |
Default search depth |
DEFAULT_TOP_K_FILES |
3 |
Default files count |
MCP_LOG_LEVEL |
INFO |
Logging level |
Local LLM (Ollama, LM Studio):
{
"env": {
"LLM_BASE_URL": "http://localhost:11434/v1",
"LLM_API_KEY": "ollama",
"LLM_MODEL_NAME": "llama3"
}
}Azure OpenAI:
{
"env": {
"LLM_BASE_URL": "https://your-resource.openai.azure.com/",
"LLM_API_KEY": "your-azure-key",
"LLM_MODEL_NAME": "gpt-5.2"
}
}from sirchmunk_mcp import Config, create_server
# Load from environment
config = Config.from_env()
# Create and run server
server = create_server(config)Run the MCP server.
sirchmunk mcp serve [OPTIONS]
Options:
--transport {stdio,http} Transport protocol (default: stdio)
--host TEXT Host for HTTP transport (default: localhost)
--port INTEGER Port for HTTP transport (default: 8080)
--log-level {DEBUG,INFO,WARNING,ERROR} Logging levelShow MCP version information.
sirchmunk mcp versionβββββββββββββββββββββββββββββββββββ
β MCP Client (Claude/Cursor) β
ββββββββββββββ¬βββββββββββββββββββββ
β MCP Protocol (stdio/http)
β
βββββββββββββββββββββββββββββββββββ
β Sirchmunk MCP Server β
β ββββββββββββββββββββββββββββ β
β β FastMCP Layer β β
β β - @mcp.tool() decoratorsβ β
β β - Auto tool discovery β β
β ββββββββββββ¬ββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββββ β
β β Sirchmunk Service β β
β β - AgenticSearch Init β β
β β - Config Management β β
β ββββββββββββ¬ββββββββββββββββ β
β β β
β ββββββββββββββββββββββββββββ β
β β AgenticSearch Core β β
β β - DEEP/FILENAME β β
β β - KnowledgeBase β β
β β - GrepRetriever β β
β ββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββ
| Mode | LLM Calls | Speed | Use Case |
|---|---|---|---|
| DEEP | 4-6 | 10-30s | Comprehensive analysis |
| FILENAME_ONLY | 0 | <1s | File discovery |
- Use specific search paths - Narrow paths = faster searches
- Choose appropriate mode - Match mode to task complexity
- Leverage cluster reuse - Similar queries reuse cached knowledge
- Adjust depth - Lower
max_depthfor faster results
# Verify installation
pip show sirchmunk
# Reinstall with MCP support
pip install --force-reinstall "sirchmunk[mcp]"# Check environment variable
echo $LLM_API_KEY
# Set it
export LLM_API_KEY="your-api-key"# Try auto-install
sirchmunk init
# Or install manually (see Installation section)- Verify config file location and JSON syntax:
python -m json.tool ~/.cursor/mcp.json - Check Claude client logs for MCP errors
- Completely restart the client (quit, not just close)
First-time startup downloads embedding models. To skip:
export SIRCHMUNK_ENABLE_CLUSTER_REUSE=falseMCP_LOG_LEVEL=DEBUG SIRCHMUNK_VERBOSE=true sirchmunk mcp serveCheck logs in ~/.sirchmunk/logs/.
# From PyPI
pip install --upgrade "sirchmunk[mcp]"
# Re-initialize
sirchmunk init# Remove package
pip uninstall sirchmunk
# Remove data (optional)
rm -rf ~/.sirchmunk# Clone and install
git clone https://github.com/modelscope/sirchmunk.git
cd sirchmunk
pip install -e ".[mcp]"- Never commit API keys - Use environment variables
- Review search paths - Only include trusted directories
- Monitor API usage - DEEP mode uses more tokens
- Update regularly - Keep dependencies current
Apache License 2.0 - see LICENSE
- Issues: https://github.com/modelscope/sirchmunk/issues
- Logs:
~/.sirchmunk/logs/