Surfa MCP Server

Surfa MCP Server

Query your Surfa Analytics data using natural language through Claude Desktop, ChatGPT, or any MCP-compatible client. Turn your analytics into insights with AI.

Category
访问服务器

README

Surfa MCP Server

Python 3.10+ License: MIT MCP

Query your Surfa Analytics data using natural language through Claude Desktop, ChatGPT, or any MCP-compatible client.

Turn your analytics into insights with AI:

  • Ask "What's my success rate?" → Get instant answers
  • "Find all errors from yesterday" → Filtered event list
  • "Analyze my product health" → AI-powered recommendations

Perfect for Product Managers, DevOps teams, and anyone building with MCPs.

Features

  • 🔍 Query Events - Filter and search through your live traffic events
  • 📊 Analytics Metrics - Get high-level metrics (sessions, success rate, latency)
  • Performance Analysis - Find highest latency queries
  • 🔎 Session Deep-Dive - Investigate specific sessions in detail
  • 🤖 PM Agent Ready - JSON responses optimized for AI agent consumption
  • 🔗 Multi-Query Workflows - Chain queries together for complex analysis

Installation

cd packages/mcp-server
uv pip install -e .

Configuration

Create a .env file:

SURFA_API_KEY=sk_live_your_key_here
SURFA_API_URL=https://surfa-web.vercel.app
SURFA_TIMEOUT=30

Usage

Option 1: Local (Claude Desktop)

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "surfa": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/surfa/packages/mcp-server",
        "run",
        "surfa-mcp"
      ],
      "env": {
        "SURFA_API_KEY": "sk_live_your_key_here",
        "SURFA_API_URL": "https://surfa-web.vercel.app"
      }
    }
  }
}

Option 2: Remote (Hosted on Fly.io) - Multi-tenant

The public Surfa MCP is deployed at https://surfa-mcp.fly.dev and supports multiple users.

Each user provides their own API key:

{
  "mcpServers": {
    "surfa": {
      "url": "https://surfa-mcp.fly.dev",
      "env": {
        "SURFA_API_KEY": "sk_live_your_key_here"
      }
    }
  }
}

Benefits:

  • ✅ No deployment needed - use the public instance
  • ✅ Auto-scales - only runs when you use it
  • ✅ Secure - your API key stays on your machine
  • ✅ Dogfooded - all usage is tracked for analytics

See DEPLOYMENT.md for deploying your own instance.

Restart Claude Desktop and start querying your analytics!

Available Tools

1. get_analytics

Get high-level analytics metrics.

Example:

"Show me my analytics overview"

Returns:

{
  "ok": true,
  "data": {
    "totalSessions": 150,
    "successRate": 85,
    "avgExecutionTime": 245,
    "activeSessions": 12
  }
}

2. query_events

Query events with filters.

Example:

"Show me all errors from the last 24 hours"
"Find tool calls with latency over 1000ms"

Parameters:

  • tool_name - Filter by tool name
  • min_latency / max_latency - Latency range in ms
  • start_date / end_date - ISO 8601 timestamps
  • kind - Event kind (tool, session, runtime)
  • status - Event status (success, error)
  • limit - Max results (default: 100)

3. find_highest_latency

Find slowest queries in a time range.

Example:

"What were the slowest queries this week?"

Parameters:

  • time_range - hour, day, week, or month
  • tool_name - Optional: filter by tool
  • limit - Number of results (default: 10)

4. get_session

Get detailed session information.

Example:

"Show me details for session abc123"

Parameters:

  • session_id - The session ID to retrieve

Multi-Query Workflows

The PM Agent can chain queries together:

Example workflow:

  1. Get analytics → sees low success rate
  2. Query events with status=error → finds errors
  3. Get session details → investigates specific failure

All responses are in JSON format for easy parsing by AI agents.

Dogfooding (Track Your Own MCP Usage)

Want to see your own MCP server usage in Surfa? Enable analytics by adding your ingest key:

# Add to .env
SURFA_INGEST_KEY=sk_live_your_ingest_key_here

This will track:

  • ✅ Tool calls (get_analytics, query_events, etc.)
  • ✅ Latency for each tool
  • ✅ Success/failure rates
  • ✅ Session analytics

All tool calls will appear in your Surfa dashboard, letting you analyze your own MCP server performance!

Development

Run tests:

pytest tests/

Format code:

black src/
ruff check src/

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选