MCP-NTP Time Service

MCP-NTP Time Service

A Model Context Protocol server that provides accurate network time services for large language models, supporting both stdio and SSE transport modes.

Category
Visit Server

README

MCP-NTP 时间服务

这是一个基于MCP(Model Context Protocol)的NTP时间服务,为大模型提供准确的网络时间获取功能。

功能特性

  • 从NTP服务器获取准确的网络时间
  • 支持stdio和sse两种传输模式
  • 提供get_current_time工具,方便大模型获取当前时间
  • 支持环境变量和请求头两种配置NTP服务器的方式
  • 返回详细的时间信息和NTP协议数据

安装

# 使用 uv 安装依赖
uv sync

配置

环境变量配置(stdio模式)

设置NTP_DOMAIN_URL环境变量:

export NTP_DOMAIN_URL="ntp.aliyun.com"

请求头配置(sse模式)

在请求头中包含ntp_url字段:

ntp_url: ntp.aliyun.com

使用方法

stdio模式

# 设置环境变量
export NTP_DOMAIN_URL="ntp.aliyun.com"

# 启动服务
python -m app

sse模式

# 启动服务
python -m app --transport sse --port 8080

# 使用curl测试
curl -H "ntp_url: ntp.aliyun.com" http://localhost:8080/sse

工具说明

get_current_time

获取当前NTP服务器时间。

参数:

  • ntp_server (可选): NTP服务器地址,如果不提供则使用环境变量或请求头中的配置

返回数据:

{
  "ntp_server": "ntp.aliyun.com",
  "ntp_timestamp": 1703123456.789,
  "ntp_time": "2023-12-21T10:30:56.789",
  "local_system_time": "2023-12-21T10:30:56.789",
  "time_offset": 0.123,
  "response_delay": 0.045
}

调试

可以使用提供的测试NTP服务器进行调试:

export NTP_DOMAIN_URL="ntp.aliyun.com"
python -m app -v

开发

项目结构

mcp-ntp/
├── app/
│   ├── __init__.py      # 主入口
│   ├── server.py        # MCP服务器实现
│   ├── client.py        # NTP客户端
│   └── config.py        # 配置管理
├── pyproject.toml       # 项目配置
└── README.md           # 说明文档

添加新的NTP服务器

client.py中的get_current_time函数可以轻松扩展支持更多NTP服务器配置。

许可证

MIT License

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured