mcpField
M
miguelgarzons-mcp-cun

miguelgarzons-mcp-cun

远程服务
github.com/miguelgarzons开发工具056 周前更新
代码仓库

关于 miguelgarzons-mcp-cun

这是一个基于 Python 和 FastMCP 的入门 MCP 服务,演示如何统计文本中指定字符的出现次数,适合开发者用 Smithery 测试服务。

主要功能

  1. 01统计字符在文本中的出现次数
  2. 02通过 Smithery 本地运行
  3. 03在 Smithery Playground 中测试

适用场景

  1. 01查看某字符在文本中的频次
  2. 02在 Playground 中试用 MCP 工具

MCP 相关

它向 MCP 客户端提供 `count_character` 工具。README 介绍了本地运行服务并通过 Smithery Playground 测试。

配置

远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。

服务地址https://server.smithery.ai/@miguelgarzons/mcp-cun/mcp
一键复制安装命令
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。

全部服务地址
Streamable HTTPhttps://server.smithery.ai/@miguelgarzons/mcp-cun/mcp需要授权

工具

详细介绍

Character Counter MCP Server - Python 快速入门

这是一个使用 FastMCP 和 Python 创建 MCP 服务的简单示例,旨在与 Smithery 配合使用。

功能说明

此服务提供一个名为 count_character 的字符计数工具,用于统计指定字符在给定文本中出现的次数。你将使用 Smithery Playground 进行交互式开发和测试。

前提条件

  • Python 3.12 或更高版本
  • Python 包管理器(推荐使用 uv,也可使用 pip、poetry 等)
  • Node.js 和 npx(可选,用于 Smithery Playground)

快速开始

  1. 克隆代码库:

    git clone https://github.com/smithery-ai/smithery-cookbook.git
    cd smithery-cookbook/servers/python/quickstart
    
  2. 安装依赖:

    使用 uv(推荐):

    uv sync
    

    使用 poetry:

    poetry install
    

    使用 pip:

    pip install -r requirements.txt
    
  3. 运行服务:

    有两种方式:

    选项 A:仅运行服务

    # With uv
    uv run smithery dev
    # or use the shorter script alias:
    uv run dev
    
    # With poetry
    poetry run smithery dev
    # or use the shorter script alias:
    poetry run dev
    
    # With pip (after installing dependencies)
    smithery dev
    

    这会在 http://localhost:8081 启动 MCP 服务并使其持续运行。

    选项 B:运行服务并打开 Playground(推荐用于测试)

    # With uv
    uv run smithery playground
    # or use the shorter script alias:
    uv run playground
    
    # With poetry
    poetry run smithery playground
    # or use the shorter script alias:
    poetry run playground
    
    # With pip (after installing dependencies)
    smithery playground
    

    这会启动 MCP 服务,并在浏览器中自动打开 Smithery Playground,你可以在其中:

    • 与 MCP 服务实时交互
    • 使用不同的文本和字符测试 count_character 工具
    • 查看完整的请求/响应流程
    • 快速调试并迭代 MCP 工具

测试字符计数器

试着询问:“草莓(strawberry)里有几个 r?”

  1. 部署到 Smithery: 要部署 MCP 服务:

你的服务将通过 HTTP 提供,并可供任何兼容 MCP 的客户端使用!

停止服务

在终端中按 Ctrl+C 停止服务。

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。