MCP Protocol
March 21, 2026 ยท View on GitHub
The Model Context Protocol (MCP) enables Probe to integrate with AI editors and external tools. Probe supports MCP both as a server (exposing Probe's search capabilities) and as a client (consuming tools from other MCP servers).
TL;DR
# Run Probe as MCP server
probe mcp
# Use in Claude Code (claude_desktop_config.json)
{
"mcpServers": {
"probe": {
"command": "probe",
"args": ["mcp"]
}
}
}
MCP Server Mode
Starting the Server
# Basic MCP server
probe mcp
# With specific directory
probe mcp --path ./my-project
# Via npx
npx -y @probelabs/probe@latest mcp
Tools Exposed
When running as an MCP server, Probe exposes these tools:
| Tool | Description |
|---|---|
search | Semantic code search with Elasticsearch syntax |
query | AST-based structural queries |
extract | Extract code blocks from files |
symbols | List all symbols in a file (TOC with line numbers) |
listFiles | List files in directory |
searchFiles | Find files by name pattern |
Tool Schemas
search
{
"name": "search",
"description": "Search for code patterns using semantic search",
"inputSchema": {
"type": "object",
"properties": {
"query": { "type": "string", "description": "Search query" },
"path": { "type": "string", "description": "Directory to search" },
"maxResults": { "type": "integer", "default": 10 }
},
"required": ["query"]
}
}
query
{
"name": "query",
"description": "Perform AST-based structural queries",
"inputSchema": {
"type": "object",
"properties": {
"pattern": { "type": "string", "description": "AST-grep pattern" },
"path": { "type": "string" },
"language": { "type": "string" }
},
"required": ["pattern"]
}
}
extract
{
"name": "extract",
"description": "Extract code blocks from files",
"inputSchema": {
"type": "object",
"properties": {
"files": {
"type": "array",
"items": { "type": "string" },
"description": "File paths or file:line specs"
}
},
"required": ["files"]
}
}
symbols
{
"name": "symbols",
"description": "List all symbols in a file with line numbers",
"inputSchema": {
"type": "object",
"properties": {
"file": {
"type": "string",
"description": "Path to the file to list symbols from"
}
},
"required": ["file"]
}
}
AI Editor Integration
Claude Code / Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"probe": {
"command": "probe",
"args": ["mcp"],
"env": {}
}
}
}
Or using npx:
{
"mcpServers": {
"probe": {
"command": "npx",
"args": ["-y", "@probelabs/probe@latest", "mcp"]
}
}
}
Cursor
Add to Cursor settings:
{
"mcp": {
"servers": {
"probe": {
"command": "probe",
"args": ["mcp"]
}
}
}
}
Windsurf
Add to Windsurf MCP configuration:
{
"mcpServers": {
"probe": {
"command": "npx",
"args": ["-y", "@probelabs/probe@latest", "mcp"]
}
}
}
MCP Client Mode
ProbeAgent can consume tools from external MCP servers.
Configuration
import { ProbeAgent } from '@probelabs/probe/agent';
const agent = new ProbeAgent({
path: './src',
enableMcp: true,
mcpConfig: {
mcpServers: {
'github': {
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-github'],
transport: 'stdio',
enabled: true,
env: {
GITHUB_TOKEN: process.env.GITHUB_TOKEN
}
},
'filesystem': {
command: 'npx',
args: ['-y', '@modelcontextprotocol/server-filesystem', '/path/to/allowed'],
transport: 'stdio',
enabled: true
}
}
}
});
await agent.initialize();
// MCP tools now available with mcp__ prefix
Configuration File
Create .mcp/config.json or mcp.config.json:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"transport": "stdio",
"enabled": true,
"timeout": 30000
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"transport": "stdio",
"enabled": true,
"env": {
"DATABASE_URL": "postgresql://..."
}
},
"custom-http": {
"url": "http://localhost:3000/mcp",
"transport": "http",
"enabled": true
}
},
"settings": {
"timeout": 30000,
"debug": false
}
}
Configuration Priority
MCP_CONFIG_PATHenvironment variable./.mcp/config.json(local project)./mcp.config.json(local project)~/.config/probe/mcp.json(user config)~/.mcp/config.json(Claude compatible)~/Library/Application Support/Claude/mcp_config.json(macOS)
Transport Types
| Transport | Configuration | Use Case |
|---|---|---|
stdio | command, args | Local spawned processes |
sse | url | Server-Sent Events |
websocket | url (ws://) | WebSocket connections |
http | url | HTTP REST endpoints |
Examples
stdio (Local Process):
{
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"transport": "stdio"
}
}
HTTP (Remote Server):
{
"custom-api": {
"url": "http://localhost:3000/mcp",
"transport": "http"
}
}
WebSocket:
{
"realtime": {
"url": "ws://localhost:8080/mcp",
"transport": "websocket"
}
}
Method Filtering
Control which MCP methods are available:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"transport": "stdio",
"enabled": true,
"allowedMethods": ["search_*", "get_*"],
"blockedMethods": ["delete_*", "dangerous_*"]
}
}
}
Wildcard Patterns:
*- Match allprefix_*- Match starting with prefix*_suffix- Match ending with suffixprefix_*_suffix- Match with prefix and suffix
Timeout Configuration
{
"mcpServers": {
"slow-server": {
"command": "node",
"args": ["server.js"],
"transport": "stdio",
"timeout": 60000
}
},
"settings": {
"timeout": 30000
}
}
Environment Variable:
MCP_MAX_TIMEOUT=120000 # 2 minutes max
Limits:
- Minimum: 30 seconds
- Maximum: 2 hours (7200000ms)
- Default: 30 seconds
Environment Variables
Configuration:
MCP_CONFIG_PATH=/path/to/config.json # Config file path
MCP_MAX_TIMEOUT=120000 # Max timeout (ms)
Per-Server (via env vars):
MCP_SERVERS_GITHUB_COMMAND=npx
MCP_SERVERS_GITHUB_ARGS=-y,@modelcontextprotocol/server-github
MCP_SERVERS_GITHUB_TRANSPORT=stdio
MCP_SERVERS_GITHUB_ENABLED=true
MCP_SERVERS_GITHUB_TIMEOUT=60000
MCP_SERVERS_GITHUB_ALLOWLIST=search_*,get_*
MCP_SERVERS_GITHUB_BLOCKLIST=delete_*
Debugging
Enable debug logging:
DEBUG=1 probe mcp
# or
DEBUG_MCP=1 probe mcp
Debug Output:
[MCP DEBUG] Connecting to server: github
[MCP INFO] Server connected: github
[MCP DEBUG] Tool discovered: github__search_code
[MCP DEBUG] Tool call started: github__search_code
[MCP DEBUG] Tool call completed: github__search_code (245ms)
Telemetry Events
When using with a tracer:
const agent = new ProbeAgent({
enableMcp: true,
tracer: myTracer // OpenTelemetry tracer
});
Events:
initialization.started/initialization.completedserver.connecting/server.connected/server.connection_failedtools.discovered/tools.filteredtool.call_started/tool.call_completed/tool.call_faileddisconnection.started/disconnection.completed
Built-in Server Implementation
The built-in MCP server runs in-process:
import { MCPXmlBridge } from '@probelabs/probe/agent';
// The bridge handles MCP tool integration
const bridge = new MCPXmlBridge();
await bridge.initialize(config);
// Get available tools
const tools = bridge.getTools();
// Execute a tool
const result = await bridge.executeToolCall('search', { query: 'login' });
Server Capabilities:
{
"name": "probe-builtin",
"version": "1.0.0",
"capabilities": {
"tools": {}
}
}
Common MCP Servers
| Server | Package | Purpose |
|---|---|---|
| GitHub | @modelcontextprotocol/server-github | GitHub operations |
| Filesystem | @modelcontextprotocol/server-filesystem | File operations |
| PostgreSQL | @modelcontextprotocol/server-postgres | Database queries |
| Brave Search | @modelcontextprotocol/server-brave-search | Web search |
| Memory | @modelcontextprotocol/server-memory | Key-value storage |
Related Documentation
- MCP Server Setup - Quick setup guide
- AI Code Editors - Editor integration
- ACP Protocol - Advanced agent communication
- Tools Reference - All available tools