TutorialsDecember 14, 20246 min read

Getting Started with Semfora's MCP Server

A step-by-step guide to connecting your AI coding assistant to Semfora's MCP server for semantic code intelligence.

T

The Semfora Team

Developer Relations

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:

ToolDescription
searchHybrid symbol + semantic search
get_symbolGet detailed symbol info
get_callersFind what calls a symbol
get_callgraphGet full call graph
analyze_diffSemantic diff analysis
find_duplicatesFind similar code
testRun project tests

Tips for Best Results

  1. Keep the index fresh: Run semfora-engine index generate after significant changes
  2. Use semantic search: Ask your AI to search semantically, not just by file
  3. 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