MiaoMcp

MiaoMcp

Integrates local FastMCP tools and multiple remote MCP services into Xiaozhi, providing calculator and current time utilities.

Category
Visit Server

README

MiaoMcp

将本地 FastMCP 工具和任意数量的远程 MCP 服务同时接入小智。目前本地提供:

  • calculator.calculate:安全计算基础算术表达式;
  • time.get_current:查询指定 IANA 时区的当前日期和时间,默认北京时间。

每个启用的 MCP Server 都拥有独立的 WebSocket 连接、进程和重连循环。一个远程服务故障不会阻塞其他服务。

配置

编辑根目录下被 Git 忽略的 mcp_config.json:

{
  "xiaozhi": {
    "endpoint": "wss://小智后台生成的完整接入点URL"
  },
  "mcpServers": {
    "miaomcp-local": {
      "type": "stdio",
      "command": "miaomcp-server"
    },
    "modelscope-weather": {
      "type": "sse",
      "url": "https://mcp.api-inference.modelscope.net/服务ID一/sse"
    },
    "modelscope-search": {
      "type": "sse",
      "url": "https://mcp.api-inference.modelscope.net/服务ID二/sse"
    }
  }
}

在 mcpServers 中继续添加条目即可接入更多服务。支持的类型:

  • stdio:本地 MCP 命令;
  • sse:远程 SSE MCP,自动通过 mcp-proxy 转换;
  • streamablehttp 或 http:远程 Streamable HTTP MCP;
  • 设置 "disabled": true 可临时停用某项。

需要请求头的服务可以配置:

{
  "type": "sse",
  "url": "https://example.com/sse",
  "headers": {
    "Authorization": "Bearer token"
  }
}

mcp_config.json 和其中的 URL、token 都不应提交。可提交模板见 mcp_config.example.json。

运行

uv sync
uv run miaomcp

指定其他配置文件:

uv run miaomcp --config /path/to/mcp_config.json

仅启动本地 stdio 工具服务:

uv run miaomcp-server

添加本地工具

在 src/miaomcp/tools/ 中编写业务函数,然后在 src/miaomcp/server.py 使用 @mcp.tool() 注册。不需要修改网关或配置。

项目结构

src/miaomcp/
├── cli.py                  命令行入口
├── server.py               本地 FastMCP 服务及工具注册
├── gateway/
│   ├── config.py           配置模型、加载与校验
│   ├── commands.py         stdio 与远程代理命令构造
│   ├── bridge.py           单个 MCP 与小智的双向桥接
│   └── manager.py          多服务并发和断线重连
└── tools/
    ├── calculator.py       安全计算器
    └── current_time.py     时区时间查询

tests/                      按模块组织的测试
mcp_config.example.json     可提交的配置模板
mcp_config.json             本地敏感配置,Git 忽略
pyproject.toml              项目元数据、依赖和命令入口

测试

uv run python -m unittest discover -s tests -v

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured