Skip to main content
Glama
gergelyszerovay

ID Generator MCP Server

README.md
# ID Generator MCP Server

An MCP (Model Context Protocol) server that generates **auto-incrementing unique identifiers** and provides **current ISO timestamps**.

## Overview

This MCP server provides two core tools:

1. **Generate Unique ID** - Generates auto-incrementing 8-digit hexadecimal identifiers with persistent state across restarts
2. **ISO Date** - Returns the current date and time in ISO 8601 format (UTC)

## Tools

### Generate Unique ID

**The MCP server generates auto-incrementing 8-digit hexadecimal unique identifiers.** Each ID automatically increments from the previous value, ensuring sequential uniqueness across all calls and server restarts. The counter state is persisted to disk, making it ideal for:

- Creating unique element IDs for testing and automation
- Generating sequential tracking numbers
- Assigning unique references to data entries
- Any scenario requiring guaranteed unique, sequential identifiers

**Input:**

```json
{
  "count": 5  // Optional: number of IDs to generate (1-32, defaults to 1)
}
```

**Output:**

```
Generated 5 unique ID(s):
00000001
00000002
00000003
00000004
00000005
```

### ISO Date

**The MCP server returns the current date and time in ISO 8601 format.** Each call provides the precise current timestamp in UTC timezone, useful for:

- Creating standardized timestamps for logs and records
- Generating sortable date strings
- Recording event times in a universal format
- Any scenario requiring ISO 8601 compliant timestamps

**Input:**

No input parameters required.

**Output:**

```
Current ISO datetime: 2025-12-10T14:23:45.678Z
```

## Usage

### Command Line

```bash
# Basic usage with stdio transport
npx @gergelyszerovay/mcp-id-date

# Enable HTTP transport for SSE
npx @gergelyszerovay/mcp-id-date --enableHttpTransport

# Enable REST API server
npx @gergelyszerovay/mcp-id-date --enableRestServer

# Custom counter file location
npx @gergelyszerovay/mcp-id-date --idCounterFile=./my-counter.txt
```

### CLI Options

| Flag                     | Description                                              | Default                      |
| :----------------------- | :------------------------------------------------------- | :--------------------------- |
| `--enableHttpTransport`  | Enable HTTP transport for SSE                            | `false`                      |
| `--enableStdioTransport` | Enable stdio transport                                   | `true`                       |
| `--enableRestServer`     | Enable REST API server                                   | `false`                      |
| `--mcpHttpPort`          | Port for MCP HTTP server                                 | `3001`                       |
| `--restHttpPort`         | Port for REST HTTP server                                | `3002`                       |
| `--idCounterFile`        | Path to the file used for tracking the last generated ID | `/workspace/last-tag-id.txt` |

### MCP Integration

Add this to your MCP server configuration:

```json
{
  "mcpServers": {
    "id-generator": {
      "command": "npx",
      "args": ["-y", "@gergelyszerovay/mcp-id-date"]
    }
  }
}
```