Skip to main content
Glama

MCP Time Server

by jharkins

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

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

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

特徴

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

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

前提条件

  • 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 形式で指定します (例: 14:30 )。
    • target_timezone (文字列、オプション): ターゲットのIANAタイムゾーン名。省略した場合は、サーバーのローカルタイムゾーンがデフォルトになります。
  • **出力:**次の内容を含む JSON オブジェクト:
    • source (オブジェクト): ソースタイムゾーンの時間の詳細 ( timezonedatetime )。
    • target (オブジェクト): ターゲットタイムゾーンでの変換された時刻の詳細 ( timezonedatetime )。
    • time_difference (文字列): ターゲットとソースのタイムゾーンオフセットの差 (例: +8h-5h+5.75h )。

ライセンス

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

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

モデル コンテキスト プロトコルを通じて時間関連のツールを提供する TypeScript サーバー。これにより、ユーザーはさまざまなタイムゾーンの現在の時刻を取得し、異なる IANA タイムゾーン間で時刻を変換できます。

  1. 特徴
    1. 前提条件
      1. 設定
        1. ローカルで実行
          1. Dockerで実行する(オプション)
            1. クライアントとのテスト
              1. ツールの詳細
                1. get_current_time
                2. convert_time
              2. ライセンス

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  A production-ready template for creating Model Context Protocol servers with TypeScript, providing tools for efficient testing, development, and deployment.
                  Last updated -
                  1
                  1
                  12
                  JavaScript
                  MIT License
                • A
                  security
                  A
                  license
                  A
                  quality
                  A Model Context Protocol server that extracts embedded data (such as i18n translations or key/value configurations) from TypeScript/JavaScript source code into structured JSON configuration files.
                  Last updated -
                  2
                  14
                  2
                  JavaScript
                  MIT License
                • A
                  security
                  A
                  license
                  A
                  quality
                  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.
                  Last updated -
                  4
                  2
                  TypeScript
                  Mozilla Public License 2.0
                • A
                  security
                  F
                  license
                  A
                  quality
                  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.
                  Last updated -
                  2
                  1
                  Python

                View all related MCP servers

                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