🤖 Agentrix
Python MCP 服务器注册表和代理,专为 AI 智能体设计
Agentrix 是一个功能强大的 Python 工具,用于管理和代理 Model Context Protocol (MCP) 服务器。它提供了服务器发现、安装、配置和运行的完整解决方案。
✨ 特性
- 🔍 服务器发现: 从中央注册表搜索和发现 MCP 服务器
- 📦 一键安装: 自动安装和配置 MCP 服务器到各种客户端
- 🔧 多客户端支持: 支持 Cursor、Claude Desktop、VS Code 等
- 🚀 代理模式: 作为 MCP 服务器代理运行
- 🛠️ 多语言支持: 支持 NPM、PyPI、GitHub、Docker 等多种服务器类型
- 📊 统计信息: 提供注册表统计和服务器信息
- 🎨 美观界面: 使用 Rich 提供美观的命令行界面
🚀 快速开始
安装
使用 uv 安装 (推荐):
uv add agentrix
或使用 pip:
pip install agentrix
基本使用
- 搜索服务器:
agentrix search weather
agentrix search --category "productivity" --type npm
- 查看服务器信息:
agentrix info @turkyden/weather
- 安装服务器到客户端:
# 安装到 Cursor
agentrix install @turkyden/weather --client cursor --key your-api-key
# 安装到 Claude Desktop
agentrix install @smithery-ai/brave-search --client claude --key your-api-key
- 列出已安装的服务器:
# 列出所有客户端
agentrix list
# 列出特定客户端的服务器
agentrix list --client cursor
# 列出所有客户端的服务器
agentrix list --all
- 卸载服务器:
agentrix uninstall weather --client cursor
🔧 配置
客户端配置
Agentrix 支持以下 MCP 客户端:
| 客户端 | 配置文件路径 | 格式 |
|---|---|---|
| Cursor | ~/.cursor/mcp.json |
JSON |
| Claude Desktop | ~/Library/Application Support/Claude/claude_desktop_config.json |
JSON |
| VS Code | ~/.vscode/settings.json |
JSON |
环境变量
可以通过环境变量配置 Agentrix:
export AGENTRIX_REGISTRY__URL="https://registry.agentrix.dev"
export AGENTRIX_REGISTRY__API_KEY="your-api-key"
export AGENTRIX_LOGGING__LEVEL="DEBUG"
配置文件
创建 ~/.agentrix/config.toml 进行自定义配置:
[registry]
url = "https://registry.agentrix.dev"
api_key = "your-api-key"
cache_ttl = 3600
[logging]
level = "INFO"
console_enabled = true
log_file = "~/.agentrix/logs/agentrix.log"
[proxy]
host = "127.0.0.1"
port = 8080
enable_auth = false
🏗️ 架构设计
代理模式
类似于 @smithery/cli,Agentrix 使用代理模式运行:
- 客户端配置: MCP 客户端配置指向
agentrix run <server-id> - 代理启动: Agentrix 接收请求并启动目标 MCP 服务器
- 透明代理: 所有 MCP 通信透明地转发到目标服务器
{
"mcpServers": {
"weather": {
"command": "uvx",
"args": [
"agentrix",
"run",
"@turkyden/weather",
"--key",
"your-api-key"
]
}
}
}
调用流程
Cursor/Claude Desktop → agentrix run → Target MCP Server
↑ ↓ ↓
←─── MCP Protocol ─────┴──────────────┘
📚 高级用法
运行服务器 (代理模式)
# 直接运行服务器
agentrix run @turkyden/weather --key your-api-key
# 使用配置字符串
agentrix run @turkyden/weather --config '{"env":{"API_TIMEOUT":"30"}}'
查看统计信息
# 注册表统计
agentrix stats
# 可用分类
agentrix categories
# 精选服务器
agentrix featured
缓存管理
# 清除缓存
agentrix clear-cache
🛠️ 开发
项目结构
src/agentrix/
├── __init__.py # 包初始化
├── cli.py # CLI 界面
├── core/ # 核心功能
│ ├── config.py # 配置管理
│ ├── registry.py # 服务器注册表
│ ├── server_manager.py # 服务器管理
│ └── proxy.py # MCP 代理
├── models/ # 数据模型
│ ├── config.py # 配置模型
│ └── server.py # 服务器模型
└── utils/ # 工具函数
└── logger.py # 日志工具
开发环境设置
# 克隆项目
git clone https://github.com/agentrix-ai/agentrix.git
cd agentrix
# 创建虚拟环境
uv venv
source .venv/bin/activate
# 安装依赖
uv sync --all-extras
# 运行测试
pytest
# 代码格式化
black src tests
ruff check src tests --fix
贡献指南
- Fork 项目
- 创建特性分支 (
git checkout -b feature/amazing-feature) - 提交更改 (
git commit -m 'Add amazing feature') - 推送到分支 (
git push origin feature/amazing-feature) - 开启 Pull Request
📋 命令参考
全局选项
--verbose, -v: 启用详细日志--debug: 启用调试模式--config: 指定配置文件路径
命令列表
| 命令 | 描述 | 示例 |
|---|---|---|
search [query] |
搜索服务器 | agentrix search weather |
info <server-id> |
显示服务器信息 | agentrix info @turkyden/weather |
install <server-id> |
安装服务器 | agentrix install @turkyden/weather --client cursor |
uninstall <server-name> |
卸载服务器 | agentrix uninstall weather --client cursor |
list |
列出客户端或服务器 | agentrix list --client cursor |
run <server-id> |
运行服务器 | agentrix run @turkyden/weather --key api-key |
featured |
显示精选服务器 | agentrix featured |
categories |
显示分类 | agentrix categories |
stats |
显示统计信息 | agentrix stats |
clear-cache |
清除缓存 | agentrix clear-cache |
version |
显示版本信息 | agentrix version |
📄 许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
🤝 致谢
🔗 相关链接
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mcpmarket-0.1.6.tar.gz
(81.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mcpmarket-0.1.6-py3-none-any.whl
(40.3 kB
view details)
File details
Details for the file mcpmarket-0.1.6.tar.gz.
File metadata
- Download URL: mcpmarket-0.1.6.tar.gz
- Upload date:
- Size: 81.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75efb9705a66fb9112f0fa4e4122982be41b48b957d1d247d17a1d34f25e468b
|
|
| MD5 |
f6ba12aefdf616a400b9e52072053768
|
|
| BLAKE2b-256 |
545d0efc54bfcf819dbbbec6b17d6ba9a03a32256d04cd7b2eed1194b9d70297
|
File details
Details for the file mcpmarket-0.1.6-py3-none-any.whl.
File metadata
- Download URL: mcpmarket-0.1.6-py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.7.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d296f76ec118645f50067e9cf26b071e659c9abb04fe542d41b3953b5bc96bb
|
|
| MD5 |
1d703d3f727abd843f058867b43b4adc
|
|
| BLAKE2b-256 |
411548e16bdbef711cabb73c715f6dc823f7579ad4d311fa751326f82985f0f5
|