Prerequisites
- Python 3.10 or higher
- A Surfa account (sign up at surfa.dev)
- Your Surfa API key
Step 1: Install the SDK
Install the Surfa SDK in your MCP server project:uv:
Step 2: Track Your First Event
Add Surfa to your MCP server code:Step 3: Configure Your API Key
Set your Surfa API key as an environment variable:.env file:
Get your API key from your Surfa dashboard.
Step 4: Run Your MCP Server
Start your MCP server and trigger some tool calls:Step 5: View Your Analytics
Go to your Surfa dashboard to see:- Total sessions
- Success rate
- Average execution time
- Event timeline
- Error tracking

Step 6: Test Your MCP Connection (Optional)
Want to validate your MCP is working correctly?MCP Testing Guide
Learn how to test and debug MCP connections
Next: Query with Natural Language (Optional)
Want to query your analytics by asking Claude questions in natural language?Set Up Surfa MCP Server
Install the Surfa MCP Server to query analytics through Claude Desktop
- Ask “What’s my success rate?” → Get instant answers
- “Find all errors from yesterday” → Filtered results
- “Analyze my product health” → AI-powered recommendations
Example: Complete MCP Server
Here’s a complete example of an MCP server with Surfa tracking:What’s Tracked Automatically?
When you pass thectx parameter, the Surfa SDK automatically extracts:
- ✅ Client ID - Identifies the MCP client (e.g., Claude Desktop) from MCP context
- ✅ Request ID - Tracks individual requests from MCP context
- ✅ Timestamps - When events occurred
- ✅ Sequence Numbers - Event ordering within a session
- ✅ Runtime Metadata - Provider, model, mode (via
set_runtime())
- kind - Event kind (e.g., “tool”, “session”, “runtime”)
- subtype - Event subtype (e.g., “call_started”, “call_completed”)
- tool_name - Name of the tool being called
- Custom fields - Status, latency, error messages, etc.
Next Steps
Track Events
Learn how to track different types of events
Claude Desktop Setup
Full guide to setting up Claude Desktop integration
Available Tools
Explore all MCP server tools for querying analytics
Best Practices
Tips for getting the most out of Surfa
Troubleshooting
Events not showing up in dashboard
Events not showing up in dashboard
Check:
- API key is correct (
SURFA_INGEST_KEY) - API URL is set (
SURFA_API_URL) - Your MCP server is actually running
- No firewall blocking outbound requests
Claude Desktop not showing Surfa MCP
Claude Desktop not showing Surfa MCP
Check:
- Config file path is correct
- JSON syntax is valid (no trailing commas)
uvpath is correct (runwhich uvto find it)- Surfa MCP directory path is absolute, not relative
Import error: No module named 'surfa_ingest'
Import error: No module named 'surfa_ingest'
Solution:
Make sure you installed the SDK in the correct environment:Verify installation:
Need Help?
View Documentation
Browse the full documentation
Join Discord
Get help from the community
GitHub Issues
Report bugs or request features
Email Support
Contact our support team