特征:
- 符合MCP规范的模型上下文协议。
- SSE传输机制
- TextAttack和Garak的代理版本
- MCP服务器完全可扩展以添加更多工具。
______________________________________________________________________
先决条件
- 码头工人 20.10+和Docker Compose v2 CLI插件。
- GPU(可选) 如果你想让CUDA加速TextAttack/Garak运行。
- 奥拉马 在本地运行LLM后端。
拉动底座LLM一次:
ollama pull magistral:24b-small-2506-q8_0______________________________________________________________________
快速开始
# Build & start every service (three terminals or run in detached mode)
docker compose -f mcp-docker-compose.yml up --build -d
docker compose -f toolx-docker-compose.yml up --build -d
docker compose -f agent-docker-compose.yml up --build -d
堆栈可在以下位置访问:
http://localhost:7070/sse–MCP通过服务器发送事件http://localhost:7575–ToolX微服务http://localhost:5000–代理REST API
______________________________________________________________________
端点
代理API(service-agent)
| 方法 | 终点 | 目的 |
|---|---|---|
| 职位 | /api/create_session | 创建新的聊天会话 |
| 职位 | /api/run | 发送消息/运行命令 |
______________________________________________________________________
使用示例
注意:在所有请求中保持相同的“userId”
# 1. Create a chat session
curl -X POST http://localhost:5000/api/create_session
# 2. Basic agent interaction
curl -X POST http://localhost:5000/api/run \
-H "Content-Type: application/json" \
-d '{
"appName": "multi_tool_agent",
"userId": "myusername",
"sessionId": "",
"newMessage": {
"parts": [{"text": "Hi, what can you do?"}],
"role": "user"
},
"streaming": false
}'
# 3. Launch a TextAttack evaluation
curl -X POST http://localhost:5000/api/run \
-H "Content-Type: application/json" \
-d '{
"appName": "multi_tool_agent",
"userId": "myusername",
"sessionId": "",
"newMessage": {
"parts": [{"text": "Please run an attack with model distilbert-base-uncased-finetuned-sst-2-english on the setfit/sst2 dataset using the textfooler recipe for 5 examples"}],
"role": "user"
},
"streaming": false
}'
# 4. Launch a Garak probe
curl -X POST http://localhost:5000/api/run \
-H "Content-Type: application/json" \
-d '{
"appName": "multi_tool_agent",
"userId": "myusername",
"sessionId": "",
"newMessage": {
"parts": [{"text": "Please run a scan with model gpt2 and probe xss"}],
"role": "user"
},
"streaming": false
}'______________________________________________________________________
样本输出
______________________________________________________________________
建筑
| 服务 | 描述 | 端口 |
|---|---|---|
| 服务mcp | MCP网关和Starlette ASGI服务器 | 7070 |
| 维修工具x | TextAttack和Garak HTTP微服务 | 7575 |
| 服务代理 | ADK | 5000支持的多工具会话代理 |
这三种服务都有自己的定义 *Docker Compose* 允许独立构建的文件。对于生产部署,您可以同时启动它们,也可以只挑选所需的组件。
┌──────────────┐ SSE ┌───────────────┐ REST ┌──────────────┐
│ Clients │──────────────►│ service-mcp │─────────►│service-toolx │
└──────────────┘ └───────────────┘ └──────────────┘
│
│ REST
▼
┌───────────────┐
│ service-agent │
└───────────────┘______________________________________________________________________
贡献
欢迎投稿! 🚀 请随意分叉此仓库,打开一个问题以开始讨论,或提交一个pull请求以帮助改进项目。
______________________________________________________________________
许可证
此存储库根据 Apache 2.0 许可证。 许可证可在以下网址获得 许可证
______________________________________________________________________
鸣谢
内置于❤️ 由Avaly.ai提供。如需支持,请联系:contact@avaly.ai.
