💸 支出 → 收入快速通道MVP
黑客马拉松获胜项目高通本地人工智能黑客马拉松 贡献者施鲁蒂·戈亚尔(GitHub: @shrutiebony(注:这是一个用户名或特定标识,直接翻译为中文无实际意义,故保留原样))
一个20分钟的演示版最小可行性产品(MVP),它使用(某种技术或工具)来协调支付处理工作流 CodeGlide MCP 服务器这个项目将Slack → 支付验证 → Jira → Notion → Slack确认连接成一个单一的自动化流程。
🚀 快速演示
黄金路径流程
📨 Slack message → 💳 Verify payment → 🧾 Jira task → 📘 Notion entry → 🔔 Slack confirmation🏗️ 建筑学
┌─────────────────────────────────────────────────────────────┐
│ Expense Fast Lane │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐│
│ │ Slack │──▶│ Payment │──▶│ Jira │──▶│ Notion ││
│ │ MCP │ │ Verify │ │ MCP │ │ MCP ││
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘│
│ │ │ │
│ └─────────────────────────────────────────────┘ │
│ Confirmation Reply │
└─────────────────────────────────────────────────────────────┘📋 先决条件
- Node.js 18+ 和 npm
- 适用于Slack、Jira和Notion的CodeGlide MCP服务器
- API凭证(或在模拟模式下运行)
🔧 设置
1. 安装依赖项
npm install2. 配置环境
复制示例环境文件:
cp env.example .env编辑 .env 使用您的凭据:
# Slack Configuration
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
SLACK_CHANNEL_ID=C01234567
# Notion Configuration
NOTION_TOKEN=secret_your-notion-integration-token
NOTION_DB_ID=your-notion-database-id
# Jira Configuration
JIRA_BASE_URL=https://your-domain.atlassian.net
JIRA_EMAIL=your-email@example.com
JIRA_API_TOKEN=your-jira-api-token
JIRA_PROJECT_KEY=EXP
# Payment Configuration (optional)
SQUARE_ACCESS_TOKEN=your-square-access-token
MOCK_MODE=true3. 设置CodeGlide MCP服务器
克隆CodeGlide MCP仓库(Artifactory):
# Create a directory for MCP servers
mkdir -p mcp-servers
cd mcp-servers
# Clone the CodeGlide MCP artifactory
git clone https://github.com/CodeGlide/mcp-artifactory.git .
# Install dependencies for each MCP server
cd slack_web && npm install && cd ..
cd Notion && npm install && cd ..
cd Jira_Integration_API && npm install && cd ..
cd ..更新 mcp.config.json 如有需要,请提供正确的路径。
🎯 使用方法
使用模拟数据运行(无需API密钥)
非常适合测试和演示:
npm run dev -- --mockReceiptFile ./scripts/demo-data/receipt.sample.json --dryRun使用真实的Slack频道运行
从特定的Slack频道读取付款消息:
npm run dev -- --sourceSlackChannel C01234567运行完整流程
所有集成均已启用:
npm run dev命令行选项
npm run dev -- [options]
Options:
-s, --sourceSlackChannel Slack channel ID to read payments from
-m, --mockReceiptFile Path to mock receipt JSON file
-d, --dryRun Dry run mode (skip writes)
-v, --verbose Enable verbose logging
-h, --help Show help📦 项目结构
mvp-expense-lane/
├── src/
│ ├── index.ts # Main entry point
│ ├── orchestrator.ts # Main orchestration logic
│ ├── mcp/
│ │ └── clients.ts # MCP client initialization
│ ├── services/
│ │ ├── receipts.ts # Receipt parsing & validation
│ │ ├── payments.ts # Payment verification (Square/mock)
│ │ ├── jira.ts # Jira issue creation
│ │ ├── notion.ts # Notion database updates
│ │ └── slack.ts # Slack message handling
│ └── util/
│ ├── env.ts # Environment configuration
│ └── log.ts # Logging utilities
├── scripts/
│ └── demo-data/
│ └── receipt.sample.json
├── mcp.config.json # MCP server configuration
├── package.json
├── tsconfig.json
├── env.example
└── README.md🔄 工作流程步骤
1. 从Slack读取支付消息
协调器从Slack频道获取最新消息,并解析这些消息以提取支付信息:
// Looks for patterns like:
// "Payment received: $150 from John Doe for Order #12345"2. 核实付款
通过Square API或模拟验证来验证支付:
const verification = await verifyPayment(receipt);
// Returns: { verified: true, status: 'success', transactionId: '...' }3. 创建Jira任务
创建一个包含支付详情的Jira问题
const jiraIssue = await createPaymentJiraIssue(jiraClient, receipt, verification);
// Returns: { key: 'EXP-1234', url: '...' }4. 添加到Notion数据库
在您的Notion数据库中添加一条记录:
const notionPage = await createNotionPaymentEntry(
notionClient,
receipt,
verification,
jiraIssue.key
);5. 在Slack上发布确认信息
将格式化的确认消息发送回Slack:
✅ Payment Processed Successfully
🧾 Order: ORD-2024-001
💰 Amount: $150.00 USD
👤 Payer: John Doe
📋 Jira Task: EXP-1234
📘 Notion Entry: https://notion.so/...
_Automated via Expense Fast Lane 🚀_🧪 测试
模拟模式
设定 MOCK_MODE=true 在里面 .env 为所有服务使用模拟实现:
- 模拟Slack客户端返回示例消息
- 模拟支付验证总是成功
- 模拟Jira/Notion客户端日志操作,无需API调用
使用示例数据的演示
npm run dev -- \
--mockReceiptFile ./scripts/demo-data/receipt.sample.json \
--dryRun创建自定义测试收据
创建一个包含您测试数据的JSON文件:
{
"orderId": "TEST-001",
"amount": 99.99,
"currency": "USD",
"payer": "Jane Smith",
"description": "Test payment",
"source": "manual"
}然后运行:
npm run dev -- --mockReceiptFile ./my-test-receipt.json🎨 定制化
添加新的支付提供商
编辑 src/services/payments.ts 以添加对额外支付网关的支持:
export async function verifyPaymentWithStripe(receipt: Receipt) {
// Your Stripe integration logic
}自定义Jira字段
编辑 src/services/jira.ts 自定义问题格式:
const summary = `Custom: ${receipt.orderId}`;
// Add custom fields, labels, etc.Notion 数据库模式
该代码期望一个具有以下属性的Notion数据库:
- 订单ID (标题)
- 金额;数额 (数字)
- 货币 (选择)
- 支付 (文本)
- 状态 (选择:已验证,待处理)
- 来源 (选择:Slack、电子邮件、Webhook、手动)
- 时间戳 (日期)
- Jira 问题 (文本) - 可选
- 交易ID (文本)- 可选
🚦 错误处理
即使个别步骤失败,协调器也会继续执行:
- 每一步都用 try-catch 包裹
- 错误被收集并在最后报告
- 当API客户端失败时,使用模拟客户端作为后备
🔐 安全注意事项
- 永远不要承诺
.env文件提交到版本控制 - 对所有密钥使用环境变量
- MCP服务器作为独立进程运行,使用独立凭证
- 考虑在生产环境中使用密钥管理工具
📚 参考文献
- CodeGlide 文档https://codeglide.ai/docs/introduction.html 的中文翻译可以是:“https://codeglide.ai/文档/简介.html” 或者更简洁地表达为 “CodeGlide AI 网站文档之简介页面”。不过,通常网址在中文语境下直接保留原样,因为网址本身是国际化的,并不直接翻译。所以,最直接的翻译方式就是保留原网址不变
- MCP Artifactory(可译为“MCP 艺术仓库”或根据具体上下文调整为更贴切的名称,但“艺术仓库”仅为直译,实际含义可能依据Artifactory在特定领域中的功能而定)https://github.com/CodeGlide/mcp-artifactory(中文翻译为:https://github.com/CodeGlide/mcp-artifactory(注:网址本身在中文语境下通常不翻译,保持原样即可,此处仅为说明其含义,实际使用时无需翻译))
- 模型上下文协议https://modelcontextprotocol.io(该网址可直接翻译为“模型上下文协议.io”,但通常网址保持原样,不进行翻译)
🤝 贡献
这是一个黑客马拉松的最小可行性产品(MVP)。欢迎大家提出贡献和改进意见!
“Stretch Goals”翻译成中文是“远大目标”或“挑战性目标”。这个术语通常用于描述那些超出常规或预期范围的、具有挑战性的目标,旨在激励团队或个人超越自我,达到更高的成就
- \[ \] 添加带有指数退避的重试逻辑
- \[ \] 在Slack回复中包含Notion页面链接
- \[ \] 显示付款对账统计
- \[ \] 支持多个支付提供商
- \[ \] 添加Webhook接收器以进行实时处理
- \[ \] 创建监控仪表板
📄 许可证
麻省理工学院(MIT)
______________________________________________________________________
使用CodeGlide MCP服务器,倾注爱心打造
