Getting Started with Semfora's MCP Server
The Model Context Protocol (MCP) is an open standard for connecting AI assistants to external tools. Semfora Engine includes a native MCP server that exposes 30+ semantic analysis tools to any MCP-compatible AI assistant.
Prerequisites
- Semfora Engine installed (
cargo install semfora-engine) - An MCP-compatible AI assistant (Claude Code, Cursor, etc.)
- A codebase to analyze
Step 1: Index Your Codebase
First, generate a semantic index of your codebase:
cd /path/to/your/project
semfora-engine index generate
This creates a sharded index in .semfora/ that enables fast queries.
Step 2: Configure Your AI Assistant
The easiest way to configure Semfora is with the setup wizard:
# Auto-detect and configure your AI tools
semfora-engine setup
The wizard will detect installed tools (Claude Code, Cursor, VS Code) and configure them automatically.
Manual configuration: If you prefer, add to your AI tool's MCP config (e.g., ~/.claude/mcp.json):
{
"mcpServers": {
"semfora-engine": {
"command": "semfora-engine",
"args": ["serve"]
}
}
}
Step 3: Start Using Semantic Tools
Your AI assistant now has access to unified semantic analysis tools:
Search Code
Find functions, classes, and types with hybrid symbol + semantic search:
search("validateUser")
Get Symbol Details
Get complete semantic information about a symbol:
get_symbol(symbol_hash="abc123hash")
Find Callers
Understand impact before making changes:
get_callers(symbol_hash="abc123hash", depth=2)
Analyze Diff
Review changes semantically:
analyze_diff(base_ref="main")
Available Tools
Here's a quick reference of key unified MCP tools:
| Tool | Description |
|---|---|
search | Hybrid symbol + semantic search |
get_symbol | Get detailed symbol info |
get_callers | Find what calls a symbol |
get_callgraph | Get full call graph |
analyze_diff | Semantic diff analysis |
find_duplicates | Find similar code |
test | Run project tests |
Tips for Best Results
- Keep the index fresh: Run
semfora-engine index generateafter significant changes - Use semantic search: Ask your AI to search semantically, not just by file
- Check callers before changes: Always understand impact before modifying code
Troubleshooting
"Index not found"
Run semfora-engine index generate to create the initial index.
"Symbol not found"
The index may be stale. Run semfora-engine index generate to update.
Connection issues
Ensure the MCP server is running and your configuration is correct.
Next Steps
- Explore the full MCP tools reference
- Learn about call graph visualization
- Set up CI integration