MCP Time Server

MCP Time Server

A lightweight Model Context Protocol server that provides current UTC time in various formats, including ISO 8601 and Unix timestamps. It is designed for seamless integration with Cursor IDE to provide consistent time-related capabilities across all development projects.

Category
访问服务器

README

MCP Time Server

A simple Model Context Protocol (MCP) server that provides current UTC time functionality. This server can be integrated globally with Cursor IDE to provide time-related capabilities across all projects.

Features

  • Get current UTC time in multiple formats
  • Simple MCP protocol implementation
  • Global Cursor IDE integration
  • Lightweight and fast

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Install from source

  1. Clone or download this repository
  2. Navigate to the project directory
  3. Install the package:
pip install -e .

Install dependencies only

pip install -r requirements.txt

Usage

Running the server

# Run directly
python -m mcp_time_server.server

# Or use the installed script
mcp-time-server

Available Tools

get_current_time_utc

Get the current UTC time in various formats.

Parameters:

  • format (optional): Output format
    • "iso" (default): ISO 8601 format (2025-01-15T10:30:45Z)
    • "datetime": Human-readable format (2025-01-15 10:30:45)
    • "timestamp": Unix timestamp (1736939445)

Example response:

Current UTC time: 2025-01-15T10:30:45.123456Z
Format: iso
Full ISO: 2025-01-15T10:30:45.123456Z

Cursor IDE Integration

Global Configuration (Recommended)

For permanent integration across all projects:

  1. Create the global MCP configuration file:

    • Windows: C:\Users\[USERNAME]\.cursor\mcp.json
    • macOS/Linux: ~/.cursor/mcp.json
  2. Add the following configuration:

{
  "mcpServers": {
    "time-server": {
      "command": "python",
      "args": ["-m", "mcp_time_server.server"],
      "cwd": "/full/path/to/mcp-time-server/src",
      "env": {
        "PYTHONPATH": "/full/path/to/mcp-time-server/src"
      }
    }
  }
}
  1. Restart Cursor IDE
  2. Check Tools & Integrations > MCP to verify the server is enabled

The server will now automatically start with Cursor IDE and work across all projects!

Project-Specific Configuration

For project-only usage, create .cursor/mcp.json in your project directory with the same structure.

Development

Development Setup

# Install with development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/
isort src/

# Type checking
mypy src/

Project Structure

mcp-time-server/
├── src/
│   └── mcp_time_server/
│       ├── __init__.py
│       └── server.py
├── pyproject.toml
├── requirements.txt
├── README.md
├── mcp_config.json
└── PROJECT_PLAN.md

Testing

Test the server functionality:

from mcp_time_server.server import get_current_time_utc

# Test different formats
print(get_current_time_utc("iso"))
print(get_current_time_utc("datetime"))
print(get_current_time_utc("timestamp"))

Troubleshooting

Common Issues

  1. Import errors: Make sure the package is installed with pip install -e .
  2. MCP connection issues: Verify the server path in your MCP configuration
  3. Permission errors: Ensure Python has necessary permissions to run the server
  4. Server not appearing: Check that the .cursor directory exists and mcp.json is properly formatted

Windows PowerShell

If you encounter issues with && operator in PowerShell, use:

cd src; python -m mcp_time_server.server

Verifying Server Status

Check if server is running:

# Windows
tasklist | findstr python
wmic process where "name='python.exe'" get ProcessId,CommandLine /format:list

# macOS/Linux  
ps aux | grep mcp_time_server

Test connection in Cursor: Ask the AI assistant to get current time - it should use the MCP Time Server automatically.

Manual Server Management

Start server manually:

cd src && python -m mcp_time_server.server

Stop server:

# Windows (replace PID with actual process ID)
taskkill /PID [PID] /F

License

MIT License - see LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Changelog

v0.1.0

  • Initial release
  • Basic UTC time functionality
  • MCP protocol compliance
  • FastMCP integration for simplified server management
  • Global Cursor IDE configuration support
  • Multiple time formats (ISO, datetime, timestamp)
  • Comprehensive testing and documentation
  • Process management and troubleshooting tools
  • GitHub repository with MIT license
  • Live testing confirmed across restart cycles

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选