mcp工具rossicorp角色
rossicorp-roles 是一个MCP stdio服务器,用于管理中的角色提示 rag-service。它提供搜索和CRUD/列表助手 roles 域,以便代理/IDE可以保持角色提示可发现且最新。Semver用于MCP服务器和Docker镜像;当前版本: 0.2.0.
RAG依赖性(架构)
- 外部服务:
rag-service是单一依赖;点通过RAG_SERVICE_URL(在MCP工具中共享)。 - 合约:此服务器仅调用
/query,/ingest,/get,/list,/delete;没有局部持久性。 - 多工具模式:每个MCP工具容器仅挂载其代码并调用共享的RAG端点;保持RAG在同一网络上可访问(例如,使用
rag-service或host.docker.internal)。 - 测试/CI预期
rag-service代码可用(PYTHONPATH../rag-service在此monorepo中)或已安装rag-service包裹。
工具
roles_search(query, top_k=5, actor="rossicorp-roles"):跨角色的全文搜索。roles_list(limit=100, include_text=false):列出角色id/元数据(可选包括全文)。roles_get(role_id):按id获取单个角色。roles_upsert(role_id, text, metadata=None):创建或更新角色提示。roles_delete(role_id):删除角色。
配置
RAG_SERVICE_URL(默认值http://localhost:8002):的基本URLrag-service.RAG_DEFAULT_ACTOR(默认值rossicorp-roles):演员传给rag-service用于速率限制。RAG_REQUEST_TIMEOUT(秒,默认值15):网桥调用的HTTP超时。
快速启动(容器优先)
# Build versioned image (tags 0.2.0 and latest)
docker build -t rossicorp-roles:0.2.0 -t rossicorp-roles:latest .
# Run (connects to host rag-service on 8002)
docker run --rm -i \
--add-host host.docker.internal:host-gateway \
-e RAG_SERVICE_URL=http://host.docker.internal:8002 \
rossicorp-roles:0.2.0本地开发(可选)
python -m venv .venv
source .venv/bin/activate
pip install -e .
RAG_SERVICE_URL=http://localhost:8002 python -m rossicorp_roles.server本地测试
测试套件启动 rag-service 例如,选取一个示例角色,并端到端地练习MCP工具:
# Inside this monorepo (has rag-service/):
PYTHONPATH=../rag-service pytest
# Or install rag-service locally first:
pip install rag-service
pytest检查员/食品法典使用
- 检查员:
npx @modelcontextprotocol/inspector --stdio "python -m rossicorp_roles.server" - Codex TOML代码片段:
[mcp_servers.rossicorp-roles]
command = "docker"
args = [
"run", "--rm", "-i",
"--add-host", "host.docker.internal:host-gateway",
"-e", "RAG_SERVICE_URL=http://host.docker.internal:8002",
"rossicorp-roles:0.2.0"
]
startup_timeout_sec = 20
tool_timeout_sec = 60