Claude Code MCP Integration Setup
This guide explains how to connect Claude Code to your WDG AI Development Environment's MCP server for intelligent code search and assistance.
Prerequisites
WDG Services Running
bash# Start all services including MCP server wdg start # Verify MCP is running (should show port 8765) wdg statusCode Indexed
bash# Index the Wikit framework wdg index # Index your project wdg index my-project # Verify collections exist wdg collections list
Configure Claude Code
Step 1: Open Claude Code Settings
- Open Claude Code
- Go to Settings (gear icon)
- Navigate to "MCP Servers" or "Model Context Protocol"
Step 2: Add WDG MCP Server
Add this configuration to your Claude Code MCP settings:
{
"mcpServers": {
"wdg-local": {
"command": "python3",
"args": [
"${WDG_HOME}/mcp-server/server.py"
],
"env": {
"QDRANT_HOST": "localhost",
"QDRANT_PORT": "6333",
"MCP_PORT": "8765"
}
}
}
}Alternative: Using Network Connection
If the above doesn't work, try connecting directly to the running server:
{
"mcpServers": {
"wdg-local": {
"uri": "http://localhost:8765",
"transport": "http"
}
}
}Step 3: Restart Claude Code
After adding the configuration, restart Claude Code to load the MCP server connection.
Available MCP Tools
Once connected, Claude Code can use these tools:
1. search_codebase
Search across your indexed code with text matching.
Example prompts:
- "Find all user authentication functions"
- "Search for database queries in my-project"
- "Show me all WordPress hooks"
2. list_collections
See all indexed projects and the framework.
Example: "What projects are indexed?"
3. search_functions
Find specific functions by name.
Example: "Find the get_user_data function"
4. search_wordpress_hooks
Search for WordPress actions and filters.
Example: "Show me all init hooks"
5. search_classes
Find PHP or JavaScript classes.
Example: "Find the UserController class"
6. search_wikit_blocks
Search for Wikit Gutenberg blocks.
Example: "Show me all hero blocks"
7. get_project_info
Get information about a specific project.
Example: "Tell me about the client-site project"
8. search_recent_changes
See recently indexed code.
Example: "What code was recently indexed?"
Testing the Connection
In Claude Code, try these commands:
Test basic connection:
Use the list_collections tool to show me what's indexedSearch the framework:
Search for WordPress init hooks in the frameworkSearch a project:
Find all functions in my-project that handle user data
How It Works
%%{init: {'theme':'neutral'}}%%
graph LR
Claude[Claude Code] --> MCP[MCP Server<br/>localhost:8765]
MCP --> Qdrant[Qdrant DB<br/>localhost:6333]
Qdrant --> Collections[Collections<br/>- wdg_framework<br/>- project_my_site<br/>- project_client_site]
- Claude Code sends search requests to MCP server
- MCP Server queries Qdrant using metadata filters
- Qdrant returns matching code from indexed collections
- Results are formatted and sent back to Claude
Important Notes
No Embeddings in MCP
The MCP server does NOT generate embeddings. It only queries the existing indexed data using:
- Text matching in code content
- Metadata filtering (file types, component types)
- Collection-specific searches
Text-Based Search
Since MCP can't generate embeddings, searches are text-based:
- Exact or partial text matches
- Case-insensitive searching
- Metadata filtering for precision
Indexing Required
Projects must be indexed BEFORE searching:
# Index a project first
wdg index my-project
# Then search it in Claude
"Search for functions in my-project"Troubleshooting
MCP Server Not Connecting
Check if services are running:
bashdocker ps | grep mcp netstat -an | grep 8765Check logs:
bashdocker logs wdg-mcpRestart MCP:
bashwdg stop wdg start
No Search Results
Verify indexing:
bashwdg collections listRe-index if needed:
bashwdg index --update wdg index my-projectCheck collection names:
- Framework:
wdg_framework - Projects:
project_<name>(hyphens become underscores)
- Framework:
Connection Refused
Check firewall:
bashsudo ufw allow 8765Verify binding: The MCP server binds to
0.0.0.0:8765by defaultTry localhost explicitly: Use
http://127.0.0.1:8765instead oflocalhost
Advanced Configuration
Custom Port
Change MCP port in .env:
MCP_PORT=9000Then update Claude Code config accordingly.
Authentication (Optional)
Add token authentication in .env:
MCP_AUTH_TOKEN=your-secret-tokenUpdate Claude Code config:
{
"mcpServers": {
"wdg-local": {
"uri": "http://localhost:8765",
"headers": {
"Authorization": "Bearer your-secret-token"
}
}
}
}Example Claude Code Session
Once connected, you can have conversations like:
You: "Show me what projects are indexed" Claude: Uses list_collections tool "I can see 2 collections: wdg_framework with 15,000 vectors and project_client_site with 3,000 vectors."
You: "Find all user authentication functions in client-site" Claude: Uses search_functions tool "I found 5 authentication-related functions in client-site..."
You: "Show me how Wikit blocks are registered" Claude: Uses search_wikit_blocks tool "Here are the Wikit block registrations I found..."
MCP Integration Capabilities
- Context-Aware Assistance: Claude accesses your indexed codebase
- Project-Specific Search: Query within specific project scopes
- Framework Knowledge: Semantic search across Wikit patterns
- Local Processing: All operations run on your machine
- Privacy: Code remains on local infrastructure
Need Help? Check the main documentation or run wdg help