日期操作MCP服务器
一个模型上下文协议(MCP)服务器,提供英国上下文的可靠数据计算,专为James Murrell的BA工作流设计。
特性
- 工作日计算:自动排除周末和英国银行假日
- 英国银行假日整合:从GOV.UK API获取实时数据
- Asana特定助手:遵循詹姆斯的规则(下一个工作日,星期五下午4点→ 星期一)
- Sprint计划工具:计算冲刺日期和当前冲刺信息
- 英国时区:所有日期均以欧洲/伦敦时区(GMT/BST)处理
安装
# Clone or create the project directory
mkdir date-operations-mcp
cd date-operations-mcp
# Copy all the artifact files into the project:
# - package.json
# - tsconfig.json
# - src/index.ts
# - src/dateCalculations.ts
# - src/bankHolidays.ts
# - src/asanaHelpers.ts
# Install dependencies
npm install
# Build the project
npm run buildClaude桌面配置
将此添加到您的Claude Desktop配置文件中:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json 视窗: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"date-operations": {
"command": "node",
"args": ["/absolute/path/to/date-operations-mcp/build/index.js"]
}
}
}替换 /absolute/path/to/date-operations-mcp 根据您的实际项目路径。
重新启动克劳德桌面
更新配置文件后,完全重新启动Claude Desktop以加载MCP服务器。
可用工具
基本日期操作
get_today_uk
- 获取英国时区的当前日期
- 无需参数
get_next_working_day
- 获取给定日期后的下一个工作日
- 参数:
from_date(ISO格式或“今天”)
calculate_working_days
- 从日期中增减工作日
- 参数:
start_date,num_days,direction(向前/向后)
get_working_days_between
- 计算两个日期之间的工作日
- 参数:
start_date,end_date
英国银行假日
is_uk_bank_holiday
- 检查日期是否为英国银行假日
- 参数:
date
get_upcoming_bank_holidays
- 获取即将到来的英国银行假日列表
- 参数:
months_ahead(可选,默认值:6)
冲刺计划
calculate_sprint_dates
- 计算冲刺开始和结束日期
- 参数:
start_date,sprint_length_weeks
get_current_sprint_info
- 获取当前冲刺次数和剩余天数
- 参数:
first_sprint_start,sprint_length_weeks
Asana助手
get_asana_due_date
- 按照詹姆斯的规则获得Asana的预产期
- 参数:
from_date(可选,默认为今天) - 下一个工作日下午4:00(星期五)返回→ 星期一)
parse_asana_date_request
- 解析自然语言请求
- 参数:
request(例如,“明天”、“5天后”、“2周后”) - 返回适当的Asana到期日
示例用法
配置后,当您询问与日期相关的问题时,Claude将自动使用这些工具:
You: "What's 5 working days from today?"
Claude: [Uses calculate_working_days tool] That's Wednesday, October 29, 2025
You: "Create an Asana reminder for next week"
Claude: [Uses parse_asana_date_request tool] Setting due date to Monday, October 27, 2025 at 4:00 PM
You: "When do we finish the current sprint?"
Claude: [Uses get_current_sprint_info tool] Current sprint ends Friday, October 31, 2025技术细节
- 语言:TypeScript
- 运行时:Node.js
- 日期库:支持时区的日期fns
- 英国假期:GOV.UK官方API(缓存24小时)
- 时区:欧洲/伦敦(自动处理GMT/BST)
故障排除
服务器未在Claude中显示:
- 检查配置文件中的绝对路径
- 确保
npm run build成功完成 - 完全重新启动克劳德桌面
- 检查Claude Desktop日志是否有错误
日期计算似乎有误:
- 验证英国银行假日API是否可访问
- 检查您的系统时区设置
- 使用
get_today_uk验证当前日期的工具
测试
您可以在与Claude集成之前测试服务器:
# Run the built server directly
node build/index.js
# It should output: "Date Operations MCP Server running on stdio"备注
- 银行假日数据缓存24小时,以减少API调用
- 所有日期均使用英国时区(欧洲/伦敦),并自动处理GMT/BST
- 根据詹姆斯的Asana规则,周五任务自动滚动到周一
- 工作日不包括周末和英国银行假日
______________________________________________________________________
📚 想要构建这样的工具吗?
该工具是使用中记录的过程构建的 《商业分析师人工智能辅助工具开发指南》.
学习如何:
- 确定值得自动化的工作流程
- 作为合作者与人工智能有效合作
- 无需开发人员即可构建生产就绪工具
- 避免常见的陷阱和错误
£5•真实代码•真实示例•真实流程
获取指南: https://murrelljames.gumroad.com/l/pvfww
存储库: https://github.com/cs97jjm3/ba-ai-tools-guide
