mcp_time

tink3rtanner/mcp_time

3.2

If you are the rightful owner of mcp_time and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Time Server is a robust server providing time-related utilities to AI clients using the Model Context Protocol.

Tools
4
Resources
0
Prompts
0

๐Ÿ•’ MCP Time Server โšก

A Model Context Protocol (MCP) server providing comprehensive time utilities to AI clients like Claude Desktop and Cursor. Built with Python using the FastMCP framework.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   AI Client     โ”‚โ—„โ”€โ”€โ–บโ”‚   MCP Server     โ”‚โ—„โ”€โ”€โ–บโ”‚  Time Services  โ”‚
โ”‚ (Claude/Cursor) โ”‚    โ”‚   (timeserver)   โ”‚    โ”‚   (Python)      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

Setup & Installation

cd /Users/joshpriebe/Documents/AI/mcp/timeserver
source .venv/bin/activate
python test_timeserver.py  # Verify everything works

Project Structure

timeserver/
โ”œโ”€โ”€ main.py                     # ๐Ÿ”ง MCP server implementation
โ”œโ”€โ”€ test_timeserver.py         # ๐Ÿงช Comprehensive tests  
โ”œโ”€โ”€ pyproject.toml             # ๐Ÿ“ฆ Python dependencies
โ”œโ”€โ”€ claude_desktop_config.json # โš™๏ธ  Claude config
โ”œโ”€โ”€ cursor_global_mcp.json     # โš™๏ธ  Cursor config template
โ””โ”€โ”€ .cursor/mcp.json           # โš™๏ธ  Project Cursor config

๐Ÿ› ๏ธ Available Tools

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Time Server Tools                        โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ๐ŸŒ get_current_time(timezone="UTC")                        โ”‚
โ”‚      Get current time in any timezone                       โ”‚
โ”‚                                                             โ”‚
โ”‚  ๐ŸŒ get_time_in_multiple_zones()                            โ”‚
โ”‚      World clock across 10 major timezones                  โ”‚
โ”‚                                                             โ”‚
โ”‚  ๐Ÿ“Š get_unix_timestamp()                                    โ”‚
โ”‚      Current Unix timestamp + readable format               โ”‚
โ”‚                                                             โ”‚
โ”‚  ๐Ÿ”„ format_time(timestamp)                                  โ”‚
โ”‚      Convert Unix timestamp to human-readable               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”Œ Client Integration

Claude Desktop

Configuration file: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "timeserver": {
      "command": "/Users/joshpriebe/Documents/AI/mcp/timeserver/.venv/bin/python",
      "args": ["/Users/joshpriebe/Documents/AI/mcp/timeserver/main.py"],
      "env": {
        "PYTHONPATH": "/Users/joshpriebe/Documents/AI/mcp/timeserver",
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

Cursor

Project config (already configured): .cursor/mcp.json Global config: Copy cursor_global_mcp.json to ~/.cursor/mcp.json

๐Ÿ’ก Example Usage

Natural Language Queries

๐Ÿ• Basic Time
โ”œโ”€โ”€ "What time is it?"
โ”œโ”€โ”€ "Current time please"
โ””โ”€โ”€ "What's the time right now?"

๐ŸŒ Timezone Queries  
โ”œโ”€โ”€ "What time is it in London?"
โ”œโ”€โ”€ "Show me Tokyo time"
โ””โ”€โ”€ "Current time in US/Pacific"

๐ŸŒ World Clock
โ”œโ”€โ”€ "Show me world clock"
โ”œโ”€โ”€ "Time in multiple cities" 
โ””โ”€โ”€ "What time is it around the world?"

๐Ÿ“Š Unix Timestamps
โ”œโ”€โ”€ "Current timestamp"
โ”œโ”€โ”€ "Give me the epoch time"
โ””โ”€โ”€ "Convert 1704067200 to date"

API Examples

# Get current time in specific timezone
await get_current_time("US/Pacific")
# โ†’ "Current time in US/Pacific: 2024-01-01 04:00:00 PST"

# Get world clock
await get_time_in_multiple_zones()
# โ†’ Multi-line output with 10 timezones

# Get Unix timestamp
await get_unix_timestamp() 
# โ†’ "Current Unix timestamp: 1704067200\nHuman readable (UTC): ..."

# Convert timestamp
await format_time(1704067200)
# โ†’ "Timestamp 1704067200 converts to:\nLocal time: ...\nUTC time: ..."

๐Ÿงช Testing

# Test all functionality
python test_timeserver.py

# Test MCP protocol communication  
python test_mcp_protocol.py

Test Flow:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Unit      โ”‚โ”€โ”€โ”€โ–บโ”‚    MCP      โ”‚โ”€โ”€โ”€โ–บโ”‚   Manual    โ”‚
โ”‚   Tests     โ”‚    โ”‚  Protocol   โ”‚    โ”‚   Testing   โ”‚
โ”‚             โ”‚    โ”‚   Tests     โ”‚    โ”‚ (AI Client) โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ” Troubleshooting

Quick Diagnostics

# 1. Verify Python environment
ls -la .venv/bin/python

# 2. Test server directly  
python main.py

# 3. Check configuration
cat .cursor/mcp.json  # or
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json

Common Issues

โŒ "No tools available" 
   โ†’ Restart AI client after config changes
   
โŒ "Server not responding"
   โ†’ Check Python path in configuration
   
โŒ "Import errors"  
   โ†’ Activate virtual environment: source .venv/bin/activate

๐Ÿ”ง Development

Dependencies

# Runtime
pip install "mcp[cli]>=1.0.0"

# Development (optional)
pip install black isort pylint mypy pytest pytest-asyncio

Code Quality

black main.py test_timeserver.py    # Format
isort main.py test_timeserver.py    # Sort imports  
pylint main.py                      # Lint
mypy main.py                        # Type check

๐Ÿ“œ License

MIT License - Open source time utilities for the MCP ecosystem.


๐Ÿ• Happy time tracking! Your MCP Time Server provides accurate time information across any AI client supporting the Model Context Protocol.