一个基于MCP协议的时间服务器,提供获取当前时间的工具
Project description
MCP时间服务器
一个基于MCP(Model Context Protocol)协议的时间服务器,提供获取当前时间的工具。
功能特性
- 支持多种传输协议:stdio、streamable-http、sse
- 支持时区参数,可获取不同时区的当前时间
- 提供命令行接口,方便配置和启动
- 基于MCP协议,可与AI模型无缝集成
安装
使用pip安装:
pip install mcp_time_server
使用方法
启动服务器
1. 使用stdio传输方式
mcp-time-server --transport stdio
2. 使用streamable-http传输方式
mcp-time-server --transport streamable-http --port 8000
3. 使用sse传输方式
mcp-time-server --transport sse --port 8000
使用工具
服务器提供get_current_time工具,可通过MCP协议调用。
参数
timezone(可选):时区字符串,例如 "Asia/Shanghai"、"America/New_York"
示例请求
{
"jsonrpc": "2.0",
"id": "1",
"method": "call_tool",
"params": {
"name": "get_current_time",
"params": {
"timezone": "Asia/Shanghai"
}
}
}
示例响应
{
"jsonrpc": "2.0",
"id": "1",
"result": "2025-12-28 12:30:45.123456 CST"
}
开发
克隆仓库
git clone https://github.com/bdc/mcp_time_server.git
cd mcp_time_server
安装依赖
pip install -e .
运行测试
python -m pytest
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_time_server_bdc-0.1.0.tar.gz.
File metadata
- Download URL: mcp_time_server_bdc-0.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.5 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cd714e0d11fb7cc08be7fa395748b55ed6b6910a8ab73dc0bdb096670d00048
|
|
| MD5 |
de6bdd31600ca04760127fcde005eada
|
|
| BLAKE2b-256 |
277e1b34e0001cc739600eedee0e721455bb92e5d94905088d8cb0ee5fb1c4a5
|
File details
Details for the file mcp_time_server_bdc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_time_server_bdc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.13.5 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73cb973a1ff0753f7a85b1ee58b89809ef7a5d63d44c9569e38fe6f00f863607
|
|
| MD5 |
d624a597d56103383bcbd27b72b89be6
|
|
| BLAKE2b-256 |
3ea1732ab3d45240e6ffbe16ba24aabcc28e808578216440e9163038ca3bc0c5
|