Feishu Project Management
STDIOHTTP-SSEModel Context Protocol service for end-to-end requirement management and development automation.
Model Context Protocol service for end-to-end requirement management and development automation.
基于Model Context Protocol (MCP)的智能研发流程管理系统,实现端到端的需求管理与开发流程自动化。
系统采用模块化设计,主要包括以下组件:
详细的架构设计请参考设计文档。
# 克隆仓库 git clone https://github.com/yourusername/feishu-project-mcp.git cd feishu-project-mcp # 安装依赖 npm install
创建.env
文件,配置以下环境变量:
# Feishu API Configuration
FEISHU_APP_ID=your_app_id
FEISHU_APP_SECRET=your_app_secret
FEISHU_API_URL=https://project.feishu.cn/open_api
# Service Configuration
CHECK_INTERVAL=5000
STORAGE_DIR=./storage
LOG_DIR=./logs
LOG_LEVEL=info
MAX_CONCURRENT_TASKS=5
# Server Configuration
PORT=3000
HOST=localhost
# 开发模式 npm run dev # 生产模式 npm run build npm start
本项目支持通过npx调用,但目前尚未发布到npm注册表。在发布之前,你可以通过以下方式使用npx调用:
在项目目录中运行:
# 先构建项目 npm run build # 使用npx调用本地包 npx . [参数]
或者使用完整路径:
npx /path/to/feishu-project-mcp [参数]
你可以向npx命令传递参数:
npx . --port 3001 --host 0.0.0.0
当项目发布到npm注册表后,你可以直接使用:
npx feishu-project-mcp [参数]
并且可以指定版本:
npx [email protected] [参数]
# 构建镜像 docker build -t feishu-project-mcp . # 运行容器 docker run -p 3000:3000 --env-file .env feishu-project-mcp
要在Cline的MCP设置文件中配置飞书项目MCP服务,请按照以下步骤操作:
cline_mcp_settings.json
mcpServers
对象中添加一个新条目,如下所示:"feishu-project-mcp": { "command": "node", "args": [ "/path/to/feishu-project-mcp/dist/index.js" ], "env": { "FEISHU_APP_ID": "your_app_id", "FEISHU_APP_SECRET": "your_app_secret", "FEISHU_API_URL": "https://project.feishu.cn/open_api" }, "disabled": false, "alwaysAllow": [ "health", "health.components", "health.integrations", "health.tasks", "health.memory", "feishu.projects", "feishu.requirements", "feishu.bugs", "task.create", "task.get", "mode.analyze", "mode.implement" ] }
当项目发布到npm注册表后,你可以使用npx在Cline中配置MCP服务:
"feishu-project-mcp": { "command": "npx", "args": [ "feishu-project-mcp" ], "env": { "FEISHU_APP_ID": "your_app_id", "FEISHU_APP_SECRET": "your_app_secret", "FEISHU_API_URL": "https://project.feishu.cn/open_api" }, "disabled": false, "alwaysAllow": [ "health", "health.components", "health.integrations", "health.tasks", "health.memory", "feishu.projects", "feishu.requirements", "feishu.bugs", "task.create", "task.get", "mode.analyze", "mode.implement" ] }
在发布之前,你应该使用完整路径:
"feishu-project-mcp": { "command": "npx", "args": [ "/absolute/path/to/feishu-project-mcp" ], "env": { "FEISHU_APP_ID": "your_app_id", "FEISHU_APP_SECRET": "your_app_secret", "FEISHU_API_URL": "https://project.feishu.cn/open_api" }, "disabled": false, "alwaysAllow": [ "health", "health.components", "health.integrations", "health.tasks", "health.memory", "feishu.projects", "feishu.requirements", "feishu.bugs", "task.create", "task.get", "mode.analyze", "mode.implement" ] }
要将项目发布到npm注册表,请按照以下步骤操作:
创建npm账号:如果你还没有npm账号,请先在npm官网注册一个账号。
登录npm:在本地终端登录npm:
npm login
按照提示输入用户名、密码和邮箱。
检查package.json:确保package.json文件包含以下必要字段:
{ "name": "feishu-project-mcp", "version": "1.0.0", "description": "Feishu Project MCP Service for end-to-end requirement management and development automation", "type": "module", "main": "dist/index.js", "bin": { "feishu-project-mcp": "dist/cli.js" }, "files": ["dist", "LICENSE", "README.md"], "keywords": [ "feishu", "mcp", "project-management", "automation", "requirements", "development" ], "author": "Your Name <[email protected]>", "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/yourusername/feishu-project-mcp.git" }, "bugs": { "url": "https://github.com/yourusername/feishu-project-mcp/issues" }, "homepage": "https://github.com/yourusername/feishu-project-mcp#readme" }
创建.npmignore文件:创建.npmignore文件,指定不包含在npm包中的文件:
.git
.github
.husky
.vscode
node_modules
src
tests
.editorconfig
.env*
.eslintrc*
.gitignore
.lintstagedrc*
.prettierrc
commitlint.config.cjs
docker-compose*
Dockerfile*
jest.config.cjs
nodemon.json
tsconfig.json
构建项目:
npm run build
测试包:在发布前,可以使用npm pack命令创建一个tarball,但不实际发布:
npm pack
这将创建一个名为feishu-project-mcp-1.0.0.tgz
的文件。你可以在另一个目录中安装这个包进行测试:
npm install /path/to/feishu-project-mcp-1.0.0.tgz
发布包:确认一切正常后,发布包:
npm publish
如果是第一次发布,可能需要添加--access=public
参数:
npm publish --access=public
创建npm访问令牌:
添加GitHub Secrets:
NPM_TOKEN
的secret,值为刚才复制的npm令牌创建GitHub Actions工作流:在仓库中创建.github/workflows/npm-publish.yml
文件:
name: Publish to npm on: release: types: [created] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: '18.x' registry-url: 'https://registry.npmjs.org/' - run: npm ci - run: npm run build - run: npm test - run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
创建GitHub Release:
GitHub Actions将自动运行工作流,将包发布到npm。
如果你想更进一步自动化发布过程,可以使用semantic-release:
安装semantic-release:
npm install --save-dev semantic-release @semantic-release/git @semantic-release/github @semantic-release/npm @semantic-release/changelog @semantic-release/commit-analyzer @semantic-release/release-notes-generator
配置semantic-release:创建.releaserc.json
文件:
{ "branches": ["main"], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/github", "@semantic-release/git" ] }
创建GitHub Actions工作流:创建.github/workflows/semantic-release.yml
文件:
name: Semantic Release on: push: branches: [main] jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: actions/setup-node@v3 with: node-version: '18.x' registry-url: 'https://registry.npmjs.org/' - run: npm ci - run: npm run build - run: npm test - run: npx semantic-release env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
手动更新版本:使用npm version命令更新版本号:
# 补丁版本更新 (1.0.0 -> 1.0.1) npm version patch # 次要版本更新 (1.0.0 -> 1.1.0) npm version minor # 主要版本更新 (1.0.0 -> 2.0.0) npm version major
然后推送到GitHub并发布:
git push --follow-tags npm publish
使用semantic-release自动更新版本:如果你使用semantic-release,只需按照Conventional Commits规范提交代码,semantic-release会自动确定版本号:
fix:
提交会触发补丁版本更新feat:
提交会触发次要版本更新BREAKING CHANGE:
的提交会触发主要版本更新发布成功后,你可以通过以下方式验证:
npx feishu-project-mcp
GET /health
返回系统健康状态信息,包括组件状态、集成状态、任务状态和内存使用情况。
POST /mcp
请求体格式:
{ "tool": "工具名称", "params": { "参数1": "值1", "参数2": "值2" } }
curl -X POST -H "Content-Type: application/json" -d '{"tool":"feishu.projects"}' http://localhost:3000/mcp
curl -X POST -H "Content-Type: application/json" -d '{"tool":"feishu.requirements","params":{"projectId":"project1"}}' http://localhost:3000/mcp
curl -X POST -H "Content-Type: application/json" -d '{"tool":"mode.analyze","params":{"itemId":"requirement1","itemType":"requirement"}}' http://localhost:3000/mcp
curl -X POST -H "Content-Type: application/json" -d '{"tool":"task.get","params":{"taskId":"task1"}}' http://localhost:3000/mcp
本项目使用Conventional Commits规范来格式化提交消息。每个提交消息都应该遵循以下格式:
<type>(<scope>): <subject>
<body>
<footer>
其中:
示例:
feat(server): add health check endpoint
Add a new endpoint to check the health of the server and its components.
Closes #123
项目中已经配置了commitlint和husky,会在提交前自动检查提交消息是否符合规范。你可以使用.github/commit-template.txt
作为提交消息的模板。
本项目使用ESLint和Prettier来保持代码风格的一致性。在提交代码前,会自动运行lint-staged来检查和修复代码风格问题。
欢迎贡献代码、报告问题或提出改进建议。请遵循以下步骤:
git checkout -b feature/your-feature
git commit -am 'feat: add some feature'
git push origin feature/your-feature
本项目采用MIT许可证,详情请参阅LICENSE文件。
如有问题或建议,请通过以下方式联系我们:
在包发布到npm注册表之前,请使用本地路径来调用这个包,而不是尝试从npm注册表安装。这样可以避免出现"package was not found"的警告和连接关闭的错误。