
Spanlens
io.github.spanlens由 GitHub 账号 spanlens 发布v0.3.0更新于 Oct 27, 2026
Query Spanlens LLM observability from Cursor, Claude Desktop, or Continue via MCP.
概览
Spanlens MCP 服务器让助手查询你的 Spanlens LLM 可观测性工作区,获取花费、请求、追踪、异常与节省建议。
- 可以做什么
- 获取总花费、请求数、token 用量、延迟与错误率,可按模型或供应商分组
- 按模型、供应商、状态、用户、时间范围和条数筛选单条 LLM 请求
- 列出智能体追踪摘要,并获取单条追踪的完整 span 树
- 查询平台检测到的花费、延迟与错误率异常,可调整观察窗口与灵敏度
- 获取模型替换的节省建议,以及按终端用户的使用明细
- 适用场景
- 适合已将 LLM 使用数据接入 Spanlens,并希望在 Cursor、Claude Desktop 或 Continue 中直接询问花费、延迟、错误、追踪或成本异常,而不必打开仪表盘的用户。
- 运行要求
- 通过 npx 从 npm 包以 stdio 在本地运行,需要 Node.js。需要在 SPANLENS_API_KEY 中提供 Spanlens 公共作用域 API 密钥,缺少密钥或使用完全访问密钥时服务器会拒绝启动。需要访问 Spanlens API 的网络;SPANLENS_BASE_URL 可指向自建实例,SPANLENS_TIMEOUT_MS 设置每次调用超时。
安装
在 SourceWeft 中
- 打开 控制台中的 Spanlens,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
@spanlens/mcp-server
Query your LLM observability data from inside Cursor, Continue, or Claude Desktop. Powered by Spanlens.
Ask your IDE's agent things like "what's my OpenAI spend this week?", "any cost anomalies?", or "show me the most expensive trace today" — and get real answers from your Spanlens workspace through the Model Context Protocol.
30-second setup
1. Issue a public-scope Spanlens key
Public-scope keys (sl_live_pub_*) are read-only — they can query your dashboard data but cannot trigger LLM proxy spend. This server refuses to start with a full-access key because the credential will live in a plaintext config file in your IDE.
Create one at spanlens.io/projects → the Public Keys card at the top → + New public key. Copy the sl_live_pub_… value when it's shown.
2. Add the server to your IDE
Cursor — ~/.cursor/mcp.json (or workspace .cursor/mcp.json)
Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Continue — ~/.continue/config.yaml
3. Reload your IDE and start asking
The agent will discover seven tools and use them automatically when relevant.
What you can ask
Available tools
Safety
This server is designed for the IDE-config use case, where the credential sits in a plaintext file that's easy to leak (dotfile sync, screen shares, accidental commits). Two defenses:
- Public-scope keys only. The server boots, calls
/api/v1/me/key-infoagainst your workspace, and verifies the key hasscope=public. If you accidentally paste a full-accesssl_live_*key, the server refuses to start with a clear error pointing at the correct key type. - Read-only at the API layer. Even if a public key leaks, it cannot call
/proxy/*or/ingest/*— the Spanlens server enforces this with a 403 +PUBLIC_KEY_WRITE_FORBIDDENcode. The blast radius of a leak is "competitor sees my usage stats", not "competitor runs up my OpenAI bill".
Configuration
Self-hosted Spanlens
Links
License
MIT — see LICENSE in the repo root.
来源:packages/mcp-server/README.md,提交 e825a7e
工具
0版本历史
2- v0.3.0最新Sep 28, 2026
- v0.2.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分