Skip to main content

A simple MCP (Model Context Protocol) server demo

Project description

MCP Demo

一个简单的MCP (Model Context Protocol) 服务器演示包,可以通过Trae AI IDE使用。

功能特性

这个MCP服务器提供了三个简单的工具:

  1. echo - 回显输入的文本
  2. add - 计算两个数字的和
  3. greet - 生成多语言个性化问候语(支持中文、英文、法文、西班牙文)

安装

从PyPI安装

pip install mcp-demo

从源码安装

git clone https://github.com/yourusername/mcp-demo.git
cd mcp-demo
pip install -e .

在Trae中使用

  1. 安装包后,在Trae的MCP配置文件中添加以下配置:
{
  "mcpServers": {
    "yashuashua-mcp-server": {
      "command": "python",
      "args": ["-m", "mcp_demo_yashuashua.server"]
    }
  }
}

或者如果你已经安装了包:

{
  "mcpServers": {
    "mcp-demo": {
      "command": "mcp-demo"
    }
  }
}
  1. 重启Trae,你就可以在对话中使用这些工具了!

使用示例

在Trae中,你可以这样使用:

  • "帮我回显一下'Hello World'"
  • "计算 15 + 27 的结果"
  • "用法语向Alice问好"

开发

本地开发环境设置

# 克隆仓库
git clone https://github.com/yourusername/mcp-demo.git
cd mcp-demo

# 安装开发依赖
pip install -e ".[dev]"

# 运行测试
pytest

构建和发布

# 构建包
python -m build

# 发布到PyPI(需要先配置PyPI凭据)
twine upload dist/*

许可证

MIT License - 详见 LICENSE 文件。

贡献

欢迎提交Issue和Pull Request!

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

yashuashua_mcp_server-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

yashuashua_mcp_server-0.1.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file yashuashua_mcp_server-0.1.1.tar.gz.

File metadata

  • Download URL: yashuashua_mcp_server-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.5

File hashes

Hashes for yashuashua_mcp_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5104085905962b86e6d33863a6d89a27d1bdbbd8856e1d7db28f35b111e5a409
MD5 19b44934d7b362edd73d01cda2f82acd
BLAKE2b-256 9d0703f6482a2e74c967c0ba13e0c01f3a4d7c0a8ebd13edf5df373e0acfd352

See more details on using hashes here.

File details

Details for the file yashuashua_mcp_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for yashuashua_mcp_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5295636617b88cb7bf446e848b3ff913f93e9c319df2d89816520f2a5005813
MD5 665fb1da17ff4572c379f31960888ea8
BLAKE2b-256 b726a4ca208e09a03d33f37b19782976bb5139b95f34d9df0975883aedac623d

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