MCP Time Server Node
The MCP Time Server Node is a comprehensive time manipulation server for Node.js that provides extensive date and time operations optimized for LLMs like Claude.
Key Capabilities: • Timezone Operations: Convert times between IANA timezones and get current time in any timezone with custom formatting • Date Arithmetic: Add or subtract time periods (years, months, days, hours, minutes, seconds) from dates • Duration & Business Calculations: Calculate time between dates, business days excluding weekends/holidays, and working hours with timezone support • Recurring Events: Find next occurrences of daily, weekly, monthly, or yearly patterns • Flexible Formatting: Format times as relative, calendar, or custom string formats • Days Until Calculation: Calculate days until specific target dates or events
Technical Features: • High performance with <10ms response times and intelligent caching • Security features including input validation, rate limiting, and ESLint security rules • 703+ tests with 100% coverage • Environment customization via variables like RATE_LIMIT and CACHE_SIZE • Structured error handling for invalid inputs
Uses date-fns and date-fns-tz libraries for comprehensive time manipulation operations including timezone conversions, date arithmetic, business day calculations, duration calculations, and flexible date formatting across IANA timezones
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Time Server Nodewhat time is it in Tokyo right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Time Server Node
A comprehensive Node.js time manipulation server implementing the Model Context Protocol (MCP) for LLMs like Claude. This server provides powerful time-related operations including timezone conversions, date arithmetic, business day calculations, and more.
Features
🌍 Timezone Operations: Convert times between any IANA timezones
⏰ Current Time: Get current time in any timezone with custom formatting
➕➖ Date Arithmetic: Add or subtract time periods from dates
📊 Duration Calculations: Calculate time between dates in various units
💼 Business Days: Calculate business days excluding weekends and holidays
⏱️ Business Hours: Calculate working hours between timestamps with timezone support
🔄 Recurring Events: Find next occurrences of recurring patterns
📝 Flexible Formatting: Format times in relative, calendar, or custom formats
📅 Days Until: Calculate days until any date or event
🚀 High Performance: Response times < 10ms with intelligent caching
🔒 Security Hardened: Input validation, cache key hashing, ESLint security rules
🛡️ Rate Limiting: Configurable rate limits to prevent abuse
✅ Thoroughly Tested: 703+ tests with 100% coverage
Related MCP server: Chrono MCP
Installation
Using npm (recommended)
npm install -g mcp-time-server-nodeUsing Claude Code (claude mcp add)
Add the server to Claude Code:
# For npm-published version (when available)
claude mcp add mcp-time-server-node# For local development/testing
claude mcp add tim-server /path/to/mcp-time-server-node/dist/index.jsUsing Claude Desktop
Manually add to your claude_desktop_config.json:
{
"mcpServers": {
"time-server": {
"command": "npx",
"args": ["-y", "mcp-time-server-node"],
"env": {
"NODE_ENV": "production"
}
}
}
}Local Testing
For testing before npm publish:
# Build the project
make build# Test directly
echo '{"jsonrpc":"2.0","method":"tools/list","id":1,"params":{}}' | node dist/index.js# Or add to Claude Code for local testing
cd mcp-time-server-node
claude mcp add time-server-local $(pwd)/dist/index.js Available Tools
1. get_current_time
Get the current time in any timezone.
Parameters:
timezone(optional): IANA timezone name (default: "UTC")format(optional): date-fns format stringinclude_offset(optional): Include UTC offset (default: true)
Example:
{
"timezone": "America/New_York",
"format": "yyyy-MM-dd HH:mm:ss"
}2. convert_timezone
Convert time between timezones.
Parameters:
time(required): Input time in ISO format or parseable stringfrom_timezone(required): Source IANA timezoneto_timezone(required): Target IANA timezoneformat(optional): Output format string
Example:
{
"time": "2025-01-20T15:00:00Z",
"from_timezone": "UTC",
"to_timezone": "Asia/Tokyo"
}3. add_time
Add a duration to a date/time.
Parameters:
time(required): Base timeamount(required): Amount to addunit(required): Unit ("years", "months", "days", "hours", "minutes", "seconds")timezone(optional): Timezone for calculation
Example:
{
"time": "2025-01-20",
"amount": 3,
"unit": "days"
}4. subtract_time
Subtract a duration from a date/time.
Parameters:
Same as
add_time
5. calculate_duration
Calculate the duration between two times.
Parameters:
start_time(required): Start timeend_time(required): End timeunit(optional): Output unit ("auto", "milliseconds", "seconds", "minutes", "hours", "days")timezone(optional): Timezone for parsing
Example:
{
"start_time": "2025-01-20T09:00:00",
"end_time": "2025-01-20T17:30:00"
}6. get_business_days
Calculate business days between dates.
Parameters:
start_date(required): Start dateend_date(required): End dateexclude_weekends(optional): Exclude Saturdays and Sundays (default: true)holidays(optional): Array of holiday dates in ISO formattimezone(optional): Timezone for calculation
Example:
{
"start_date": "2025-01-01",
"end_date": "2025-01-31",
"holidays": ["2025-01-01", "2025-01-20"]
}7. next_occurrence
Find the next occurrence of a recurring event.
Parameters:
pattern(required): "daily", "weekly", "monthly", or "yearly"start_from(optional): Start searching from this date (default: now)day_of_week(optional): For weekly pattern (0-6, where 0 is Sunday)day_of_month(optional): For monthly pattern (1-31)time(optional): Time in HH:mm formattimezone(optional): Timezone for calculation
Example:
{
"pattern": "weekly",
"day_of_week": 1,
"time": "09:00"
}8. format_time
Format time in various human-readable formats.
Parameters:
time(required): Time to formatformat(required): "relative", "calendar", or "custom"custom_format(optional): Format string when using "custom" formattimezone(optional): Timezone for display
Example:
{
"time": "2025-01-20T15:00:00Z",
"format": "relative"
}9. calculate_business_hours
Calculate business hours between two times.
Parameters:
start_time(required): Start timeend_time(required): End timebusiness_hours(optional): Business hours definition (default: 9 AM - 5 PM)Can be a single object:
{ start: { hour: 9, minute: 0 }, end: { hour: 17, minute: 0 } }Or weekly schedule:
{ 0: null, 1: { start: {...}, end: {...} }, ... }(0=Sunday, 6=Saturday)
timezone(optional): Timezone for calculationholidays(optional): Array of holiday datesinclude_weekends(optional): Include weekends in calculation (default: false)
Example:
{
"start_time": "2025-01-20T08:00:00",
"end_time": "2025-01-24T18:00:00",
"business_hours": {
"start": { "hour": 9, "minute": 0 },
"end": { "hour": 17, "minute": 30 }
},
"holidays": ["2025-01-22"],
"timezone": "America/New_York"
}10. days_until
Calculate days until a target date or event.
Parameters:
target_date(required): Target date (ISO string, natural language like "next Christmas", or Unix timestamp)timezone(optional): Timezone for calculation (default: system timezone)format_result(optional): Return formatted string instead of number (default: false)
Example:
{
"target_date": "2025-12-25",
"timezone": "America/New_York"
}Environment Variables
NODE_ENV: Set to "production" for production useRATE_LIMIT: Maximum requests per minute (default: 100)RATE_LIMIT_WINDOW: Rate limit window in milliseconds (default: 60000)CACHE_SIZE: Maximum cache entries (default: 10000)DEFAULT_TIMEZONE: Override system timezone detection (e.g., "America/New_York")MAX_LISTENERS: Maximum concurrent requests (default: 20, minimum: 10)
Performance
All operations complete in < 10ms (after initial load)
Intelligent caching reduces repeated calculations
Sliding window rate limiting prevents abuse
Memory-efficient implementation
Error Handling
The server returns structured errors with codes:
INVALID_TIMEZONE: Invalid timezone specifiedINVALID_DATE_FORMAT: Cannot parse the provided dateINVALID_UNIT: Invalid time unit specifiedRATE_LIMIT_EXCEEDED: Too many requestsINVALID_RECURRENCE_PATTERN: Invalid recurrence pattern
Development
Current Status
Refactoring completed
Building from source
git clone https://github.com/pshempel/mcp-time-node.git
cd mcp-time-server-node
make setup # Install dependencies and build
make test # Run all testsRunning tests
make test # Run all tests
make coverage # Run with coverage report
make test-watch # Run in watch mode for TDD
# If tests fail unexpectedly:
make test-quick # Fix Jest issues and run tests
make reset # Full environment resetContributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Author
pshempel
Acknowledgments
Built with:
date-fns for date manipulation
date-fns-tz for timezone support
Available Tools
11 toolsadd_timeC
Add duration to a date/time
Inputs: time (required), amount (required), unit (required), timezone.
calculate_business_hoursC
Calculate business hours between two times
Inputs: start_time (required), end_time (required), business_hours, timezone, +2 more.
calculate_durationC
Calculate duration between two times
Inputs: start_time (required), end_time (required), unit, timezone.
convert_timezoneC
Convert time between timezones
Inputs: time (required), from_timezone (required), to_timezone (required), format.
days_untilB
Calculate days until a target date/event
Inputs: target_date (required), timezone, format_result.
format_timeB
Format time in various human-readable formats
Inputs: time (required), format (required), custom_format, timezone.
get_business_daysC
Calculate business days between dates
Inputs: start_date (required), end_date (required), exclude_weekends, holidays, +1 more.
get_current_timeC
Get current time in specified timezone with formatting options
Inputs: timezone, format, include_offset.
get_server_infoB
Get server version and build information
Inputs: no named parameters.
next_occurrenceC
Find next occurrence of a recurring event
Inputs: pattern (required), start_from, day_of_week, day_of_month, +2 more.
subtract_timeC
Subtract duration from a date/time
Inputs: time (required), amount (required), unit (required), timezone.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
TDQS
Scored across 11 tools
Each tool has a clearly distinct purpose with no overlap: add_time and subtract_time are complementary duration operations, calculate_business_hours and get_business_days target different business time calculations, and other tools like convert_timezone, days_until, and next_occurrence address unique time-related tasks. The descriptions make it easy to differentiate between tools like calculate_duration (generic duration) and calculate_business_hours (business-specific).
All tools follow a consistent verb_noun naming pattern with snake_case throughout, such as add_time, calculate_duration, convert_timezone, and get_current_time. This uniformity makes the tool set predictable and easy to navigate, with no deviations in style or convention across the 11 tools.
With 11 tools, the count is well-scoped for a time server, covering a comprehensive range of time calculations, conversions, and formatting without being overwhelming. Each tool earns its place by addressing specific time-related needs, from basic operations like add_time to more complex ones like next_occurrence, making the set appropriately sized for the domain.
The tool set provides complete coverage for time operations, including CRUD-like actions (add/subtract time), conversions (timezone), calculations (duration, business days/hours), formatting, and utilities (current time, server info). There are no obvious gaps; agents can handle a wide range of time-related workflows without dead ends, from simple date math to recurring event scheduling.
Maintenance
Related MCP Connectors
Date/time math for agents: business days, holidays, time zones, cron, RRULE. 25 free calls/day.
Deterministic time tools for AI agents: timezone conversion, business-day math, cron interpretation.
Time and date math for AI agents: Unix timestamp conversion, DST-correct time zone conversion, durations, epoch arithmetic, cron schedules, and holiday countdowns. Eight tools, no key.
Business-day, SLA, cron and recurrence calculations — offline, holiday-aware, no network.
Related MCP Servers
- AlicenseBqualityDmaintenanceGives large language models time awareness capabilities through various time-related functions including current time retrieval, timezone conversion, and relative time calculations.61,374 npmMIT
- AlicenseAqualityCmaintenanceProvides comprehensive date, time, timezone, and calendar operations powered by Luxon, enabling AI agents to perform time calculations, timezone conversions, and temporal data handling across 400+ IANA timezones.29 npmMIT
- AlicenseAqualityDmaintenanceProvides tools for date-time manipulation, including timezone conversion and arithmetic operations like adding or subtracting time units. It also enables users to retrieve current date, time, and timezone information.324 npmISC
- AlicenseAqualityDmaintenanceEnables timezone conversion, astronomical calculations, and date utilities through natural language, supporting sunrise/sunset, moon phases, business days, and more.919 npm1ISC