Arize AX MCP服务器
MCP服务器,用于访问Arize AX数据、查询跟踪、管理数据集以及从Claude Code运行实验。
特性
- 数据集:列出、创建和管理实验数据集
- 实验:列出实验并查看结果
- 痕迹:使用SQL风格的查询导出和筛选跟踪/跨度
- 分析:分析错误、延迟分布和跟踪统计信息
快速开始
1.获取Arize证书
- API密钥首选 Arize AX >空间设置>API密钥>生成密钥
- 空间ID:在您的干旱空间设置中找到
2.配置克劳德代码
运行以下命令将服务器添加到Claude Code:
claude mcp add arize \
--transport stdio \
-e ARIZE_API_KEY= \
-e ARIZE_SPACE_ID= \
-- uvx --from git+https://github.com/exiao/arize-mcp.git arize-mcp就是这样!无需克隆或手动安装。
Alternative: Manual JSON configuration
添加到您的Claude Code MCP设置中(~/.claude/settings.json 或项目设置):
{
"mcpServers": {
"arize": {
"command": "uvx",
"args": ["--from", "git+https://github.com/exiao/arize-mcp.git", "arize-mcp"],
"env": {
"ARIZE_API_KEY": "",
"ARIZE_SPACE_ID": ""
}
}
}
}Alternative: Install from source
如果要修改服务器或从本地副本运行:
git clone https://github.com/exiao/arize-mcp.git
cd arize-mcp
uv pip install -e .然后配置Claude代码:
{
"mcpServers": {
"arize": {
"command": "arize-mcp",
"env": {
"ARIZE_API_KEY": "",
"ARIZE_SPACE_ID": ""
}
}
}
}4.在克劳德代码中使用
配置后,您可以向Claude Code提出以下问题:
"List my Arize projects"
"Export traces from bloom_prod for the last 7 days"
"Show me errors in my-project"
"What's the p95 latency for LLM spans?"
"Create a dataset called 'evaluation-set'"可用工具
项目和架构
| 工具 | 说明 |
|---|---|
list_projects | 列出Arize空间中的所有项目 |
get_model_schema | 获取跟踪模式(span属性、evals、注释) |
痕迹和跨度
| 工具 | 说明 |
|---|---|
export_traces | 使用时间范围和列过滤器导出跟踪 |
get_trace | 获取特定跟踪ID的所有跨度 |
filter_spans | 按种类、错误或自定义WHERE子句筛选跨度 |
数据集
| 工具 | 说明 |
|---|---|
list_datasets | 列出所有数据集 |
get_dataset | 获取数据集内容和示例 |
create_dataset | 创建新数据集 |
delete_dataset | 删除数据集 |
实验
| 工具 | 说明 |
|---|---|
list_experiments | 列出所有实验 |
get_experiment | 获取实验结果并运行 |
分析
| 工具 | 说明 |
|---|---|
analyze_errors | 用模式总结错误 |
analyze_latency | 延迟统计数据(p50、p90、p95、p99) |
get_trace_statistics | 按跨度类型和状态汇总统计数据 |
示例用法
导出和分析痕迹
User: "Export traces from bloom_prod for the last 24 hours"
Claude: I'll export the traces from your bloom_prod project.
[Calls export_traces with project_name="bloom_prod", days=1]
Found 1,607 spans. Here's a summary:
- 1,450 LLM Generation spans
- 157 Chain spans
- Average latency: 245ms调查错误
User: "Show me errors in bloom_prod from the last week"
Claude: I'll analyze errors in your project.
[Calls analyze_errors with project_name="bloom_prod", days=7]
Found 23 errors:
- "Rate limit exceeded" (15 occurrences)
- "Context length exceeded" (5 occurrences)
- "Invalid response format" (3 occurrences)过滤器特定跨度
User: "Find spans where token count > 1000"
Claude: I'll filter spans with high token usage.
[Calls filter_spans with where="attributes.llm.token_count.total > 1000"]
Found 45 spans with token count > 1000...配置选项
环境变量
| 变量 | 必填 | 描述 |
|---|---|---|
ARIZE_API_KEY | 是 | Arize AX的API密钥 |
ARIZE_SPACE_ID | 是 | 来自Arize URL的空间ID |
API权限
不同的功能需要不同的API权限:
| 功能 | 需要权限 |
|---|---|
| 数据集和实验 | 数据集访问 |
| 项目和架构 | 开发人员权限 |
| 跟踪导出 | 导出权限 |
如果出现权限错误,请在Arize AX>空间设置>API密钥中生成具有所需权限的新服务密钥。
测试您的设置
运行凭据测试脚本:
export ARIZE_API_KEY="your-api-key"
export ARIZE_SPACE_ID="your-space-id"
python test_credentials.py这将测试每个API端点,并显示哪些端点使用API密钥。
故障排除
“身份验证失败”或“无法验证API密钥”
- 验证您的API密钥是否正确且未过期
- 生成具有导出权限的新服务密钥
- 确保空间ID与API密钥的组织相匹配
“用户没有开发人员权限”
- 您的API密钥需要GraphQL查询的开发人员权限
- 请联系您的Arize管理员或生成具有开发人员访问权限的新密钥
“模型不存在”
- 检查项目名称是否完全匹配(区分大小写)
- 使用
list_projects查看可用的项目名称
发展
# Install with dev dependencies
uv pip install -e ".[dev]"
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --cov=arize_mcp --cov-report=term-missing
# Test the server locally
fastmcp dev src/arize_mcp/server.py测试
测试套件位于 tests/ 目录,并将pytest与mock一起使用,以避免需要真正的API凭据。
测试结构
tests/
├── conftest.py # Shared fixtures (mock clients, sample data)
├── test_config.py # Config validation tests
├── test_server.py # Server initialization tests
├── test_tools_models.py # Project/model tool tests
├── test_tools_traces.py # Trace export/filter tool tests
├── test_tools_datasets.py # Dataset/experiment tool tests
└── test_tools_analysis.py # Analysis tool tests运行测试
# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/test_config.py
# Run specific test class
uv run pytest tests/test_tools_traces.py::TestExportTraces
# Run with verbose output
uv run pytest -v
# Run with coverage report
uv run pytest --cov=arize_mcp --cov-report=html集成测试
对于具有真实API证书的集成测试:
export ARIZE_API_KEY="your-api-key"
export ARIZE_SPACE_ID="your-space-id"
python test_credentials.py技术细节
此MCP服务器使用:
- Arize SDK v8 (beta)用于通过Flight协议导出跟踪
- REST API v2 用于数据集和实验
- GraphQL API 用于项目列表和模式查询
- 快速MCP 用于MCP服务器实现
