角色提示管理服务

rossicorp-roles是一个MCP标准IO服务器,用于管理RAG服务中的角色提示,提供搜索和CRUD/列表功能,使代理和IDE能够保持角色提示的可发现性和更新。

  • by ianrossi
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 ianrossi/mcp-tool-rossicorp-roles

使用说明

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):的基本URL rag-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