Sponsored by Deepsite.site

MCP Time Server - Streamable HTTP

Created By
Cam100011101017 months ago
Content

MCP Time Server - Streamable HTTP

⚠️ This Server is for Demo and Testing Purposes ⚠️

This is a bare bones example server designed for testing MCP Streamable HTTP protocol functionality. It is NOT intended for production use and lacks proper authentication and security measures.


A Model Context Protocol (MCP) server providing time-related tools, implemented as a Cloudflare Worker.

This server allows LLMs to access various date/time functions.

Features

Provides the following MCP tools:

  • current_time: Get the current date and time in specified formats and timezones.
  • relative_time: Get a human-readable relative time string (e.g., "in 5 minutes", "2 hours ago").
  • days_in_month: Get the number of days in a specific month.
  • get_timestamp: Get the Unix timestamp (milliseconds) for a given time.
  • convert_time: Convert a time between different IANA timezones.
  • get_week_year: Get the week number and ISO week number for a given date.

Project Structure

mcp-server-http-time/
├── src/
│   └── index.ts      # Cloudflare Worker entry point & MCP logic
├── package.json      # Project dependencies and scripts
├── tsconfig.json     # TypeScript configuration
└── wrangler.toml     # Cloudflare Worker configuration

Getting Started

  1. Clone the Repository:
    git clone https://github.com/Cam10001110101/mcp-server-http-time.git
    cd mcp-server-http-time
    

Development

  1. Install Dependencies:

    npm install
    
  2. Build: Compile the TypeScript code:

    npm run build
    

    (This compiles src/index.ts to dist/index.js)

  3. Local Development (using Wrangler): Run the worker locally for testing:

    npx wrangler dev
    

    This will typically start the server on http://localhost:8787. You can then point your MCP client configuration to this local endpoint.

Deployment

Deploy the worker to Cloudflare:

npx wrangler deploy

(Ensure you are logged into Cloudflare via wrangler login first and have configured your wrangler.toml appropriately).

Connectors for Streamable HTTP Servers

NEW: Major providers have adopted the Model Context Protocol and now support Streamable HTTP servers directly. Anthropic, OpenAI, and Microsoft have all adopted this modern transport protocol.

📋 Protocol Note: Streamable HTTP is the modern replacement for the deprecated HTTP+SSE transport.

Anthropic MCP Connector

Anthropic's MCP Connector allows you to use Streamable HTTP servers directly through the Messages API without needing a separate MCP client.

The MCP Connector is perfect for this server since it uses the Streamable HTTP architecture. Simply include the server in your API requests:

curl https://api.anthropic.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: mcp-client-2025-04-04" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 1000,
    "messages": [{
      "role": "user", 
      "content": "What time is it in Tokyo?"
    }],
    "mcp_servers": [{
      "type": "url",
      "url": "https://your.worker.url.workers.dev",
      "name": "http-time-server"
    }]
  }'

Anthropic MCP Connector Benefits:

  • No client setup required - Connect directly through the API
  • Native Streamable HTTP support - Designed for servers like this one

OpenAI Agents SDK

OpenAI also supports Streamable HTTP servers through their Agents SDK using the MCPServerStreamableHttp class:

from agents.mcp.server import MCPServerStreamableHttp

# Connect to this Streamable HTTP server
server = MCPServerStreamableHttp({
    "url": "https://your.worker.url.workers.dev",
    "headers": {"Authorization": "Bearer your-token"},  # if needed
})

# Use the server in your OpenAI agent
await server.connect()
tools = await server.list_tools()
result = await server.call_tool("current_time", {"timezone": "Asia/Tokyo"})

Microsoft Copilot Studio

Microsoft Copilot Studio now supports Streamable HTTP servers with MCP integration generally available. You can connect this server to Copilot Studio by:

  1. Building a custom connector that links your MCP server to Copilot Studio
  2. Adding the tool in Copilot Studio by selecting 'Add a Tool' and searching for your MCP server
  3. Using the server directly in your agents with generative orchestration enabled

More MCP Clients Coming Soon

Keep an eye out as more MCP clients adopt support for Streamable HTTP. Here are a few resources that maintain lists of MCP clients and their capabilities:


Authentication & Security Considerations

⚠️ IMPORTANT: This example server has NO authentication or security measures implemented.

For production MCP servers, you should implement proper authentication as outlined in the official MCP documentation

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Playwright McpPlaywright MCP server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
CursorThe AI Code Editor
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
WindsurfThe new purpose-built IDE to harness magic
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Serper MCP ServerA Serper MCP Server
ChatWiseThe second fastest AI chatbot™
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
DeepChatYour AI Partner on Desktop