A Claude plugin that provides semantic code search capabilities for C/C++ codebases through the Model Context Protocol (MCP).
# Build semcode
cd /path/to/semcode
cargo build --release
# Add to your PATH (choose one method)
export PATH="/path/to/semcode/target/release:$PATH"
# OR create symlinks
sudo ln -s /path/to/semcode/target/release/semcode-mcp /usr/local/bin/
sudo ln -s /path/to/semcode/target/release/semcode-index /usr/local/bin/
sudo ln -s /path/to/semcode/target/release/semcode /usr/local/bin/cd /path/to/your/code
semcode-index --source .This creates a .semcode.db directory in your codebase.
# Add the marketplace
cd /path/to/semcode
claude plugin marketplace add $(pwd)/plugin/marketplace.json
# Install the plugin
claude plugin install semcode@semcode-localImportant: Use an absolute path or $(pwd) for the marketplace. Relative paths will be interpreted as GitHub URLs.
Restart Claude and verify the plugin is working:
What semcode tools do you have access to?
By default, semcode-mcp looks for .semcode.db in your current directory. This lets you work with multiple projects:
cd /path/to/linux
claude # Uses /path/to/linux/.semcode.db
cd /path/to/another-project
claude # Uses /path/to/another-project/.semcode.dbTo always use the same database, edit plugin/semcode/mcp/semcode.json:
{
"mcpServers": {
"semcode": {
"type": "stdio",
"command": "semcode-mcp",
"args": ["--database", "/absolute/path/to/your/codebase"],
"env": {}
}
}
}The plugin provides these MCP tools for Claude:
- find_function - Find functions/macros by name (regex supported)
- find_type - Find types, structs, unions, enums, typedefs
- find_callers - Find functions that call a specific function
- find_callees - Find functions called by a specific function
- find_callchain - Build complete call chains (forward and reverse)
- grep_functions - Regex search through function bodies
- vgrep_functions - Vector embedding search (requires
--vectorsindexing) - diff_functions - Extract functions/types from unified diffs
- find_commit - Search commit history by message, symbols, or paths
- vcommit_similar_commits - Semantic commit search
- lore_search - Search lore.kernel.org email archives
- dig - Find lore emails related to a git commit
- vlore_similar_emails - Semantic search of lore emails
All operations are git-aware and search at your current HEAD commit by default.
For detailed usage information, see:
- docs/semcode-mcp.md - Complete tool reference and usage examples
- docs/claude-semcode-setup.md - Advanced Claude configuration
- docs/lore.md - Linux kernel email archive integration
- docs/schema.md - Database schema details
- Main README - Project overview and build instructions
Ensure semcode binaries are in your PATH:
which semcode-mcp
export PATH="/path/to/semcode/target/release:$PATH"For permanent access, add to ~/.bashrc or ~/.zshrc.
Index your codebase first:
cd /path/to/your/code
semcode-index --source .- Use path patterns to narrow search scope
- Use the
limitparameter to control result size - Consider incremental indexing:
semcode-index --source . --git HEAD~10..HEAD
To pre-approve all semcode tools for a directory, use the provided script:
./plugin/semcode/approve-tools.sh /path/to/your/projectSee TOOL_APPROVAL.md for details.
Licensed under either of Apache License, Version 2.0 or MIT license at your option.