Skip to main content

一个实现MCP协议的示例服务器

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_example_server1-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_example_server1-0.1.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file mcp_example_server1-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_example_server1-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for mcp_example_server1-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4deb919a686181d6a2cbbe36f838d94aca936f3c4fb8683456a3facbe2a06232
MD5 88d0aba3a71caab5216b6701fd700e9f
BLAKE2b-256 e50769b0711628818da89f1d5a3cd8682ea3bae1d44cec6eb06f8bd11971d54e

See more details on using hashes here.

File details

Details for the file mcp_example_server1-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_example_server1-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f343d91495ed16594c6d96d127c402a193bbff600da858bbe04e5d0b1e446d0e
MD5 ee62da7833a59f0ddc00a9716a4bf6a3
BLAKE2b-256 a6a1def41ae41dda0b67fbe4415eee9deb85e49a7eb9febb5f31fb6ea6dde150

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page