Back to MCP directory
publicPublicdnsLocal runtime

mcp_gitbook

一个使用Python MCP SDK和FastMCP实现的简单MCP服务器示例

article

README

🚀 MCP 服务器示例

本项目是一个简单的 MCP (Model Context Protocol) 服务器,通过 Python MCP SDK 和 FastMCP 实现,为相关开发提供了基础示例。

🚀 快速开始

📦 安装指南

使用 uv 安装依赖:

uv add "mcp[cli]" requests python-dotenv

💻 运行服务器

运行服务器:

python src/mcp_gitbook/main.py

💻 使用示例

基础用法

本项目提供了一个名为 example_tool 的示例工具,该工具可回显一条消息。以下是该工具的输入方案和示例用法:

输入方案

{
    "type": "object",
    "properties": {
        "message": {
            "type": "string", 
            "description": "要回显的消息"
        }
    },
    "required": ["message"]
}

示例用法

{
    "method": "call_tool",
    "params": {
        "name": "example_tool",
        "arguments": {
            "message": "你好,MCP!"
        }
    }
}
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client