Supports testing the NTP time service via HTTP requests in SSE mode, allowing clients to retrieve accurate time information by specifying NTP servers through request headers.
Provides access to NTP (Network Time Protocol) services through Python, allowing large language models to retrieve accurate network time information with details like timestamps, formatted time strings, and time offsets.
MCP-NTP 时间服务
这是一个基于MCP(Model Context Protocol)的NTP时间服务,为大模型提供准确的网络时间获取功能。
功能特性
从NTP服务器获取准确的网络时间
支持stdio和sse两种传输模式
提供
get_current_time工具,方便大模型获取当前时间支持环境变量和请求头两种配置NTP服务器的方式
返回详细的时间信息和NTP协议数据
Related MCP server: Time Tools MCP Server
安装
配置
环境变量配置(stdio模式)
设置NTP_DOMAIN_URL环境变量:
请求头配置(sse模式)
在请求头中包含ntp_url字段:
使用方法
stdio模式
sse模式
工具说明
get_current_time
获取当前NTP服务器时间。
参数:
ntp_server(可选): NTP服务器地址,如果不提供则使用环境变量或请求头中的配置
返回数据:
调试
可以使用提供的测试NTP服务器进行调试:
开发
项目结构
添加新的NTP服务器
在client.py中的get_current_time函数可以轻松扩展支持更多NTP服务器配置。
许可证
MIT License