一个实现MCP协议的时间服务器示例
Project description
MCP时间服务 (v0.1.0)
这是一个基于MCP协议的时间服务器,提供获取当前时间和格式化日期等功能。 大语言模型可以通过这个服务获取实时时间信息。
安装
pip install mcp-time-service1
功能
工具 (Tools)
get_current_time: 获取当前时间,精确到毫秒。format_date(format_string: str): 按照指定格式返回当前日期。
资源 (Resources)
time://timezone_info: 提供当前系统的时区信息。
在阿里云百炼中使用
在阿里云百炼平台的MCP服务配置中,使用以下JSON:
{
"mcpServers": {
"time-service": { // 服务名称,可自定义
"command": "uvx",
"args": ["mcp-time-service1"]
}
}
}
本地运行
安装后,您可以在本地通过以下方式运行:
# 使用uvx
uvx mcp-time-service1
# 使用包提供的命令
mcp-time-service1
# 使用Python -m
python -m mcp_time_service1
按 Ctrl+C 停止服务器。
许可证
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_service1-0.1.0.tar.gz.
File metadata
- Download URL: mcp_time_service1-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
051c5e8de1d6d4a7b30890d11ed8fc1f9298348de3f0cb1a824890618d9edcb9
|
|
| MD5 |
8ec96987eb24455b799fc4c44849aa4a
|
|
| BLAKE2b-256 |
800315e5cbbef697a10135f9dd95bdb3a0926532eb77f1c6ee54e8d56c9c8888
|
File details
Details for the file mcp_time_service1-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_time_service1-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8478ccbb8c3755d37e2eed44febbba298b0f7ac1b8350e76523be85d73b16528
|
|
| MD5 |
85271b07b7b8ec6df2654566072fe879
|
|
| BLAKE2b-256 |
f01e0de5f15bd41c45b3314be94c5a61c9157cb8810e2858160e34351adefc1f
|