Skip to main content
Glama
jharkins

MCP Time Server

by jharkins

MCP タイムサーバー ( mcp-time-srv )

TypeScript で実装されたシンプルなモデル コンテキスト プロトコル (MCP) サーバー。さまざまなタイムゾーンの現在の時刻の取得や、タイムゾーン間の時刻の変換など、時間関連のクエリ用のツールを提供します。

このサーバーは、最新のストリーミング可能な HTTP と従来の HTTP+SSE MCP トランスポート プロトコルの両方をサポートしています。

特徴

次の MCP ツールを提供します。

  • get_current_time : 指定された IANA タイムゾーンの現在の時刻を返します。

  • convert_time : 指定された時間をソース IANA タイムゾーンからターゲット IANA タイムゾーンに変換します。

Related MCP server: Time Tools MCP Server

前提条件

  • Node.js (v18以降を推奨)

  • npm (通常はNode.jsに付属)

  • Docker (オプション、コンテナ内で実行する場合)

設定

  1. リポジトリのクローンを作成します (まだ作成していない場合)。

    # git clone <your-repo-url>
    # cd mcp-time-srv
  2. 依存関係をインストールします:

    npm install

ローカルで実行

  1. TypeScript コードをビルドします。

    npm run build

    これによりsrc/内の TypeScript ソースがdist/内の JavaScript にコンパイルされます。

  2. サーバーを実行する: ts-node (開発用) を使用してサーバーを実行するか、ビルド後にnodeで直接サーバーを実行できます。

    • ts-nodeの使用:

      npx ts-node src/server.ts
    • nodeの使用(ビルド後):

      node dist/server.js

サーバーが起動し、通常はポート 3000 をリッスンします。

MCP Time server listening on http://localhost:3000

Dockerで実行する(オプション)

コンテナ内でサーバーを構築および実行するためのDockerfileが提供されています。

  1. Docker イメージをビルドします。

    docker build -t mcp-time-srv .
  2. コンテナを実行します。

    docker run -d -p 3000:3000 --name my-mcp-server mcp-time-srv
    • -d : デタッチドモード(バックグラウンド)で実行します。

    • -p 3000:3000 : ホストのポート 3000 をコンテナのポート 3000 にマップします。

    • --name my-mcp-server : 管理を容易にするためにコンテナに名前を割り当てます。

サーバーはコンテナ内で実行され、 http://localhost:3000からアクセスできます。

コンテナを停止するには:

docker stop my-mcp-server

ログを表示するには:

docker logs my-mcp-server

クライアントとのテスト

サーバーのツールとの対話方法を示すための簡単なテスト クライアント スクリプト ( src/client.ts ) が含まれています。

  1. サーバーが実行中であることを確認します(ローカルまたは Docker 内)。

  2. クライアントを実行します。

    npx ts-node src/client.ts

クライアントはサーバーに接続し (デフォルトでは SSE トランスポートを使用)、使用可能なツールを一覧表示し、サンプル引数 (エラー処理をテストするために設計されたものも含む) を使用して各ツールを呼び出し、結果を出力します。

ツールの詳細

get_current_time

指定されたタイムゾーンの現在の時刻を返します。

  • 入力引数:

    • timezone (文字列, オプション): IANAタイムゾーン名(例: America/New_YorkEurope/London )。省略された場合は、サーバーのローカルタイムゾーンがデフォルトとなります。

  • **出力:**次の内容を含む JSON オブジェクト:

    • timezone (文字列): 使用される有効なタイムゾーン。

    • datetime (文字列): オフセット付きの ISO 8601 形式の現在の時刻 (例: 2025-04-26T01:39:15Z )。

convert_time

ソース タイムゾーンの時間をターゲット タイムゾーンに変換します。

  • 入力引数:

    • source_timezone (文字列、オプション): ソースIANAタイムゾーン名。省略した場合は、サーバーのローカルタイムゾーンがデフォルトになります。

    • time (文字列、必須): 変換する時刻を 24 時間制の HH:MM 形式で指定します (例: 14:30 )。

    • target_timezone (文字列、オプション): ターゲットのIANAタイムゾーン名。省略した場合は、サーバーのローカルタイムゾーンがデフォルトになります。

  • **出力:**次の内容を含む JSON オブジェクト:

    • source (オブジェクト): ソースタイムゾーンの時間の詳細 ( timezonedatetime )。

    • target (オブジェクト): ターゲットタイムゾーンでの変換された時刻の詳細 ( timezonedatetime )。

    • time_difference (文字列): ターゲットとソースのタイムゾーンオフセットの差 (例: +8h-5h+5.75h )。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。

A
license - permissive license
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    A TypeScript server implementing the Model Context Protocol (MCP) that provides datetime and timezone information to AI agents and chat interfaces, allowing them to access current time in various timezones.
    4
    9,887
    4
    Mozilla Public 2.0
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that provides tools to get the current date and time in various formats, supporting different timezones and custom formatting options.
    1
    38
    1
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    A Model Context Protocol server that provides time and timezone conversion capabilities, enabling LLMs to get current time information and perform timezone conversions using IANA timezone names.
    2
    MIT

View all related MCP servers

Related MCP Connectors

  • A real clock for AI agents: current time, timezone conversion, and DST facts from the IANA tzdb.

  • A time server that keeps your AI honest about time. Real clock + drift guard, zero dependencies.

  • A Model Context Protocol server for Wix AI tools

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jharkins/mcp-time-srv'

If you have feedback or need assistance with the MCP directory API, please join our Discord server