Token导航 LogoToken导航TokenDH.com
duck MCP logo
AI代理stdio官方级别未说明来源级核验

duck MCP

MCP Server

一个基于FastMCP构建的简单模型上下文协议服务器,提供选项选择、信息提供和手动测试请求等功能。

工具数

3

提示词数

0

GitHub Stars

1

资源数

0
FastMCP服务器工具PythonClaudeClaude DesktopClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

theddnc

提供方

theddnc

最后核验

2026/5/17 20:23

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e .

详细介绍

Duck MCP服务器🦆

一个简单的MCP(模型上下文协议)服务器 FastMCP.

特性

此服务器提供以下工具:

  • 选择选项:要求用户从提供的选项中选择一个选项(使用启发)
  • 提供信息:以自然语言向用户请求更多信息(使用启发)
  • 请求手动测试:要求用户进行手动测试并报告结果(使用启发)

安装

先决条件

  • Python 3.10或更高版本
  • 紫外线 (推荐)或pip

再进行

使用紫外线(推荐):

uv sync

使用pip:

pip install -e .

用法

运行服务器

使用FastMCP CLI(推荐):

# Run with default configuration from fastmcp.json
fastmcp run

# Or specify the config file explicitly
fastmcp run fastmcp.json

# Run with HTTP transport for testing
fastmcp run --transport http --port 8000

直接使用Python:

python server.py

使用紫外线运行:

uv run fastmcp run server.py

发展模式

使用FastMCP检查器UI运行:

fastmcp dev

检查服务器功能

查看所有可用的工具、资源和提示:

fastmcp inspect

安装到MCP客户端

克劳德桌面

fastmcp install claude-desktop

光标

fastmcp install cursor

克劳德代码(VS代码扩展)

fastmcp install claude-code

测试

您可以使用FastMCP客户端测试服务器:

import asyncio
from fastmcp import Client

async def test_server():
    async with Client("http://localhost:8000/mcp") as client:
        # Ping the server to check connectivity
        await client.ping()
        print("Server is running!")

if __name__ == "__main__":
    asyncio.run(test_server())

测试启发式工具

select_option, provide_information,以及 request_manual_test 工具使用FastMCP的启发功能以交互方式向用户请求信息:

import asyncio
from fastmcp import Client

async def elicitation_handler(message: str, response_type: type, params, context):
    """Handler that responds to server's elicitation requests"""
    print(f"Server asks: {message}")
    user_input = input("Your response: ")
    return response_type(selected_option=user_input) if hasattr(response_type, '__annotations__') and 'selected_option' in response_type.__annotations__ else response_type(information=user_input)

async def test_elicitation():
    async with Client("http://localhost:8000/mcp", elicitation_handler=elicitation_handler) as client:
        # Test select_option tool
        result = await client.call_tool("select_option", {
            "question": "What's your favorite programming language?",
            "options": ["Python", "JavaScript", "Rust", "Go"]
        })
        print(result.data)
        
        # Test provide_information tool
        result = await client.call_tool("provide_information", {
            "question": "What would you like to build today?"
        })
        print(result.data)
        
        # Test request_manual_test tool
        result = await client.call_tool("request_manual_test", {
            "test_description": "Navigate to the login page and verify the form renders correctly",
            "expected_outcome": "Login form should display username/password fields and submit button"
        })
        print(result.data)

if __name__ == "__main__":
    asyncio.run(test_elicitation())

项目结构

duck-mcp/
├── server.py          # Main server implementation
├── fastmcp.json       # FastMCP configuration
├── pyproject.toml     # Project metadata and dependencies
├── README.md          # This file
└── tests/            # Test files (optional)

发展

添加新工具

要向服务器添加新工具,只需用以下内容装饰功能 @mcp.tool:

@mcp.tool
def my_new_tool(arg1: str, arg2: int) -> str:
    """Description of what this tool does"""
    # Your implementation here
    return "result"

运行测试

pytest

部署

本地部署

默认情况下,服务器使用stdio传输运行,使其与Claude Desktop等本地MCP客户端兼容。

HTTP部署

对于远程访问,请使用HTTP传输运行:

fastmcp run --transport http --host 0.0.0.0 --port 8000

FastMCP云

部署到FastMCP Cloud进行托管(需要帐户):

fastmcp cloud deploy

配置

fastmcp.json 文件包含服务器配置:

  • 来源:服务器代码的位置和入口点
  • 环境:Python版本和依赖关系
  • 部署:运行时配置(传输、日志记录等)

您可以通过CLI参数覆盖任何配置:

fastmcp run --port 8080 --log-level DEBUG

MCP客户端配置

要将此MCP服务器与MCP兼容的客户端(如Claude Desktop)一起使用,请将以下配置添加到客户端的 mcp.json 文件:

使用紫外线(推荐):

{
  "mcpServers": {
    "duck-mcp": {
      "command": "uv",
      "args": ["run", "fastmcp", "run", "server.py"],
      "cwd": "/path/to/duck-mcp"
    }
  }
}

直接使用Python:

{
  "mcpServers": {
    "duck-mcp": {
      "command": "python",
      "args": ["server.py"],
      "cwd": "/path/to/duck-mcp"
    }
  }
}

替换 /path/to/duck-mcp 带有duck mcp目录的实际路径。这 cwd (当前工作目录)确保服务器从正确的位置运行。

了解更多

许可证

麻省理工学院

目录标签

目录标签

FastMCP服务器工具PythonClaude本地部署模型上下文协议交互式请求开发辅助

支持客户端

Claude DesktopClaudeCursor

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosession部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP