一个全面的模型上下文协议(MCP)服务器,提供先进的GitHub项目管理能力,包括AI驱动的任务管理和完整的可追溯性。将您的项目想法转化为可执行任务,并从商业需求到实现进行全程跟踪。
此服务器实现了模型上下文协议,以提供具有先进AI能力的全面GitHub项目管理。除了传统的项目管理之外,它还通过GitHub的GraphQL API提供了AI驱动的任务生成、需求可追溯性和智能项目规划,同时根据MCP规范维护状态并处理错误。
# 全局安装包
npm install -g mcp-github-project-manager
# 设置环境变量
export GITHUB_TOKEN="your_github_token"
export GITHUB_OWNER="your_github_username_or_organization"
export GITHUB_REPO="your_repository_name"
# 运行MCP服务器
mcp-github-project-manager
# 构建Docker镜像
docker build -t mcp-github-project-manager .
# 使用环境变量运行
docker run -it \
-e GITHUB_TOKEN=your_github_token \
-e GITHUB_OWNER=your_github_username_or_organization \
-e GITHUB_REPO=your_repository_name \
mcp-github-project-manager
有关更多Docker使用详情,请参阅DOCKER.md。
generate_prd): 将项目想法转换为全面的产品需求文档parse_prd): 使用AI解析PRD为可执行开发任务add_feature): 添加新功能并自动进行影响分析和任务生成analyze_task_complexity): 详细的AI任务复杂性分析、工作量估算和风险评估get_next_task): AI驱动的最佳任务优先级推荐expand_task): 自动将复杂任务分解为可管理的子任务enhance_prd): 使用AI驱动的差距分析和改进来提高现有PRDcreate_traceability_matrix): 从PRD商业需求→功能→用例→任务的全程可追溯性# 全局安装包
npm install -g mcp-github-project-manager
# 或者安装在项目中
npm install mcp-github-project-manager
# 克隆仓库
git clone https://github.com/kunwarVivek/mcp-github-project-manager.git
cd mcp-github-project-manager
# 安装依赖
npm install
# 或者
pnpm install
# 构建项目
npm run build
# 复制示例环境文件
cp .env.example .env
# 编辑.env文件,填写您的GitHub令牌和其他细节
GITHUB_TOKEN=your_github_token
GITHUB_OWNER=repository_owner
GITHUB_REPO=repository_name
GitHub令牌需要以下权限:
repo (完整仓库访问)project (项目访问)write:org (组织访问)至少需要一个AI提供商用于AI驱动的功能:
# 主要AI提供商(至少需要一个)
ANTHROPIC_API_KEY=your_anthropic_api_key_here
OPENAI_API_KEY=your_openai_api_key_here
GOOGLE_API_KEY=your_google_api_key_here
PERPLEXITY_API_KEY=your_perplexity_api_key_here
# AI模型配置(可选 - 如果未指定则使用默认值)
AI_MAIN_MODEL=claude-3-5-sonnet-20241022
AI_RESEARCH_MODEL=perplexity-llama-3.1-sonar-large-128k-online
AI_FALLBACK_MODEL=gpt-4o
AI_PRD_MODEL=claude-3-5-sonnet- 20241022
# AI任务生成配置(可选)
MAX_TASKS_PER_PRD=50
DEFAULT_COMPLEXITY_THRESHOLD=7
MAX_SUBTASK_DEPTH=3
AUTO_DEPENDENCY_DETECTION=true
AUTO_EFFORT_ESTIMATION=true
# 增强任务上下文生成配置(可选)
ENHANCED_TASK_GENERATION=true
AUTO_CREATE_TRACEABILITY=true
AUTO_GENERATE_USE_CASES=true
AUTO_CREATE_LIFECYCLE=true
ENHANCED_CONTEXT_LEVEL=standard
INCLUDE_BUSINESS_CONTEXT=false
INCLUDE_TECHNICAL_CONTEXT=false
INCLUDE_IMPLEMENTATION_GUIDANCE=false
ANTHROPIC_API_KEYOPENAI_API_KEYGOOGLE_API_KEYPERPLEXITY_API_KEY如果全局安装:
# 使用stdio传输启动MCP服务器
mcp-github-project-manager
# 使用环境变量启动
GITHUB_TOKEN=your_token mcp-github-project-manager
# 使用命令行参数启动
mcp-github-project-manager --token=your_token --owner=your_username --repo=your_repo
# 使用特定的.env文件
mcp-github-project-manager --env-file=.env.production
# 显示详细输出
mcp-github-project-manager --verbose
# 显示帮助信息
mcp-github-project-manager --help
如果您正在开发或从源码运行:
# 直接使用ts-node运行
node --loader ts-node/esm src/index.ts
# 使用命令行参数运行
node --loader ts-node/esm src/index.ts --token=your_token --owner=your_username --repo=your_repo
# 使用npm dev脚本(监视更改)
npm run dev
# 显示帮助信息
node --loader ts-node/esm src/index.ts --help
| 选项 | 短选项 | 描述 |
|---|---|---|
--token <token> | -t | GitHub个人访问令牌 |
--owner <owner> | -o | GitHub仓库拥有者(用户名或组织) |
--repo <repo> | -r | GitHub仓库名称 |
--env-file <path> | -e | .env文件路径(默认:项目根目录下的.env) |
--verbose | -v | 启用详细日志 |
--help | -h | 显示帮助信息 |
--version | 显示版本信息 |
命令行参数优先于环境变量。
import { Server } from "mcp-github-project-manager";
// 创建并启动MCP服务器实例
const server = new Server({
transport: "stdio", // 或 "http" 用于HTTP服务器
config: {
githubToken: process.env.GITHUB_TOKEN,
githubOwner: process.env.GITHUB_OWNER,
githubRepo: process.env.GITHUB_REPO
}
});
server.start();
// 示例使用MCP客户端库
import { McpClient } from "@modelcontextprotocol/client";
import { spawn } from "child_process";
// 创建一个子进程运行MCP服务器
const serverProcess = spawn("mcp-github-project-manager", [], {
env: { ...process.env, GITHUB_TOKEN: "your_token" }
});
// 将MCP客户端连接到服务器
const client = new McpClient({
transport: {
type: "process",
process: serverProcess
}
});
// 调用MCP工具
const result = await client.callTool("create_project", {
title: "My Project",
description: "一个新的GitHub项目"
});
# 1. 从项目想法生成PRD
generate_prd({
"projectIdea": "具有实时协作功能的AI驱动的任务管理系统",
"projectName": "TaskAI Pro",
"author": "product-team",
"complexity": "高",
"timeline": "6个月",
"includeResearch": true
})
# 2. 解析PRD并生成带有可追溯性的任务
parse_prd({
"prdContent": "<生成的PRD内容>",
"maxTasks": 30,
"createTraceabilityMatrix": true,
"includeUseCases": true,
"projectId": "task-ai-pro"
})
# 3. 获取下一个任务推荐
get_next_task({
"sprintCapacity": 40,
"teamSkills": ["react", "node.js", "typescript"],
"maxComplexity": 7,
"includeAnalysis": true
})
# 4. 分析复杂任务
analyze_task_complexity({
"taskTitle": "实现实时协作",
"taskDescription": "构建具有冲突解决功能的WebSocket实时协作",
"teamExperience": "混合",
"includeBreakdown": true,
"includeRisks": true
})
# 5. 分解复杂任务
expand_task({
"taskTitle": "构建分析仪表盘",
"taskDescription": "创建具有AI洞察的综合分析仪表盘",
"currentComplexity": 8,
"targetComplexity": 3,
"includeEstimates": true,
"includeDependencies": true
})
# 添加具有完整生命周期的新功能
add_feature({
"featureIdea": "高级分析仪表盘",
"description": "具有自定义图表和AI驱动洞察的实时分析",
"requestedBy": "产品经理",
"businessJustification": "增加用户参与度并提供行动指南",
"targetUsers": ["项目经理", "团队领导", "高管"],
"autoApprove": true,
"expandToTasks": true,
"createLifecycle": true
})
# 这会自动创建:
# ✅ 商业需求分析
# ✅ 具有角色-目标-场景结构的用例
# ✅ 带有完整可追溯性链接的任务
# ✅ 所有任务的生命周期跟踪
# 创建全面的可追溯性矩阵
create_traceability_matrix({
"projectId": "task-ai-pro",
"prdContent": "<PRD内容>",
"features": [...],
"tasks": [...],
"validateCompleteness": true
})
# 输出包括:
# ✅ 商业需求→功能→用例→任务
# ✅ 双向可追溯性链接
# ✅ 覆盖率分析及差距识别
# ✅ 孤立任务检测
# ✅ 未实现需求跟踪
# 默认:基于可追溯性的上下文(快速,无需AI)
parse_prd({
"prdContent": "<PRD内容>",
"enhancedGeneration": true,
"contextLevel": "standard"
})
# 增强:AI驱动的全面上下文
parse_prd({
"prdContent": "<PRD内容>",
"enhancedGeneration": true,
"contextLevel": "full",
"includeBusinessContext": true,
"includeTechnicalContext": true,
"includeImplementationGuidance": true
})
# 性能优化:最小上下文以提高速度
parse_prd({
"prdContent": "<PRD内容>",
"enhancedGeneration": true,
"contextLevel": "minimal",
"includeBusinessContext": false,
"includeTechnicalContext": false,
"includeImplementationGuidance": false
})
上下文生成级别:
生成的任务上下文包括:
增强的上下文生成功能包括全面的测试覆盖:
src/__tests__/TaskContextGenerationService.test.ts - 核心上下文生成服务测试src/__tests__/TaskGenerationService.enhanced.test.ts - 增强的任务生成集成测试src/__tests__/ParsePRDTool.enhanced.test.ts - 工具级别的上下文生成测试