克劳德代理系统
一个配备有MCP(模型上下文协议)工具、Ollama驱动的智能代理系统,以及一个类似于Claude Code的终端界面。
建筑
Terminal CLI ──┬──> Direct Mode (Tools directly)
└──> Agent Mode (Ollama) ──> MCP Server (Tools)组件
- MCP 服务器 - 提供类似Claude Code的工具(读取、写入、编辑、全局搜索、通配符匹配、Bash命令、网页获取等)
- Ollama Agent(可译为“Ollama智能体”或根据具体语境简化为“Ollama代理”) - 具备推理、错误恢复和工具编排能力的智能代理
- 终端命令行界面(CLI) - 带有斜杠命令和丰富渲染效果的交互式界面
特点/特性
- 动态配置 - 基于YAML,无需硬编码
- 智能权限系统 - 请求对敏感操作的批准
- 错误恢复 - 自动重试并应用智能修复
- 多模型支持 - 在Ollama模型之间切换
- 通用任务支持 - 编程、研究、文件管理等
安装
cd claude-agent-system
poetry install使用方法
# Start the system
poetry run python main.py
# Or using the installed script
poetry run claude-agent终端命令
/model- 切换Ollama模型/agent on|off- 切换代理模式/tools- 列出可用的MCP工具/config- 显示/编辑配置/permissions- 管理权限/history- 查看聊天记录/help- 显示帮助
配置
在(此处)编辑YAML文件 config/:
agent_config.yaml- 代理行为与模型设置tools_config.yaml- 工具配置和速率限制permissions_config.yaml- 目录访问和安全规则
发展
# Run tests
poetry run pytest
# Format code
poetry run black .
# Lint
poetry run ruff check .
# Type check
poetry run mypy .示例
代理模式(含推理功能)
>>> /agent on
>>> Read all Python files and summarize the architecture
[Agent] Planning: 1) Glob for .py files 2) Read key files 3) Summarize
[Agent] Executing: Glob("**/*.py")
[Tool] Found 47 files
[Agent] Summary: Architecture follows...直连模式
>>> /agent off
>>> Read main.py
[Tool] Reading /home/user/project/main.py...
[Content displayed]许可证
麻省理工学院许可证(MIT License)
