协议框📦
    
代理网络的标准库。\ https://protocolbox.in
ProtocolBox是高可靠性的集合 MCP(模型上下文协议) 为AI代理设计的工具。它提供经过验证的、令牌高效的实用程序,可与Claude、Gemini和其他符合MCP的代理开箱即用。
🚀 安装
pip install protocolbox初始化代理的配置:
protocolbox init🛠️ 工具
ProtocolBox目前导出了8个针对代理工作流程优化的工具:
| 工具 | 签名 | 描述 |
|---|---|---|
| 刮擦 | scrape(url: str) -> str | 获取网页并将其转换为干净、节省令牌的Markdown。自动删除广告、脚本和杂乱。 |
| 修复JSON | heal_json(json_str: str) -> dict | 将LLM经常产生的格式错误的JSON字符串(尾随逗号、缺少引号等)修复到有效的Python字典中。 |
| 网络搜索 | web_search(query: str, max_results: int) -> str | 使用DuckDuckGo进行以隐私为重点的网络搜索。返回格式化的Markdown结果。 |
| 安全数学 | safe_math(expression: str) -> str | 安全地计算数学表达式,无需 eval().支持算术和常用数学函数。 |
| 获取时间 | get_time(timezone: str) -> str | 返回任何时区的当前实际时间(ISO 8601格式)。 |
| 获取成绩单 | get_transcript(video_url: str) -> str | 将YouTube视频的英文转录本作为干净文本获取。 |
| 记住 | remember(key: str, value: str) -> str | 将键值对存储在持久本地内存中。 |
| 召回 | recall(key: str) -> str | 按键从持久本地内存中检索值。 |
⚡ 用法
启动MCP服务器,向您的代理公开这些工具:
protocolbox start或使用 uv:
uv run protocolbox start📦 项目结构
protocolbox/
├── src/protocolbox/ # Core package
│ ├── server.py # FastMCP server
│ ├── cli.py # CLI entry point
│ └── tools/ # Tool implementations
│ ├── scraper.py # scrape()
│ ├── json_healer.py# heal_json()
│ ├── search.py # web_search()
│ ├── math_utils.py # safe_math()
│ ├── time_utils.py # get_time()
│ ├── youtube.py # get_transcript()
│ └── memory.py # remember() + recall()
├── tests/ # 280+ edge-case tests
├── docs/ # Documentation site
└── pyproject.toml # Project config👨💻 发展
我们建议 紫外线 为了实现快速、可靠的开发环境。
# Clone and setup
git clone https://github.com/ianuragbhatt/protocolbox.git
cd protocolbox
uv pip install -e ".[dev]"
# Run tests (100% pass rate required)
pytest tests/ -v
# Linting
ruff check .🤝 贡献
我们欢迎捐款!请参阅 贡献.md 有关如何添加新工具的详细信息。
维护人员: 阿努拉格·巴特(@ianuragbhatt)
许可证
麻省 理工© 2026 ProtocolBox。
