Spyglass AI MCP Server
Enables LLMs to query telemetry data via the Spyglass AI agent, providing intelligent insights about application performance, errors, and bottlenecks.
README
Spyglass AI MCP Server
The Spyglass AI MCP server provides a simple interface for LLMs to query the Spyglass AI agent. The agent analyzes your telemetry data and provides intelligent insights about application performance, errors, and bottlenecks.
To install the MCP server for Cursor click the button below. It should open Cursor and prompt you to add your API Key.
Alternatively, add the following to your ~/.cursor/mcp.json file (create it if you need to) and substitute your Spyglass API Key. Then restart Cursor to apply the change.
{
"mcpServers": {
"spyglass-ai": {
"command": "uvx",
"args": ["spyglass-mcp"],
"env": {
"SPYGLASS_API_KEY": "your-key-here"
}
}
}
}
Note that you need to have uv installed first, see the docs for that here
Available Tools
call_spyglass_agent
Calls the Spyglass AI agent with a natural language query about your telemetry data.
Parameters:
query(string, required): Natural language query about your application's telemetry data
Example queries:
- "What are the slowest endpoints in the last hour?"
- "Show me all errors in the checkout service"
- "Which services have the highest error rate?"
- "What's causing high latency in my API?"
- "How many requests has my app had in the last day?"
Returns:
- Natural language analysis of the telemetry data
Configuration
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
SPYGLASS_API_KEY |
Yes | N/A | API Key for authentication with Spyglass agent |
SPYGLASS_AGENT_ENDPOINT |
No | https://agent.spyglass-ai.com |
Agent endpoint URL (useful for local testing) |
Command Line Arguments
| Argument | Required | Default | Description |
|---|---|---|---|
--endpoint |
No | https://agent.spyglass-ai.com |
Spyglass agent endpoint URL |
--transport |
No | stdio |
Transport type (stdio or http) |
--port |
No | 8000 |
Port for HTTP transport |
Example: Using with an MCP Client
import asyncio
from fastmcp import Client
client = Client("http://localhost:8000/mcp")
async def analyze():
async with client:
result = await client.call_tool("call_spyglass_agent", {
"query": "What are the slowest endpoints?"
})
print(result)
asyncio.run(analyze())
Logging
The MCP server logs to both stderr (captured by Cursor) and a file for debugging:
Log file location:
~/.spyglass/logs/mcp-server-YYYYMMDD.log
View logs in real-time:
tail -f ~/.spyglass/logs/mcp-server-$(date +%Y%m%d).log
The logs include:
- Server startup and configuration
- Incoming queries and responses
- API call details (with truncated tokens for security)
- Error messages and stack traces
Development
Prerequisites
- Python 3.11 or higher
- uv package manager
Setup
- Clone the repository and navigate to the project directory:
cd spyglass-mcp
- Install dependencies:
uv sync
This will create a virtual environment and install all required dependencies.
- Copy the example environment file and configure your API key:
cp env.example .env
# Edit .env and add your SPYGLASS_API_KEY
Running Locally
Run the MCP server in stdio mode (default):
uv run spyglass-mcp
Run with a custom endpoint (useful for testing against a local agent):
uv run spyglass-mcp --endpoint http://localhost:8080
Run in HTTP transport mode:
uv run spyglass-mcp --transport http --port 8000
Running Tests
Run all tests:
uv run pytest
Run tests with verbose output:
uv run pytest -v
Run a specific test file:
uv run pytest tests/test_mcp_server.py
Run tests with coverage:
uv run pytest --cov=spyglass_mcp --cov-report=term-missing
Building
Build the package for distribution:
uv build
This will create wheel and source distribution files in the dist/ directory.
Project Structure
spyglass-mcp/
├── .github/
│ └── workflows/
│ └── publish.yaml
├── src/
│ └── spyglass_mcp/
│ ├── __init__.py
│ └── main.py
├── tests/
│ ├── __init__.py
│ ├── conftest.py
│ └── test_mcp_server.py
├── CHANGELOG.md
├── env.example
├── LICENSE
├── pyproject.toml
├── README.md
└── uv.lock
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。