Skip to main content
Glama
mcp-server-ts

mcp-server-ts

by lditzel94

mcp-server-ts

ci

A lab where I learn the Model Context Protocol by building an MCP server in TypeScript with the official SDK, one milestone at a time.

What this lab teaches

  • How MCP works on the wire: the initialize handshake, capabilities and JSON-RPC messages.

  • The three server primitives: tools, resources and prompts.

  • Transports: stdio for local clients, Streamable HTTP with sessions for remote ones.

  • Securing a remote server with bearer tokens and OAuth.

  • Designing a set of tools that work together, applied to exploring Kafka topics.

  • Testing the protocol contract and consuming the server from a TypeScript client.

Related MCP server: datetime-mcp

Architecture

// milestone 1: one process, one tool, stdio.

flowchart LR
  host["MCP host<br/>(Inspector, Claude Desktop, IDE)"] -- "JSON-RPC over stdin/stdout" --> entry["serveStdio<br/>src/index.ts"]
  entry -- "one instance per connection" --> server["createServer()<br/>src/server.ts"]
  server --> tool["convert_epoch<br/>src/tools/convert-epoch.ts"]
  entry -. "logs" .-> stderr[(stderr)]
  style entry fill:#0a0a0b,stroke:#f4b740,color:#f4b740
  • serveStdio answers both the 2026-07-28 protocol (per-request version, server/discover) and legacy clients that open with initialize.

  • convert_epoch turns a Unix timestamp in milliseconds into UTC and local time. Bad input comes back as isError: true with a message written for the model.

  • stdout only carries MCP messages; logs go to stderr.

Run it

Requires Node 24.22.1+ and pnpm through Corepack (corepack enable, or prefix commands with corepack).

pnpm install
pnpm test       # vitest, an in-memory MCP client against the real server
pnpm inspect    # build and open MCP Inspector against dist/index.js

To use it from an MCP host, point the host at node /path/to/mcp-server-ts/dist/index.js after pnpm build.

Milestones

See ROADMAP.md.

Decisions

Architecture decision records live in docs/adr/.

License

MIT

Available Tools

1 tool
convert_epochConvert epochA
Read-only

Convert a Unix timestamp in milliseconds to ISO-8601 UTC and to local time in a given time zone.

Inputs: epochMs (required), timeZone.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of confusing it with another; convert_epoch has a single, unambiguous purpose (epoch milliseconds to ISO-8601 UTC and zoned local time). An agent cannot misselect here.

    Naming Consistency5/5

    The lone name follows a clean verb_noun snake_case convention (convert_epoch) that would scale predictably if more tools were added. There are no competing conventions to clash.

    Tool Count3/5

    A single tool is thin even for a narrow time-conversion server; the surface is barely scoped rather than well-scoped. It earns its place but leaves the server feeling like a one-off utility rather than a coherent toolkit.

    Completeness2/5

    The obvious inverse operation (ISO-8601 or local time back to epoch milliseconds) is missing, as is any batch or multi-timezone conversion, creating a dead end for round-trip workflows. Agents needing two-way conversion will have to fall back to other means.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      A general-purpose MCP server providing time-related utilities such as fetching current time, Unix timestamps, and formatting services. It supports both local stdio and remote SSE communication modes for versatile AI client integration.
      3
      -
    • A
      license
      D
      quality
      C
      maintenance
      A lightweight MCP server that provides date and time tools, including the ability to retrieve current timestamps and parse date strings with IANA timezone support. It enables AI models to interact with the host OS clock and perform temporal calculations via stdio transport.
      3
      6 npm
      7
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables developers to define and register MCP tools and expose them over stdio or HTTP using JSON-RPC 2.0, with schema validation and manifest discovery.
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables MCP-compatible assistants to get the current time in a specified time zone and convert values between units over stdio, while serving as a starter for adding custom tools.
      2
      MIT