Datetime MCP Server

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Mentioned as the source repository location for cloning the project with 'git clone https://github.com/bossjones/datetime-mcp-server.git'

  • Used for various development tasks through Makefile commands like 'make uv-sync-all'

  • Used to launch the MCP Inspector with 'npx @modelcontextprotocol/inspector'

日期时间 MCP 服务器

MCP(模型完成协议)服务器提供日期时间功能以及简单的注释管理。

概述

该服务器实现了 MCP 协议并提供各种与日期时间相关的工具和资源,包括:

  • 不同格式的当前日期和时间
  • 日期格式化实用程序
  • 活动安排提示
  • 简单的笔记管理功能

任何 MCP 客户端都可以使用该服务器来访问日期和时间信息并管理简单的笔记。

特征

资源

服务器提供以下资源:

  • datetime://current - 当前日期和时间
  • datetime://today - ISO 格式的今日日期
  • datetime://time - 24 小时格式的当前时间
  • note://internal/{name} - 用户创建的注释

工具

该服务器提供以下工具:

  • add-note - 添加带有名称和内容的新注释
  • get-current-time - 以各种格式获取当前时间(ISO、可读、Unix 时间戳、RFC3339)
  • format-date - 根据指定的格式模式格式化日期字符串

提示

服务器给出如下提示:

  • summarize-notes - 创建所有笔记的摘要
  • schedule-event - 帮助在特定时间安排事件

安装

  1. 克隆存储库:
git clone https://github.com/bossjones/datetime-mcp-server.git cd datetime-mcp-server
  1. 创建虚拟环境:
uv venv source .venv/bin/activate
  1. 安装依赖项:
uv sync

用法

运行服务器

运行服务器:

uv run python -m datetime_mcp_server.server

服务器将启动并在 stdin/stdout 上监听 MCP 协议消息。

连接到服务器

您可以使用任何 MCP 客户端连接到服务器。例如,使用 MCP CLI:

uv run mcp connect datetime-mcp-server

发展

安装开发依赖项

# Install all dependencies including development dependencies uv sync --dev

运行测试

运行测试:

uv run pytest tests/

单元测试

单元测试验证各个服务器功能是否正常工作:

uv run pytest tests/acceptance/test_server.py

集成测试

集成测试验证服务器是否正确实现了 MCP 协议:

uv run pytest tests/acceptance/test_server_integration.py

依赖管理

# Add a production dependency uv add package_name # Add a development dependency uv add --dev package_name # Sync dependencies from lockfile uv sync --frozen # List outdated packages uv outdated

示例

使用 MCP CLI 的服务器

列出可用资源:

uv run mcp resources list

读取日期时间资源:

uv run mcp resources read datetime://current

添加注释:

uv run mcp tools call add-note --arguments '{"name": "meeting", "content": "Team meeting at 3pm"}'

获取 ISO 格式的当前时间:

uv run mcp tools call get-current-time --arguments '{"format": "iso"}'

格式化日期:

uv run mcp tools call format-date --arguments '{"date": "2023-10-15", "format": "%B %d, %Y"}'

Makefile 任务

该项目包括几个 Makefile 任务来简化开发:

# Sync all dependencies with frozen lockfile make uv-sync-all # Sync only development dependencies make uv-sync-dev # Run tests make test

构建和发布

准备分发包:

  1. 同步依赖项并更新锁文件:
uv sync
  1. 构建软件包分发版:
uv build

这将在dist/目录中创建源和轮子分布。

  1. 发布到 PyPI:
uv publish

注意:您需要通过环境变量或命令标志设置 PyPI 凭据:

  • 令牌: --tokenUV_PUBLISH_TOKEN
  • 或用户名/密码: --username / UV_PUBLISH_USERNAME--password / UV_PUBLISH_PASSWORD

调试

由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们强烈建议使用MCP Inspector

您可以使用以下命令通过npm启动 MCP Inspector:

npx @modelcontextprotocol/inspector uv --directory /Users/malcolm/dev/bossjones/datetime-mcp-server run datetime-mcp-server

启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。

执照

麻省理工学院

贡献

  1. 分叉存储库
  2. 创建功能分支
  3. 进行更改
  4. 使用uv run pytest运行测试
  5. 提交拉取请求

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

该服务器允许用户使用自定义 URI 方案存储、管理和总结笔记,并具有添加新笔记和生成不同详细程度的摘要的功能。

  1. Overview
    1. Features
      1. Resources
      2. Tools
      3. Prompts
    2. Installation
      1. Usage
        1. Running the Server
        2. Connecting to the Server
      2. Development
        1. Installing Development Dependencies
        2. Running Tests
        3. Dependency Management
      3. Examples
        1. Using the Server with MCP CLI
      4. Makefile Tasks
        1. Building and Publishing
          1. Debugging
            1. License
              1. Contributing
                ID: fd8f58oegw