An example Model Context Protocol (MCP) server exposing a getTodaysDate tool.
Project description
mcp-date-server
An example Python package that implements a Model Context Protocol (MCP) server with a single tool:
getTodaysDate: returns today's date in ISO format (YYYY-MM-DD).
This server is implemented using the Python mcp SDK and is suitable for use with MCP-compatible clients.
Project Structure
mcp-date-server/
├── pyproject.toml
├── README.md
└── src/
└── mcp_date_server/
├── __init__.py
└── server.py
pyproject.toml: build configuration and package metadata.src/mcp_date_server/server.py: MCP server implementation andgetTodaysDatetool.
Installation (from source)
-
Clone or copy this project into a directory, then from the project root run:
python -m venv .venv .venv\Scripts\activate # Windows # source .venv/bin/activate # Linux/macOS pip install --upgrade pip pip install .
-
This installs the
mcp-date-serverconsole script into your environment.
You can also build a wheel and install it:
pip install build
python -m build
pip install dist/mcp_date_server-0.1.0-py3-none-any.whl
Usage
Once installed in an activated virtual environment, you can run the MCP server via the console entry point:
mcp-date-server
This starts an MCP server on stdio for an MCP client to connect to.
MCP Client Configuration Example
How you configure this server depends on your MCP-compatible client. As a conceptual example (not specific to any one client), you might register the server with a command like:
{
"name": "mcp-date-server",
"command": "mcp-date-server",
"args": []
}
Refer to your MCP client documentation for the exact configuration format.
The getTodaysDate Tool
The MCP tool is defined in src/mcp_date_server/server.py:
- Name:
getTodaysDate - Description: Returns today's date in ISO format
YYYY-MM-DD. - Return type:
string.
Example result value:
"2026-01-28"
Publishing to PyPI
-
Ensure you have an up-to-date
buildandtwine:pip install --upgrade build twine
-
Build the distribution artifacts:
python -m build # Outputs files under the dist/ directory
-
Upload to PyPI (or TestPyPI first):
# For TestPyPI twine upload --repository testpypi dist/* # For real PyPI twine upload dist/*
-
After publishing, users can install it with:
pip install mcp-date-server
Requirements
- Python 3.9+
- The
mcpPython package (installed automatically viapyproject.toml).
Running Locally Without Installing
For quick local testing without installing as a package:
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/macOS
pip install -e .
mcp-date-server
This installs the package in editable mode and exposes the mcp-date-server entry point for development.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_date_server-0.1.0.tar.gz.
File metadata
- Download URL: mcp_date_server-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecd7b8a5ef2ab5ce5e5ce567d520495cef005a1bf3e559956cf8e6920d1624d2
|
|
| MD5 |
dbbcf352dc3dfe56d2ee219e8c56191b
|
|
| BLAKE2b-256 |
7da79cf3ead5ba7130e6e7edc2c50ef0390f374980c49581dca99d11fd957be5
|
File details
Details for the file mcp_date_server-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_date_server-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a22fb6b366804d53e312c941da074d9d90dc2ce6560c125929b40bf60f71a62
|
|
| MD5 |
a6e5546d57cea256aa83ffcac6b0d4b3
|
|
| BLAKE2b-256 |
827f679eefc71243c402ccd238c4e35e985befcba5c24fd5cb767230dd9d9642
|