Skip to main content

MCP示例服务器 (v0.1.0)

这是一个实现MCP协议的示例服务器,提供时间查询、数学计算和信息获取等功能。 通过MCP协议,大语言模型可以使用这个服务器来获取各种实用功能。

##功能特性

###工具 (Tools)

  • get_current_time: 获取当前系统的精确时间
  • format_date:按照指定格式格式化当前日期和时间
  • add_numbers:计算两个数字的和
  • multiply_numbers:计算两个数字的乘积
  • generate_random_number: 生成指定范围内的随机整数
  • calculate_statistics:计算数字列表的统计信息(平均值、最大值、最小值)

###资 (Resources)

  • info://server: 提供服务器基本信息
  • time://current_iso: 提供ISO格式的当前时间
  • math://constants: 提供常用的数学常数(π、e等)

安装

pip install mcp-example-server1

在阿里云百炼中使用

在阿里云百炼平台的MCP服务配置中,使用以下JSON:

{
  "mcpServers": {
    "example-mcp-server": {
      "command": "uvx",
      "args": ["mcp-example-server1"]
    }
  }
}

本地运行

安装后,您可以在本地通过以下方式运行:

# 使用uvx (模拟平台行为)
uvx mcp-example-server1

# 使用包提供的命令 (通过entry_points)
mcp-example-server1

# 使用Python -m
python -m mcp_example_server1

按 Ctrl+C停止服务器。

开发说明

本项目使用 MCP Python SDK构建,采用 FastMCP实现。

##许证

MIT License

Metadata

Release files for mcp-example-server1 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-example-server1 0.1.0
File Size Uploaded
mcp_example_server1-0.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-example-server1 0.1.0
File Interpreter ABI Platform
mcp_example_server1-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.3 kB

Release files / mcp_example_server1-0.1.0.tar.gz

Download URL mcp_example_server1-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4deb919a686181d6a2cbbe36f838d94aca936f3c4fb8683456a3facbe2a06232
BLAKE2b-256 checksum
How to use checksums
e50769b0711628818da89f1d5a3cd8682ea3bae1d44cec6eb06f8bd11971d54e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Release files / mcp_example_server1-0.1.0-py3-none-any.whl

Download URL mcp_example_server1-0.1.0-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f343d91495ed16594c6d96d127c402a193bbff600da858bbe04e5d0b1e446d0e
BLAKE2b-256 checksum
How to use checksums
a6a1def41ae41dda0b67fbe4415eee9deb85e49a7eb9febb5f31fb6ea6dde150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page