MCP Server Time
mcp-server-time is a Model Context Protocol (MCP) server designed to provide robust tools for time queries and timezone conversions, primarily for integration with Large Language Models (LLMs). It implements the MCP specification, allowing LLMs to accurately retrieve current time information, perform date and time calculations, and handle timezone conversions. The current version is 2026.1.26, following a frequent, calendar-based release cadence.
Common errors
-
ModuleNotFoundError: No module named 'uvicorn'
cause Uvicorn, the ASGI server runner, was not installed.fixInstall uvicorn with `pip install uvicorn[standard]`. -
RuntimeError: Address already in use
cause The port the server is trying to bind to (default 8000) is already occupied by another process.fixChange the port in your `uvicorn.run()` call or via the `--port` flag in the command line (e.g., `uvicorn main:app --host 0.0.0.0 --port 8001`). -
AttributeError: module 'mcp_server_time' has no attribute 'create_app'
cause Attempting to import `create_app` directly from the top-level `mcp_server_time` package instead of its specific submodule.fixCorrect the import statement to `from mcp_server_time.server import create_app`.
Warnings
- gotcha The `uvicorn[standard]` package is a mandatory dependency for running the server locally or in development, but it's not a direct dependency of `mcp-server-time` itself. Ensure you install it alongside the library.
- gotcha The server uses a default port (8000). If this port is already in use by another application, the server will fail to start. This is a common issue for local development setups.
- gotcha This library provides an MCP *server*. It is designed to be consumed by an MCP-compliant client, typically an LLM agent. It does not offer a standalone Python client API for direct time utility in regular Python scripts.
Install
-
pip install mcp-server-time uvicorn[standard]
Imports
- create_app
from mcp_server_time import create_app
from mcp_server_time.server import create_app
Quickstart
import uvicorn
from mcp_server_time.server import create_app
# Create the FastAPI application instance
app = create_app()
# Run the server programmatically
if __name__ == '__main__':
# For production, consider using gunicorn or a process manager
uvicorn.run(app, host='0.0.0.0', port=8000)