takanarishimbo-datetime-mcp-server


Nametakanarishimbo-datetime-mcp-server JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryA simple MCP server that provides date and time functionality
upload_time2025-08-21 03:30:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords datetime mcp server timezone
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [English](README.md) | [日本語](README_ja.md) | **README**

# DateTime MCP Server

A Model Context Protocol (MCP) server that provides tools to get the current date and time in various formats. This is a Python implementation of the datetime MCP server, demonstrating how to build MCP servers using the Python SDK.

## Features

- Get current date and time in multiple formats (ISO, Unix timestamp, human-readable, etc.)
- Configurable output format via environment variables
- Timezone support
- Custom date format support
- Simple tool: `get_current_time`

## Usage

Choose one of these examples based on your needs:

**Basic usage (ISO format):**

```json
{
  "mcpServers": {
    "datetime": {
      "command": "uvx",
      "args": ["takanarishimbo-datetime-mcp-server"]
    }
  }
}
```

**Human-readable format with timezone:**

```json
{
  "mcpServers": {
    "datetime": {
      "command": "uvx",
      "args": ["takanarishimbo-datetime-mcp-server"],
      "env": {
        "DATETIME_FORMAT": "human",
        "TIMEZONE": "America/New_York"
      }
    }
  }
}
```

**Unix timestamp format:**

```json
{
  "mcpServers": {
    "datetime": {
      "command": "uvx",
      "args": ["takanarishimbo-datetime-mcp-server"],
      "env": {
        "DATETIME_FORMAT": "unix",
        "TIMEZONE": "UTC"
      }
    }
  }
}
```

**Custom format:**

```json
{
  "mcpServers": {
    "datetime": {
      "command": "uvx",
      "args": ["takanarishimbo-datetime-mcp-server"],
      "env": {
        "DATETIME_FORMAT": "custom",
        "DATE_FORMAT_STRING": "%Y/%m/%d %H:%M",
        "TIMEZONE": "Asia/Tokyo"
      }
    }
  }
}
```

## Configuration

The server can be configured using environment variables:

### `DATETIME_FORMAT`

Controls the default output format of the datetime (default: "iso")

Supported formats:

- `iso`: ISO 8601 format (2024-01-01T12:00:00.000000+00:00)
- `unix`: Unix timestamp in seconds
- `unix_ms`: Unix timestamp in milliseconds
- `human`: Human-readable format (Mon, Jan 1, 2024 12:00:00 PM UTC)
- `date`: Date only (2024-01-01)
- `time`: Time only (12:00:00)
- `custom`: Custom format using DATE_FORMAT_STRING environment variable

### `DATE_FORMAT_STRING`

Custom date format string (only used when DATETIME_FORMAT="custom")
Default: "%Y-%m-%d %H:%M:%S"

Uses Python's strftime format codes:

- `%Y`: 4-digit year
- `%y`: 2-digit year
- `%m`: 2-digit month
- `%d`: 2-digit day
- `%H`: 2-digit hour (24-hour)
- `%M`: 2-digit minute
- `%S`: 2-digit second

### `TIMEZONE`

Timezone to use (default: "UTC")
Examples: "UTC", "America/New_York", "Asia/Tokyo"

## Available Tools

### `get_current_time`

Get the current date and time

Parameters:

- `format` (optional): Output format, overrides DATETIME_FORMAT env var
- `timezone` (optional): Timezone to use, overrides TIMEZONE env var

## Development

1. **Clone this repository**

   ```bash
   git clone https://github.com/TakanariShimbo/uvx-datetime-mcp-server.git
   cd uvx-datetime-mcp-server
   ```

2. **Install dependencies using uv**

   ```bash
   uv sync
   ```

3. **Run the server**

   ```bash
   uv run takanarishimbo-datetime-mcp-server
   ```

4. **Test with MCP Inspector (optional)**

   ```bash
   npx @modelcontextprotocol/inspector uv run takanarishimbo-datetime-mcp-server
   ```

## Publishing to PyPI

