Skip to main content

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 and getTodaysDate tool.

Installation (from source)

  1. 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 .
    
  2. This installs the mcp-date-server console 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

  1. Ensure you have an up-to-date build and twine:

    pip install --upgrade build twine
    
  2. Build the distribution artifacts:

    python -m build
    # Outputs files under the dist/ directory
    
  3. Upload to PyPI (or TestPyPI first):

    # For TestPyPI
    twine upload --repository testpypi dist/*
    
    # For real PyPI
    twine upload dist/*
    
  4. After publishing, users can install it with:

    pip install mcp-date-server
    

Requirements

  • Python 3.9+
  • The mcp Python package (installed automatically via pyproject.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_date_server-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_date_server-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for mcp_date_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ecd7b8a5ef2ab5ce5e5ce567d520495cef005a1bf3e559956cf8e6920d1624d2
MD5 dbbcf352dc3dfe56d2ee219e8c56191b
BLAKE2b-256 7da79cf3ead5ba7130e6e7edc2c50ef0390f374980c49581dca99d11fd957be5

See more details on using hashes here.

File details

Details for the file mcp_date_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_date_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a22fb6b366804d53e312c941da074d9d90dc2ce6560c125929b40bf60f71a62
MD5 a6e5546d57cea256aa83ffcac6b0d4b3
BLAKE2b-256 827f679eefc71243c402ccd238c4e35e985befcba5c24fd5cb767230dd9d9642

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page