Integrations
Supports containerized deployment with Docker, allowing the time server to run in isolated containers with proper port mapping.
Provides tools for time-related queries including getting the current time in various IANA timezones and converting times between timezones.
Offers timezone conversion functionality and current time retrieval across different IANA timezones through a TypeScript implementation.
MCP Time Server (mcp-time-srv
)
A simple Model Context Protocol (MCP) server implemented in TypeScript that provides tools for time-related queries, including getting the current time in various timezones and converting times between timezones.
This server supports both modern Streamable HTTP and legacy HTTP+SSE MCP transport protocols.
Features
Provides the following MCP tools:
get_current_time
: Returns the current time in a specified IANA timezone.convert_time
: Converts a given time from a source IANA timezone to a target IANA timezone.
Prerequisites
- Node.js (v18 or later recommended)
- npm (usually comes with Node.js)
- Docker (Optional, for running in a container)
Setup
- Clone the repository (if you haven't already):Copy
- Install dependencies:Copy
Running Locally
- Build the TypeScript code:This compiles the TypeScript source inCopy
src/
to JavaScript indist/
. - Run the server:
You can run the server using
ts-node
(for development) or directly withnode
after building.- Using
ts-node
:Copy - Using
node
(after building):Copy
- Using
The server will start, typically listening on port 3000.
Running with Docker (Optional)
A Dockerfile
is provided for building and running the server in a container.
- Build the Docker image:Copy
- Run the container:Copy
-d
: Run in detached mode (in the background).-p 3000:3000
: Map port 3000 on your host to port 3000 in the container.--name my-mcp-server
: Assign a name to the container for easier management.
The server will be running inside the container, accessible at http://localhost:3000
.
To stop the container:
To view logs:
Testing with the Client
A simple test client script (src/client.ts
) is included to demonstrate interacting with the server's tools.
- Ensure the server is running (either locally or in Docker).
- Run the client:Copy
The client will connect to the server (using SSE transport by default), list the available tools, call each tool with example arguments (including some designed to test error handling), and print the results.
Tool Details
get_current_time
Returns the current time in the specified timezone.
- Input Argument:
timezone
(string, optional): An IANA timezone name (e.g.,America/New_York
,Europe/London
). If omitted, defaults to the server's local timezone.
- Output: A JSON object containing:
timezone
(string): The effective timezone used.datetime
(string): The current time in ISO 8601 format with offset (e.g.,2025-04-26T01:39:15Z
).
convert_time
Converts a time from a source timezone to a target timezone.
- Input Arguments:
source_timezone
(string, optional): Source IANA timezone name. Defaults to server's local timezone if omitted.time
(string, required): The time to convert in 24-hour HH:MM format (e.g.,14:30
).target_timezone
(string, optional): Target IANA timezone name. Defaults to server's local timezone if omitted.
- Output: A JSON object containing:
source
(object): Details of the time in the source timezone (timezone
,datetime
).target
(object): Details of the converted time in the target timezone (timezone
,datetime
).time_difference
(string): The difference between the target and source timezone offsets (e.g.,+8h
,-5h
,+5.75h
).
License
This project is licensed under the MIT License - see the LICENSE file for details.
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.
A TypeScript server that provides time-related tools through the Model Context Protocol, allowing users to get current time in various timezones and convert times between different IANA timezones.
Related MCP Servers
- AsecurityAlicenseAqualityA production-ready template for creating Model Context Protocol servers with TypeScript, providing tools for efficient testing, development, and deployment.Last updated -11512JavaScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that extracts embedded data (such as i18n translations or key/value configurations) from TypeScript/JavaScript source code into structured JSON configuration files.Last updated -2142JavaScriptMIT License
- AsecurityAlicenseAqualityA TypeScript server implementing the Model Context Protocol (MCP) that provides datetime and timezone information to AI agents and chat interfaces, allowing them to access current time in various timezones.Last updated -42TypeScriptMozilla Public License 2.0
- AsecurityFlicenseAqualityA Model Context Protocol server that provides time and timezone conversion capabilities, enabling LLMs to get current time information and perform timezone conversions using IANA timezone names.Last updated -21Python