This project uses PyPI's Trusted Publishers feature for secure, token-less publishing via GitHub Actions.

### 1. Configure PyPI Trusted Publisher

1. **Log in to PyPI** (create account if needed)

   - Go to https://pypi.org/

2. **Navigate to Publishing Settings**

   - Go to your account settings
   - Click on "Publishing" or go to https://pypi.org/manage/account/publishing/

3. **Add GitHub Publisher**
   - Click "Add a new publisher"
   - Select "GitHub" as the publisher
   - Fill in:
     - **Owner**: `TakanariShimbo` (your GitHub username/org)
     - **Repository**: `uvx-datetime-mcp-server`
     - **Workflow name**: `pypi-publish.yml`
     - **Environment**: `pypi` (optional but recommended)
   - Click "Add"

### 2. Configure GitHub Environment (Recommended)

1. **Navigate to Repository Settings**

   - Go to your GitHub repository
   - Click "Settings" → "Environments"

2. **Create PyPI Environment**
   - Click "New environment"
   - Name: `pypi`
   - Configure protection rules (optional):
     - Add required reviewers
     - Restrict to specific branches/tags

### 3. Setup GitHub Personal Access Token (for release script)

The release script needs to push to GitHub, so you'll need a GitHub token:

1. **Create GitHub Personal Access Token**

   - Go to https://github.com/settings/tokens
   - Click "Generate new token" → "Generate new token (classic)"
   - Set expiration (recommended: 90 days or custom)
   - Select scopes:
     - ✅ `repo` (Full control of private repositories)
   - Click "Generate token"
   - Copy the generated token (starts with `ghp_`)

2. **Configure Git with Token**

   ```bash
   # Option 1: Use GitHub CLI (recommended)
   gh auth login

   # Option 2: Configure git to use token
   git config --global credential.helper store
   # Then when prompted for password, use your token instead
   ```

### 4. Release New Version

Use the release script to automatically version, tag, and trigger publishing:

```bash
# First time setup
chmod +x scripts/release.sh

# Increment patch version (0.1.0 → 0.1.1)
./scripts/release.sh patch

# Increment minor version (0.1.0 → 0.2.0)
./scripts/release.sh minor

# Increment major version (0.1.0 → 1.0.0)
./scripts/release.sh major

# Set specific version
./scripts/release.sh 1.2.3
```

### 5. Verify Publication

1. **Check GitHub Actions**

   - Go to "Actions" tab in your repository
   - Verify the "Publish to PyPI" workflow completed successfully

2. **Verify PyPI Package**
   - Visit: https://pypi.org/project/takanarishimbo-datetime-mcp-server/
   - Or run: `pip show takanarishimbo-datetime-mcp-server`

### Release Process Flow

1. `release.sh` script updates version in all files
2. Creates git commit and tag
3. Pushes to GitHub
4. GitHub Actions workflow triggers on new tag
5. Workflow uses OIDC to authenticate with PyPI (no tokens needed!)
6. Workflow builds project and publishes to PyPI
7. Package becomes available globally via `pip install` or `uvx`

## Code Quality

This project uses `ruff` for linting and formatting:

```bash
# Run linter
uv run ruff check

# Fix linting issues
uv run ruff check --fix

# Format code
uv run ruff format
```

## Project Structure

```
uvx-datetime-mcp-server/
├── src/
│   ├── __init__.py              # Package initialization
│   ├── __main__.py              # Main entry point
│   └── server.py                # Server implementation
├── pyproject.toml               # Project configuration
├── uv.lock                      # Dependency lock file
├── .github/
│   └── workflows/
│       └── pypi-publish.yml     # PyPI publish workflow with Trusted Publishers
├── scripts/
│   └── release.sh               # Release automation script
├── docs/
│   ├── README.md                # This file
│   └── README_ja.md             # Japanese documentation
└── .gitignore                   # Git ignore file
```

## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "takanarishimbo-datetime-mcp-server",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "datetime, mcp, server, timezone",
    "author": null,
    "author_email": "Takanari Shimbo <takanari.shimbo@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/df/5d/a579ff3e56066066f959cab9b4623a453879f29739fab326c4b8a1609d7b/takanarishimbo_datetime_mcp_server-0.2.0.tar.gz",
    "platform": null,
    "description": "[English](README.md) | [\u65e5\u672c\u8a9e](README_ja.md) | **README**\n\n# DateTime MCP Server\n\nA Model Context Protocol (MCP) server that provides tools to get the current date and time in various formats. This is a Python implementation of the datetime MCP server, demonstrating how to build MCP servers using the Python SDK.\n\n## Features\n\n- Get current date and time in multiple formats (ISO, Unix timestamp, human-readable, etc.)\n- Configurable output format via environment variables\n- Timezone support\n- Custom date format support\n- Simple tool: `get_current_time`\n\n## Usage\n\nChoose one of these examples based on your needs:\n\n**Basic usage (ISO format):**\n\n```json\n{\n  \"mcpServers\": {\n    \"datetime\": {\n      \"command\": \"uvx\",\n      \"args\": [\"takanarishimbo-datetime-mcp-server\"]\n    }\n  }\n}\n```\n\n**Human-readable format with timezone:**\n\n```json\n{\n  \"mcpServers\": {\n    \"datetime\": {\n      \"command\": \"uvx\",\n      \"args\": [\"takanarishimbo-datetime-mcp-server\"],\n      \"env\": {\n        \"DATETIME_FORMAT\": \"human\",\n        \"TIMEZONE\": \"America/New_York\"\n      }\n    }\n  }\n}\n```\n\n**Unix timestamp format:**\n\n```json\n{\n  \"mcpServers\": {\n    \"datetime\": {\n      \"command\": \"uvx\",\n      \"args\": [\"takanarishimbo-datetime-mcp-server\"],\n      \"env\": {\n        \"DATETIME_FORMAT\": \"unix\",\n        \"TIMEZONE\": \"UTC\"\n      }\n    }\n  }\n}\n```\n\n**Custom format:**\n\n```json\n{\n  \"mcpServers\": {\n    \"datetime\": {\n      \"command\": \"uvx\",\n      \"args\": [\"takanarishimbo-datetime-mcp-server\"],\n      \"env\": {\n        \"DATETIME_FORMAT\": \"custom\",\n        \"DATE_FORMAT_STRING\": \"%Y/%m/%d %H:%M\",\n        \"TIMEZONE\": \"Asia/Tokyo\"\n      }\n    }\n  }\n}\n```\n\n## Configuration\n\nThe server can be configured using environment variables:\n\n### `DATETIME_FORMAT`\n\nControls the default output format of the datetime (default: \"iso\")\n\nSupported formats:\n\n- `iso`: ISO 8601 format (2024-01-01T12:00:00.000000+00:00)\n- `unix`: Unix timestamp in seconds\n- `unix_ms`: Unix timestamp in milliseconds\n- `human`: Human-readable format (Mon, Jan 1, 2024 12:00:00 PM UTC)\n- `date`: Date only (2024-01-01)\n- `time`: Time only (12:00:00)\n- `custom`: Custom format using DATE_FORMAT_STRING environment variable\n\n### `DATE_FORMAT_STRING`\n\nCustom date format string (only used when DATETIME_FORMAT=\"custom\")\nDefault: \"%Y-%m-%d %H:%M:%S\"\n\nUses Python's strftime format codes:\n\n- `%Y`: 4-digit year\n- `%y`: 2-digit year\n- `%m`: 2-digit month\n- `%d`: 2-digit day\n- `%H`: 2-digit hour (24-hour)\n- `%M`: 2-digit minute\n- `%S`: 2-digit second\n\n### `TIMEZONE`\n\nTimezone to use (default: \"UTC\")\nExamples: \"UTC\", \"America/New_York\", \"Asia/Tokyo\"\n\n## Available Tools\n\n### `get_current_time`\n\nGet the current date and time\n\nParameters:\n\n- `format` (optional): Output format, overrides DATETIME_FORMAT env var\n- `timezone` (optional): Timezone to use, overrides TIMEZONE env var\n\n## Development\n\n1. **Clone this repository**\n\n   ```bash\n   git clone https://github.com/TakanariShimbo/uvx-datetime-mcp-server.git\n   cd uvx-datetime-mcp-server\n   ```\n\n2. **Install dependencies using uv**\n\n   ```bash\n   uv sync\n   ```\n\n3. **Run the server**\n\n   ```bash\n   uv run takanarishimbo-datetime-mcp-server\n   ```\n\n4. **Test with MCP Inspector (optional)**\n\n   ```bash\n   npx @modelcontextprotocol/inspector uv run takanarishimbo-datetime-mcp-server\n   ```\n\n## Publishing to PyPI\n\nThis project uses PyPI's Trusted Publishers feature for secure, token-less publishing via GitHub Actions.\n\n### 1. Configure PyPI Trusted Publisher\n\n1. **Log in to PyPI** (create account if needed)\n\n   - Go to https://pypi.org/\n\n2. **Navigate to Publishing Settings**\n\n   - Go to your account settings\n   - Click on \"Publishing\" or go to https://pypi.org/manage/account/publishing/\n\n3. **Add GitHub Publisher**\n   - Click \"Add a new publisher\"\n   - Select \"GitHub\" as the publisher\n   - Fill in:\n     - **Owner**: `TakanariShimbo` (your GitHub username/org)\n     - **Repository**: `uvx-datetime-mcp-server`\n     - **Workflow name**: `pypi-publish.yml`\n     - **Environment**: `pypi` (optional but recommended)\n   - Click \"Add\"\n\n### 2. Configure GitHub Environment (Recommended)\n\n1. **Navigate to Repository Settings**\n\n   - Go to your GitHub repository\n   - Click \"Settings\" \u2192 \"Environments\"\n\n2. **Create PyPI Environment**\n   - Click \"New environment\"\n   - Name: `pypi`\n   - Configure protection rules (optional):\n     - Add required reviewers\n     - Restrict to specific branches/tags\n\n### 3. Setup GitHub Personal Access Token (for release script)\n\nThe release script needs to push to GitHub, so you'll need a GitHub token:\n\n1. **Create GitHub Personal Access Token**\n\n   - Go to https://github.com/settings/tokens\n   - Click \"Generate new token\" \u2192 \"Generate new token (classic)\"\n   - Set expiration (recommended: 90 days or custom)\n   - Select scopes:\n     - \u2705 `repo` (Full control of private repositories)\n   - Click \"Generate token\"\n   - Copy the generated token (starts with `ghp_`)\n\n2. **Configure Git with Token**\n\n   ```bash\n   # Option 1: Use GitHub CLI (recommended)\n   gh auth login\n\n   # Option 2: Configure git to use token\n   git config --global credential.helper store\n   # Then when prompted for password, use your token instead\n   ```\n\n### 4. Release New Version\n\nUse the release script to automatically version, tag, and trigger publishing:\n\n```bash\n# First time setup\nchmod +x scripts/release.sh\n\n# Increment patch version (0.1.0 \u2192 0.1.1)\n./scripts/release.sh patch\n\n# Increment minor version (0.1.0 \u2192 0.2.0)\n./scripts/release.sh minor\n\n# Increment major version (0.1.0 \u2192 1.0.0)\n./scripts/release.sh major\n\n# Set specific version\n./scripts/release.sh 1.2.3\n```\n\n### 5. Verify Publication\n\n1. **Check GitHub Actions**\n\n   - Go to \"Actions\" tab in your repository\n   - Verify the \"Publish to PyPI\" workflow completed successfully\n\n2. **Verify PyPI Package**\n   - Visit: https://pypi.org/project/takanarishimbo-datetime-mcp-server/\n   - Or run: `pip show takanarishimbo-datetime-mcp-server`\n\n### Release Process Flow\n\n1. `release.sh` script updates version in all files\n2. Creates git commit and tag\n3. Pushes to GitHub\n4. GitHub Actions workflow triggers on new tag\n5. Workflow uses OIDC to authenticate with PyPI (no tokens needed!)\n6. Workflow builds project and publishes to PyPI\n7. Package becomes available globally via `pip install` or `uvx`\n\n## Code Quality\n\nThis project uses `ruff` for linting and formatting:\n\n```bash\n# Run linter\nuv run ruff check\n\n# Fix linting issues\nuv run ruff check --fix\n\n# Format code\nuv run ruff format\n```\n\n## Project Structure\n\n```\nuvx-datetime-mcp-server/\n\u251c\u2500\u2500 src/\n\u2502   \u251c\u2500\u2500 __init__.py              # Package initialization\n\u2502   \u251c\u2500\u2500 __main__.py              # Main entry point\n\u2502   \u2514\u2500\u2500 server.py                # Server implementation\n\u251c\u2500\u2500 pyproject.toml               # Project configuration\n\u251c\u2500\u2500 uv.lock                      # Dependency lock file\n\u251c\u2500\u2500 .github/\n\u2502   \u2514\u2500\u2500 workflows/\n\u2502       \u2514\u2500\u2500 pypi-publish.yml     # PyPI publish workflow with Trusted Publishers\n\u251c\u2500\u2500 scripts/\n\u2502   \u2514\u2500\u2500 release.sh               # Release automation script\n\u251c\u2500\u2500 docs/\n\u2502   \u251c\u2500\u2500 README.md                # This file\n\u2502   \u2514\u2500\u2500 README_ja.md             # Japanese documentation\n\u2514\u2500\u2500 .gitignore                   # Git ignore file\n```\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A simple MCP server that provides date and time functionality",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/TakanariShimbo/uvx-datetime-mcp-server",
        "Issues": "https://github.com/TakanariShimbo/uvx-datetime-mcp-server/issues",
        "Repository": "https://github.com/TakanariShimbo/uvx-datetime-mcp-server.git"
    },
    "split_keywords": [
        "datetime",
        " mcp",
        " server",
        " timezone"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bbb992bd32cec257af5d0bef9bbf10581d4995089ae18c09724ea0fc53627879",
                "md5": "67b5ef942c2b7af90e35bc1241a33d8d",
                "sha256": "6b7923d8ed49f6b6d2035abe3efbb7425df6c56ba430a301b6f0091df3e69632"
            },
            "downloads": -1,
            "filename": "takanarishimbo_datetime_mcp_server-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "67b5ef942c2b7af90e35bc1241a33d8d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8300,
            "upload_time": "2025-08-21T03:30:03",
            "upload_time_iso_8601": "2025-08-21T03:30:03.620135Z",
            "url": "https://files.pythonhosted.org/packages/bb/b9/92bd32cec257af5d0bef9bbf10581d4995089ae18c09724ea0fc53627879/takanarishimbo_datetime_mcp_server-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "df5da579ff3e56066066f959cab9b4623a453879f29739fab326c4b8a1609d7b",
                "md5": "17aa0f91ad8b0cb208e2721d06223d60",
                "sha256": "7390c2ddb6e729c0a1086da33164ea018110d9455824cb902d66dd249c7c73ee"
            },
            "downloads": -1,
            "filename": "takanarishimbo_datetime_mcp_server-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "17aa0f91ad8b0cb208e2721d06223d60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 8352,
            "upload_time": "2025-08-21T03:30:04",
            "upload_time_iso_8601": "2025-08-21T03:30:04.489936Z",
            "url": "https://files.pythonhosted.org/packages/df/5d/a579ff3e56066066f959cab9b4623a453879f29739fab326c4b8a1609d7b/takanarishimbo_datetime_mcp_server-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-21 03:30:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TakanariShimbo",
    "github_project": "uvx-datetime-mcp-server",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "takanarishimbo-datetime-mcp-server"
}
        
Elapsed time: 0.71129s