MCP演示——Sprint智能代理
一个AI代理,从Jira/GitLab/AAzure DevOps读取您分配的用户故事, 交叉引用本地项目文档,并为您提供每日冲刺简报。
旨在展示: AI代理+LLM+MCP+工具
______________________________________________________________________
这有什么作用
YOU: "What should I work on today?"
↓
TypeScript Agent (MCP Client) + Gemini LLM
↓ calls tools via MCP protocol ↓
Python MCP Server fetches Jira stories + reads local docs
↓
YOU: Get a personalized, context-aware sprint briefing______________________________________________________________________
项目结构
MCPProj/
├── mcp_server/ ← MCP SERVER (Python)
│ ├── server.py Exposes tools to any MCP client
│ └── requirements.txt
│
├── agent_ts/ ← MCP CLIENT + AI AGENT (TypeScript) ← Run this
│ ├── agent.ts Uses Gemini LLM + calls MCP server
│ ├── package.json
│ └── tsconfig.json
│
├── agent/ ← MCP CLIENT + AI AGENT (Python alt)
│ ├── agent.py Same agent, Python version
│ └── requirements.txt
│
├── sample_project_files/ ← Local project docs (simulates file storage)
│ ├── requirements.txt Product requirements
│ ├── bugs.txt Bug reports
│ └── sprint_notes.txt Sprint planning notes
│
├── docs/
│ └── concepts.md ← Full learning guide (READ THIS FIRST)
└── README.md______________________________________________________________________
快速入门(TypeScript代理——推荐)
步骤1——安装所有依赖项
# Python MCP Server deps
pip install mcp[cli]
# TypeScript Agent deps
cd agent_ts
npm install步骤2-设置Gemini API密钥
# Windows
set GEMINI_API_KEY=AIza...
# Mac/Linux
export GEMINI_API_KEY=AIza...获取免费密钥:https://aistudio.google.com/apikey
步骤3——运行TypeScript代理
cd agent_ts
npm start您将看到代理:
- 连接到Python MCP服务器(通过stdio)
- 从服务器中发现6个可用工具
- Gemini调用Jira/GitLab/AAzure工具来获取你的故事
- Gemini读取相关的本地文件以获取上下文
- 打印您的个性化冲刺简报
______________________________________________________________________
快速入门(Python代理——替代方案)
pip install mcp[cli] google-genai
set GEMINI_API_KEY=AIza...
cd agent
python agent.py______________________________________________________________________
MCP服务器中可用的工具
| 工具 | 它做什么 |
|---|---|
get_my_jira_stories() | 在Jira中获取分配给您的故事 |
get_my_gitlab_issues() | 在GitLab中获取分配给您的问题 |
get_my_azure_work_items() | 获取Azure DevOps中分配给您的工作项 |
list_project_files() | 列出可用的当地项目文件 |
read_project_file() | 读取特定的本地文件(需求、错误等) |
read_from_gcp_storage() | 从GCP云存储桶读取文件 |
______________________________________________________________________
连接到真正的Jira/GitLab/Azure
设置这些环境变量,然后在中取消注释真正的API代码 mcp_server/server.py:
Jira
set JIRA_URL=https://yourcompany.atlassian.net
set JIRA_EMAIL=you@company.com
set JIRA_API_TOKEN=your-jira-api-token
set JIRA_PROJECT_KEY=NEO获取令牌:https://id.atlassian.com/manage-profile/security/api-tokens
GitLab
set GITLAB_URL=https://gitlab.com
set GITLAB_TOKEN=your-personal-access-token
set GITLAB_PROJECT_ID=12345
set GITLAB_USERNAME=your-usernameAzure DevOps
set AZURE_ORG_URL=https://dev.azure.com/yourorg
set AZURE_TOKEN=your-pat-token
set AZURE_PROJECT=MyProject
set AZURE_ASSIGNED_TO=you@company.comGCP云存储
set GOOGLE_APPLICATION_CREDENTIALS=path/to/service-account.json
pip install google-cloud-storage______________________________________________________________________
演示场景
编辑 demo 变量位于底部 agent_ts/agent.ts:
| 演示密钥 | 它的作用 |
|---|---|
daily_briefing | Jira的完整冲刺简报 |
gitlab_briefing | GitLab的Sprint简报 |
azure_briefing | 来自Azure DevOps的Sprint简报 |
critical_only | 仅显示关键/高优先级Jira项目 |
______________________________________________________________________
理解概念
阅读 docs/concepts.md 关于以下内容的完整解释:
- 什么是LLM及其局限性
- 什么是AI Agent(循环模式)
- 什么是工具以及谁控制它们
- MCP是什么以及它为什么存在
- TypeScript代理如何与Python服务器通信(语言无关紧要——MCP是协议)
参考:https://modelcontextprotocol.io/docs/getting-started/intro
