Time MCP Server by PHP
A PHP sample implementation of an MCP (Model Context Protocol) server for retrieving time information.
uzulla
README
Time MCP Server by PHP
PHPで実装されたMCP(モデルコンテキストプロトコルサーバー)で、時刻とタイムゾーン変換機能を提供します。
このサーバーは、LLMがIANAタイムゾーン名を使用して現在の時刻情報を取得し、タイムゾーン変換を実行できるようにし、システムタイムゾーンを自動検出します。
利用可能なツール
-
get_current_time
- 特定のタイムゾーンまたはシステムタイムゾーンでの現在時刻を取得します。- 必須引数:
timezone
(文字列): IANAタイムゾーン名(例: 'America/New_York'、'Europe/London')
- 必須引数:
-
convert_time
- タイムゾーン間で時刻を変換します。- 必須引数:
source_timezone
(文字列): 元のIANAタイムゾーン名time
(文字列): 24時間形式(HH:MM)の時間target_timezone
(文字列): 変換先のIANAタイムゾーン名
- 必須引数:
インストール
# 本レポジトリをclone
$ git clone https://github.com/uzulla/mcp-time-php.git
# Composerでインストールした場合
$ cd mcp-time-php
$ composer install
MCP利用側の設定
Claude.appの設定
<details> <summary>PHPを直接実行で使用</summary>
"mcpServers": {
"time": {
"command": "php",
"args": ["/path/to/this/repo/bin/time-server"]
}
}
</details>
Zedの設定
Zedのsettings.jsonに追加:
<details> <summary>PHPを使用</summary>
"context_servers": {
"mcp-server-time": {
"command": "php",
"args": ["/path/to/this/repo/bin/time-server"]
}
},
</details>
カスタマイズ - システムタイムゾーン
デフォルトでは、サーバーはシステムのタイムゾーンを自動的に検出します。設定のargs
リストに引数--local-timezone
を追加することで、これをオーバーライドできます。
例:
{
"command": "php",
"args": ["/path/to/this/repo/bin/time-server", "--local-timezone=America/New_York"]
}
対話例
- 現在時刻の取得:
{
"name": "get_current_time",
"arguments": {
"timezone": "Europe/Warsaw"
}
}
レスポンス:
{
"timezone": "Europe/Warsaw",
"datetime": "2024-01-01T13:00:00+01:00",
"is_dst": false
}
- タイムゾーン間の時間変換:
{
"name": "convert_time",
"arguments": {
"source_timezone": "America/New_York",
"time": "16:30",
"target_timezone": "Asia/Tokyo"
}
}
レスポンス:
{
"source": {
"timezone": "America/New_York",
"datetime": "2024-01-01T16:30:00-05:00",
"is_dst": false
},
"target": {
"timezone": "Asia/Tokyo",
"datetime": "2024-01-02T06:30:00+09:00",
"is_dst": false
},
"time_difference": "+14.0h"
}
デバッグ
MCPインスペクターを使用してサーバーをデバッグできます:
npx @modelcontextprotocol/inspector ./bin/time-server
開発
プロジェクト構造
.
├── bin/ # 実行可能スクリプト
│ └── time-server # エントリーポイント
├── src/ # ソースコード
│ ├── Enum/ # 列挙型クラス
│ │ └── TimeTools.php # 時間関連ツール列挙型
│ ├── Model/ # データモデル
│ │ ├── TimeConversionResult.php # 時間変換結果モデル
│ │ └── TimeResult.php # 時間取得結果モデル
│ ├── Service/ # サービスクラス
│ │ ├── TimeService.php # 時間サービス
│ │ └── TimeUtils.php # 時間ユーティリティ
│ └── StdioServer.php # MCPサーバー実装
├── tests/ # テストコード
│ ├── ServerTest.php # サーバーテスト
│ └── TimeServerTest.php # 時間サーバーテスト
├── composer.json # Composer設定
├── composer.lock # Composerロックファイル
├── phpunit.xml # PHPUnit設定
└── README.md # このファイル
テスト
Composerをインストールして依存関係をセットアップします:
composer install
PHPUnitテストを実行します:
composer test
Claudeへの質問例
- 「今何時ですか?」(システムタイムゾーンを使用)
- 「東京の時間は?」
- 「ニューヨークで午後4時の時、ロンドンでは何時ですか?」
- 「東京時間の午前9時30分をニューヨーク時間に変換して」
License
This project is licensed under the MIT License.
MIT License
Copyright (c) 2025 Junichi Ishida aka uzulla (zishida@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the Software.
Acknowledgments
This project incorporates and translates portions of the following open-source projects:
Recommended Servers
Crypto Price & Market Analysis MCP Server
A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.
MCP PubMed Search
Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.
dbt Semantic Layer MCP Server
A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.
mixpanel
Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Nefino MCP Server
Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.
Vectorize
Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.
Mathematica Documentation MCP server
A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.
kb-mcp-server
An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded
Research MCP Server
The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.