关于 miguelgarzons-mcp-cun
这是一个基于 Python 和 FastMCP 的入门 MCP 服务,演示如何统计文本中指定字符的出现次数,适合开发者用 Smithery 测试服务。
主要功能
- 01统计字符在文本中的出现次数
- 02通过 Smithery 本地运行
- 03在 Smithery Playground 中测试
适用场景
- 01查看某字符在文本中的频次
- 02在 Playground 中试用 MCP 工具
MCP 相关
它向 MCP 客户端提供 `count_character` 工具。README 介绍了本地运行服务并通过 Smithery Playground 测试。
配置
远程服务无需本地安装。选择你使用的客户端,复制配置或使用一键安装。
服务地址
https://server.smithery.ai/@miguelgarzons/mcp-cun/mcp一键复制安装命令
Claude CodeTerminal
claude mcp add --transport http ai-smithery-miguelgarzons-mcp-cun https://server.smithery.ai/@miguelgarzons/mcp-cun/mcpCursor.cursor/mcp.json
{"mcpServers":{"ai-smithery-miguelgarzons-mcp-cun":{"type":"http","url":"https://server.smithery.ai/@miguelgarzons/mcp-cun/mcp"}}}在 Cursor 中打开VS Code.vscode/mcp.json
{"servers":{"ai-smithery-miguelgarzons-mcp-cun":{"type":"http","url":"https://server.smithery.ai/@miguelgarzons/mcp-cun/mcp"}}}在 VS Code 中打开Claude Desktopclaude_desktop_config.json
{"mcpServers":{"ai-smithery-miguelgarzons-mcp-cun":{"type":"http","url":"https://server.smithery.ai/@miguelgarzons/mcp-cun/mcp"}}}Windsurf~/.codeium/windsurf/mcp_config.json
{"mcpServers":{"ai-smithery-miguelgarzons-mcp-cun":{"serverUrl":"https://server.smithery.ai/@miguelgarzons/mcp-cun/mcp"}}}命令在终端中运行;JSON 粘贴到对应客户端的 MCP 配置后重启。需要授权的服务会在首次连接时提示登录。
全部服务地址
Streamable HTTP
https://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)
快速开始
-
克隆代码库:
git clone https://github.com/smithery-ai/smithery-cookbook.git cd smithery-cookbook/servers/python/quickstart -
安装依赖:
使用 uv(推荐):
uv sync使用 poetry:
poetry install使用 pip:
pip install -r requirements.txt -
运行服务:
有两种方式:
选项 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?”
- 部署到 Smithery:
要部署 MCP 服务:
- 将代码推送到 GitHub(确保包含
smithery.yaml) - 在 https://smithery.ai/new 连接你的代码库
- 将代码推送到 GitHub(确保包含
你的服务将通过 HTTP 提供,并可供任何兼容 MCP 的客户端使用!
停止服务
在终端中按 Ctrl+C 停止服务。
评论
支持 Markdown
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。