Building a Simple MCP Time Server with FastMCP and Cursor
This article walks through solving Cursor's inaccurate date handling by installing an MCP time server, creating a minimal FastMCP‑based MCP server in Python, configuring Cursor to use it, and demonstrating how to automate time‑stamped task tracking with practical code examples.
During a live stream about using Cursor to track tasks in a large project, the author encountered frequent errors where the LLM wrote incorrect dates, prompting the need for a reliable time source.
They resolved the issue by installing the mcp-server-time package ( pip install mcp-server-time ) and configuring Cursor to use the MCP Time Server.
To deepen the learning, the author built a custom MCP server using the fastMCP framework, which provides tools, resource management, prompt definitions, client session handling, and SSE support for real‑time communication.
Setup steps include creating a project directory, initializing a virtual environment, and installing FastMCP:
mkdir mix-server
cd mix-server
uv venv venv
source .venv/bin/activate
uv pip install fastmcp
The main server code ( main.py ) defines a FastMCP instance and a tool that returns the local current time:
import datetime
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("mix_server") # important line
@mcp.tool()
def get_local_current_time():
now = datetime.datetime.now()
return now.strftime("%Y-%m-%d@%H:%M:%S")
if __name__ == "__main__":
mcp.run()Running the server is done with:
fastmcp dev main.py
Next, the author edited the Cursor configuration file ~/.cursor/mcp.json to point to the new server:
{
"mcpServers": {
"mix_server": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/local/main_py_dir", # replace with your actual path
"run",
"main.py"
]
}
}
}With the server running, using Cursor’s auto‑run mode and the prompt “显示一下本地当前时间” (show the local current time) returns the correct timestamp, confirming the integration works.
The article also shares a typical prompt used to update a work plan file with timestamps, demonstrating how the custom tool can automate start and completion time markings.
In conclusion, the author reflects on solving a real‑world pain point, gaining experience in MCP server development, and encourages readers to explore further extensions of AI programming assistants.
Project resources are provided:
• GitHub: https://github.com/punkpeye/fastmcp • Documentation: https://modelcontextprotocol.io/docs
Continuous Delivery 2.0
Tech and case studies on organizational management, team management, and engineering efficiency
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.