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
Metadata
Release files for mcp-time-server-bdc 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_time_server_bdc-0.1.0.tar.gz | 3.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_time_server_bdc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / mcp_time_server_bdc-0.1.0.tar.gz
| Download URL | mcp_time_server_bdc-0.1.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cd714e0d11fb7cc08be7fa395748b55ed6b6910a8ab73dc0bdb096670d00048
|
|
BLAKE2b-256 checksum How to use checksums |
277e1b34e0001cc739600eedee0e721455bb92e5d94905088d8cb0ee5fb1c4a5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.5 Windows/11
|
Release files / mcp_time_server_bdc-0.1.0-py3-none-any.whl
| Download URL | mcp_time_server_bdc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73cb973a1ff0753f7a85b1ee58b89809ef7a5d63d44c9569e38fe6f00f863607
|
|
BLAKE2b-256 checksum How to use checksums |
3ea1732ab3d45240e6ffbe16ba24aabcc28e808578216440e9163038ca3bc0c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.5 Windows/11
|
Security for mcp-time-server-bdc 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.