mcp-timeserver

mcp-timeserver

Provides current time, relative time, timezone conversion, timestamps, and more for LLMs.

Category
访问服务器

README

⏱️ Time MCP Server on Cloudflare Workers (Remote, No Auth)

This project is a remote MCP server running on Cloudflare Workers that gives LLMs rich time awareness:

  • Current time (UTC + any timezone)
  • Relative time (“3 hours ago”, “in 2 days”)
  • Days in month
  • Timestamps
  • Timezone conversion
  • Week / ISO week of the year

It is based on Cloudflare’s remote-mcp-authless template, but exposes a full time toolkit over MCP.


Tools

The server exposes these MCP tools:

  • current_time
    Get the current time in UTC and in a target timezone, in a configurable format.

  • relative_time
    Get the relative time from now for a given timestamp (e.g. "2025-03-23 12:00:00" → "in 2 days").

  • days_in_month
    Get the number of days in a given month (or the current month if no date is provided).

  • get_timestamp
    Get the Unix timestamp (milliseconds) for a given time, or for now.

  • convert_time
    Convert a given time between two IANA timezones (e.g. Europe/Amsterdam → Asia/Tokyo).

  • get_week_year
    Get the week number and ISO week number for a given date, or for today.

All tools are implemented in src/index.ts using this.server.tool(...) on a McpServer instance.


Get Started

You can either:

1. Deploy from this repo (once it’s on GitHub)

Use the Deploy to Workers button (update the URL to match your GitHub repo):

Deploy to Workers

This will deploy your MCP server to a URL like:

https://mcp-timeserver.<your-account>.workers.dev/sse

2. Create locally from the Cloudflare template

If you want to reproduce this setup from scratch:

npm create cloudflare@latest -- mcp-timeserver --template=cloudflare/ai/demos/remote-mcp-authless

Then replace src/index.ts with the time MCP implementation from this repo and install dayjs:

npm install dayjs

Running Locally

From the project directory:

npm install
npm run start

This starts a local dev server, usually at:

http://localhost:8787

Exposed endpoints:

  • SSE MCP transport: http://localhost:8787/sse
  • HTTP (streamable) MCP transport: http://localhost:8787/mcp
  • Health check: http://localhost:8787/health

Deploying to Cloudflare

To deploy the Worker:

npx wrangler login
npm run deploy
# or
npx wrangler deploy

After deploy you’ll get a URL like:

https://mcp-timeserver.<your-account>.workers.dev

With MCP endpoints:

  • SSE: https://mcp-timeserver.<your-account>.workers.dev/sse
  • HTTP: https://mcp-timeserver.<your-account>.workers.dev/mcp

Using the MCP Server

1. Cloudflare AI Playground

You can use this Worker as a remote MCP server from the Cloudflare AI Playground:

  1. Go to https://playground.ai.cloudflare.com/

  2. Add a new MCP server and use your deployed URL, for example:

    https://mcp-timeserver.<your-account>.workers.dev/sse
    
  3. The tools current_time, relative_time, etc. will be available for the model to call.


2. MCP Inspector (local testing)

To inspect tools and make test calls:

npx @modelcontextprotocol/inspector@latest

In the Inspector UI:

  • Use http://localhost:8787/sse (dev) or your deployed /sse URL.

  • Connect and then List Tools to see all time tools.

  • Call tools like current_time with JSON arguments, for example:

      {
        "format": "YYYY-MM-DD HH:mm:ss",
        "timezone": "Europe/Amsterdam"
      }
    

3. Connect Claude Desktop via mcp-remote

Most desktop clients still speak stdio MCP, so you can use mcp-remote as a proxy to your Cloudflare Worker.

In your Claude Desktop config (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "time-mcp-timeserver": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://mcp-timeserver.<your-account>.workers.dev/sse"
      ]
    }
  }
}

Restart Claude. You should now see:

  • current_time
  • relative_time
  • days_in_month
  • get_timestamp
  • convert_time
  • get_week_year

available as tools.


Development Notes

  • Runtime: Cloudflare Workers + Durable Objects
  • MCP: @modelcontextprotocol/sdk via Cloudflare agents/mcp
  • Time library: dayjs with utc, timezone, relativeTime, weekOfYear, isoWeek plugins.
  • Entry point: src/index.ts
  • Config: wrangler.toml

License

MIT – feel free to fork, extend, and adapt.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选