time
by: modelcontextprotocol
A 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.
📌Overview
Purpose: To provide time and timezone conversion capabilities for LLMs using IANA timezone names and automatic timezone detection.
Overview: The Time MCP Server allows users to obtain current time information and convert between different time zones efficiently. It is designed to integrate seamlessly with language models, ensuring that time-related queries are handled accurately.
Key Features:
-
Current Time Retrieval: Fetches the current time based on a specified IANA timezone or adapts to the system's timezone for accuracy, enhancing user experience.
-
Timezone Conversion: Enables conversion of times between any two IANA timezones, accommodating diverse user needs and facilitating global interactions.
Time MCP Server
A 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.
Available Tools
-
get_current_time
- Get current time in a specific timezone or system timezone.
Required arguments:timezone
(string): IANA timezone name (e.g., 'America/New_York', 'Europe/London')
-
convert_time
- Convert time between timezones.
Required arguments:source_timezone
(string): Source IANA timezone nametime
(string): Time in 24-hour format (HH:MM)target_timezone
(string): Target IANA timezone name
Installation
Using uv (recommended)
No specific installation is needed. Use uvx
to directly run mcp-server-time.
Using PIP
Install via pip:
pip install mcp-server-time
Run as a script:
python -m mcp_server_time
Configuration
Configure for Claude.app
Add to your Claude settings:
Using uvx
"mcpServers": {
"time": {
"command": "uvx",
"args": ["mcp-server-time"]
}
}
Using docker
"mcpServers": {
"time": {
"command": "docker",
"args": ["run", "-i", "--rm", "mcp/time"]
}
}
Using pip installation
"mcpServers": {
"time": {
"command": "python",
"args": ["-m", "mcp_server_time"]
}
}
Configure for Zed
Add to your Zed settings.json
:
Using uvx
"context_servers": [
"mcp-server-time": {
"command": "uvx",
"args": ["mcp-server-time"]
}
],
Using pip installation
"context_servers": {
"mcp-server-time": {
"command": "python",
"args": ["-m", "mcp_server_time"]
}
},
Customization - System Timezone
The server auto-detects your system timezone by default. Override it by adding the argument --local-timezone
to the args
list, for example:
{
"command": "python",
"args": ["-m", "mcp_server_time", "--local-timezone=America/New_York"]
}
Example Interactions
- Get current time:
{
"name": "get_current_time",
"arguments": {
"timezone": "Europe/Warsaw"
}
}
Response:
{
"timezone": "Europe/Warsaw",
"datetime": "2024-01-01T13:00:00+01:00",
"is_dst": false
}
- Convert time between timezones:
{
"name": "convert_time",
"arguments": {
"source_timezone": "America/New_York",
"time": "16:30",
"target_timezone": "Asia/Tokyo"
}
}
Response:
{
"source": {
"timezone": "America/New_York",
"datetime": "2024-01-01T12:30:00-05:00",
"is_dst": false
},
"target": {
"timezone": "Asia/Tokyo",
"datetime": "2024-01-01T12:30:00+09:00",
"is_dst": false
},
"time_difference": "+13.0h"
}
Debugging
Use the MCP inspector to debug the server.
For uvx installations:
npx @modelcontextprotocol/inspector uvx mcp-server-time
Or if developing locally:
cd path/to/servers/src/time
npx @modelcontextprotocol/inspector uv run mcp-server-time
Examples of Questions for Claude
- What time is it now? (uses system timezone)
- What time is it in Tokyo?
- When it's 4 PM in New York, what time is it in London?
- Convert 9:30 AM Tokyo time to New York time
Build
Docker build:
cd src/time
docker build -t mcp/time .
Contributing
Contributions to expand and improve mcp-server-time are welcome. Suggestions include adding new tools, enhancing functionality, or improving documentation.
Pull requests are encouraged to make mcp-server-time more powerful and useful.
License
mcp-server-time is licensed under the MIT License. You are free to use, modify, and distribute the software under the terms of this license.