Built as a Node.js application using the MCP SDK to provide time-related functionality
Uses npm for package management and includes build scripts for TypeScript compilation
Implemented in TypeScript with proper type definitions and compilation to JavaScript
Time MCP Server
A Model Context Protocol (MCP) server that provides time and date information for AI assistants like Claude in VSCode.
Features
- Current Time: Get the current time in various formats
- Timezone Support: Query time in different timezones
- Detailed Info: Get comprehensive time information including day of week, timestamp, etc.
- Multiple Formats: Support for 12-hour, 24-hour, and ISO formats
Available Tools
get_current_time
Get the current date and time with formatting options.
Parameters:
timezone
(optional): Timezone identifier (e.g., "America/New_York", "Europe/London", "Asia/Tokyo")format
(optional): Time format - "12hour" (default), "24hour", or "iso"
Examples:
- "What time is it?"
- "Get current time in Tokyo"
- "Show me the time in 24-hour format"
get_time_info
Get detailed time information including timezone data, day of week, and timestamps.
Parameters:
timezone
(optional): Timezone identifier
Examples:
- "Give me detailed time information"
- "Show time info for London timezone"
Prerequisites
- Node.js (v18 or higher)
- npm
- Docker Desktop (for Docker builds)
- Install via:
brew install --cask docker
- Or download from https://www.docker.com/products/docker-desktop/
- Important: You need Docker Desktop (full app), not just Docker CLI
- Install via:
Installation
Local Development
- Clone or create the project:
- Install dependencies:
- Build the project:
Docker Deployment
Prerequisites: Ensure Docker Desktop is running
- Build and run with Docker Compose:
- Or build manually:
- View logs:
Configuration
Configuration
Local Development - Claude in VSCode
For local Node.js execution:
Docker Deployment - Claude in VSCode
Option 1: Docker Exec (Recommended)
For a running Docker container:
Option 2: Docker Run (Creates new container each time)
Combined Configuration (Both Docker and Local)
Use this configuration to have both options available simultaneously:
Benefits of combined configuration:
- ✅ Fallback options - If Docker is down, local still works
- ✅ Performance testing - Compare Docker vs local performance
- ✅ Development flexibility - Switch between deployment methods
- ✅ Redundancy - Multiple servers provide the same functionality
Note: Place your mcp.json
file in the project root directory (same level as package.json
) for relative paths to work correctly.
Configuration Steps
For Docker Setup:
- Start your Docker container:
- Verify container is running:
- Update mcp.json with Docker configuration
For Local Setup:
- Build the project:
- Place mcp.json in project root (same directory as package.json)
- Test it works:
For Combined Setup:
- Ensure both are working (Docker container running + local build exists)
- Place the mcp.json in your project root directory
- Use the combined mcp.json configuration above
Testing Your Configuration
Test Docker version:
Test local version:
Check logs:
Quick Start Guide
- Build everything with CI script:
- For Docker deployment:
- Configure Claude in VSCode with appropriate
mcp.json
Usage Examples
Once configured with Claude in VSCode, you can ask natural language questions:
- "What time is it?" → Returns current time
- "What time is it in New York?" → Returns time in EST/EDT
- "Show me the time in 24-hour format" → Returns time in 24-hour format
- "Get detailed time information" → Returns comprehensive time data
- "What day is today?" → Uses detailed info to show current day
Development
Project Structure
Local Development Scripts
npm run build
- Build TypeScript to JavaScriptnpm run dev
- Build and run the server (for MCP clients)npm start
- Run the built server (for MCP clients)npm test
- Quick test to verify server is working
CI/CD Build Script
Use the included ci.sh
script for automated building and testing:
CI Script Features:
- ✅ Prerequisite checking (Node.js, Docker)
- ✅ Automated building (TypeScript + Docker)
- ✅ Comprehensive testing (tool listing, function calls)
- ✅ Cross-platform compatibility (macOS/Linux)
- ✅ Color-coded output and error handling
- ✅ Build artifact generation
Testing
Quick Test:
Manual Testing:
Note: npm start
and npm run dev
will appear to "hang" - this is normal! The server is waiting for MCP protocol messages on stdin. Use the test commands above or configure with Claude to interact with it.
Supported Timezones
The server supports any valid IANA timezone identifier, including:
America/New_York
Europe/London
Asia/Tokyo
Australia/Sydney
UTC
Dependencies
@modelcontextprotocol/sdk
- Official MCP SDKtypescript
- TypeScript compiler@types/node
- Node.js type definitions
License
MIT
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Build and test:
npm run build
- Submit a pull request
Troubleshooting
Common Issues
"No inputs were found" error:
- Ensure the
src/index.ts
file exists - Run
npm run build
after creating the file
Docker not working:
- Ensure Docker Desktop is installed and running:
brew install --cask docker
- Start Docker Desktop:
open -a Docker
(wait for whale icon in menu bar) - Verify with:
docker ps
(should not show connection errors) - Docker Desktop takes 30-60 seconds to fully start after launching
Server appears to hang:
- This is normal behavior! The server waits for MCP protocol messages on stdin
- Use
npm test
for quick verification, or configure with Claude for actual usage - The server only responds when it receives proper JSON-RPC messages
TypeScript errors:
- Make sure all dependencies are installed:
npm install
- Check TypeScript version compatibility
Debug Mode
Add console logging by setting environment variables:
Version History
- 0.1.0 - Initial release with basic time functionality
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Provides current time and date information with timezone support and multiple formatting options. Enables AI assistants to answer time-related queries in different timezones with detailed temporal information.
Related MCP Servers
- AsecurityAlicenseAqualityAccess the time in any timezone and get the current local timeLast updated -139MIT License
- -securityAlicense-qualityA Model Context Protocol server that provides the current time in any timezone with customizable formatting, allowing AI assistants to access accurate time information.Last updated -MIT License
- -securityFlicense-qualityProvides real-time weather information and forecasts, connecting AI assistants with live weather data for current conditions and multi-day forecasts for any location worldwide.Last updated -
- AsecurityAlicenseAqualityProvides comprehensive time manipulation capabilities including timezone conversions, date arithmetic, business day calculations, duration calculations, and recurring event handling. Enables natural language time queries with high performance and intelligent caching.Last updated -111MIT License