Planfix MCP 服务器实现了商业流程管理系统 Planfix 与模型上下文协议(Model Context Protocol,MCP)的集成,可与 Claude 等 AI 助手配合使用。
本集成系统可帮助用户在利用 Planfix 系统进行业务流程管理的同时,借助 MCP 协议与 AI 助手实现高效交互,提升工作效率。
git clone
cd planfix-mcp-server
# 使用 uv(推荐)
uv sync
# 或者使用 pip
pip install -r requirements.txt
在 Planfix 账户中获取 API 密钥:
创建 .env 文件:
cp .env.example .env
填充 .env 文件:
PLANFIX_ACCOUNT=your-account-name
PLANFIX_API_KEY=your-api-key
# 带命令行参数运行
python -m src.planfix_server --account your-account --api-key your-api-key
# 调试模式运行
python -m src.planfix_server --debug
# 查看帮助
python -m src.planfix_server --help
# 使用环境变量运行(从.env 文件读取)
python -m src.planfix_server
创建任务 "准备演示文稿",描述为 "为客户 XYZ 准备的演示文稿",优先级为 HIGH
查找项目 "网站开发" 下的所有任务
显示上个月的时间报告
创建项目 "新的营销活动",描述为 "2024 年第一季度活动"
服务器支持以下命令行参数:
| 参数 | 描述 | 示例 |
|---|---|---|
--account |
Planfix 账户名称 | --account mycompany |
--api-key |
Planfix API 密钥 | --api-key abc123xyz |
--debug |
启用调试日志 | --debug |
--help |
显示帮助信息 | --help |
--version |
显示版本信息 | --version |
示例用法:
# 通过命令行参数进行完整配置
uv run python -m src.planfix_server --account mycompany --api-key abc123
# 调试模式运行
uv run python -m src.planfix_server --debug
# 与环境变量结合使用
export PLANFIX_ACCOUNT=mycompany
uv run python -m src.planfix_server --api-key abc123
| 变量 | 描述 | 是否必需 |
|---|---|---|
PLANFIX_ACCOUNT |
Planfix 账户名称 | ✅ |
PLANFIX_API_KEY |
API 密钥 | ✅ |
PLANFIX_BASE_URL |
基础 URL(默认:https://{account}.planfix.ru) | ❌ |
DEBUG |
启用调试日志 | ❌ |
Cursor 从 0.42 版本及以上开始支持 MCP 服务器。要进行连接:
Cmd/Ctrl + ,。{
"mcp.servers": {
"planfix": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/your-repo/planfix-mcp@main",
"planfix-server",
"--account", "your-account-name",
"--api-key", "your-api-key"
]
}
}
}
或者使用环境变量:
{
"mcp.servers": {
"planfix": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/your-repo/planfix-mcp@main",
"planfix-server"
],
"env": {
"PLANFIX_ACCOUNT": "your-account-name",
"PLANFIX_API_KEY": "your-api-key"
}
}
}
}
.cursorrules 进行替代配置:
在项目根目录下创建 .cursorrules 文件:MCP Server: Planfix Integration
This project uses a Planfix MCP server for task and project management.
Available tools:
- search_tasks: Find tasks by query, project, assignee, or status
- search_contacts: Search for contacts and companies
- get_contact_details: Get detailed information about a contact
- list_employees: Get list of employees
- list_files: Get files associated with tasks/projects
- list_comments: Get comments for tasks/projects
- list_reports: Get available reports
- list_processes: Get business processes
Server configuration:
- Command: uvx --from git+https://github.com/your-repo/planfix-mcp@main planfix-server
- Requires PLANFIX_ACCOUNT, PLANFIX_API_KEY environment variables
Use these tools to help with project management, task tracking, and CRM operations.
配置完成后,您可以在 Cursor 聊天窗口中直接使用 Planfix:
查找项目 "网站开发" 下的所有活跃任务
显示 ID 为 123 的联系人详细信息
创建所有逾期任务的报告
Cmd/Ctrl + Shift + I)。planfix-mcp-server/
├── src/
│ ├── planfix_server.py # 主要的 MCP 服务器
│ ├── planfix_api.py # Planfix API 客户端
│ ├── config.py # 配置文件
│ └── utils.py # 辅助函数
├── tests/
│ ├── test_server.py # 服务器测试
│ ├── test_api.py # API 测试
│ └── conftest.py # pytest 配置
├── examples/
│ ├── basic_usage.py # 使用示例
│ └── advanced_workflows.py # 复杂工作流
├── docs/
│ ├── api_reference.md # API 参考文档
│ └── troubleshooting.md # 故障排除文档
├── .env.example # 配置示例
├── requirements.txt # 依赖项
├── pyproject.toml # 项目配置
└── README.md # 文档
# 运行所有测试
uv run pytest
# 运行带代码覆盖率的测试
uv run pytest --cov=src
# 仅运行快速测试
uv run pytest -m "not slow"
# 代码格式化
uv run ruff format
# 代码风格检查
uv run ruff check
# 类型检查
uv run mypy src/
# 创建每周规划
tasks = await search_tasks(status="active", assignee_id=123)
report = await get_analytics_report("time", "2024-01-01", "2024-01-07")
# 与外部服务同步
contact = await add_contact("新客户", "client@example.com")
project = await create_project(f"为 {contact.name} 项目")
所有可用工具、资源和提示模板的详细文档请参考 docs/api_reference.md。
常见问题及解决方案请参考 docs/troubleshooting.md。
本项目采用 MIT 许可证,请参阅 LICENSE 文件获取详细信息。
--help、--version 和 --debug 选项。model_dump() 简化了数据返回,以实现更好的集成。PLANFIX_USER_KEY 的依赖(仅使用 PLANFIX_ACCOUNT 和 PLANFIX_API_KEY)。git+repo@main。