Skip to main content
Glama

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 转换;

  • streamablehttphttp:远程 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

Related MCP server: FastMCP Tools Calculator

运行

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

Available Tools

2 tools
calculator.calculateA

计算一个基础算术表达式。当用户询问加减乘除、取模或乘方结果时调用。expression 示例:(12.5 + 7.5) * 2。仅计算,不执行代码。

ParametersJSON Schema
NameRequiredDescriptionDefault
expressionYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses a key safety behavior: '仅计算,不执行代码' (only calculate, not execute code), which is critical for a tool that takes an expression string. However, it does not mention edge cases like division by zero or error handling, though the output schema likely covers return format. This is good but not exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three concise sentences, each serving a distinct purpose: statement of function, usage trigger, and an example plus safety note. It is front-loaded with the core action and contains no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (one parameter, output schema present, unrelated sibling), the description is complete. It covers purpose, usage, parameter format with an example, and a critical behavioral limitation. There is no missing information that would prevent a correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, so the description must compensate fully. It does so by providing an example of the expression parameter: '(12.5 + 7.5) * 2', and listing supported operators. This gives the agent a clear format and scope for the parameter, going beyond the schema's bare type definition.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '计算一个基础算术表达式' (calculate a basic arithmetic expression), with specific operations listed (加减乘除, 取模, 乘方). It also provides a concrete example. The sibling tool time.get_current is completely unrelated, so differentiation is clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use the tool: '当用户询问加减乘除、取模或乘方结果时调用' (call when the user asks for results of addition, subtraction, multiplication, division, modulo, or exponentiation). It also gives a when-not: '仅计算,不执行代码' (only calculate, do not execute code), clarifying it should not be used for code execution.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

time.get_currentA

获取指定时区的当前日期和时间。当用户询问现在几点、今天日期或星期时调用。timezone 使用 IANA 名称,例如 Asia/Shanghai;省略时默认北京时间。

ParametersJSON Schema
NameRequiredDescriptionDefault
timezoneNoAsia/Shanghai

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.8/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden of behavioral disclosure. It explains the timezone format and default, implying a read-only operation. However, it doesn't explicitly state that the operation has no side effects or mention error handling for invalid timezones, leaving a slight gap. The nature of the tool (getting current time) makes this less critical.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences long, with no unnecessary words. It front-loads the core purpose, then adds usage guidelines and parameter details in a logical order. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simplicity of the tool (one optional parameter), the description is complete. The output schema exists to describe the return value, so the description needn't elaborate. It covers when to use, how to use, and the default behavior thoroughly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema provides just the parameter name and default. The description adds crucial semantics: it explains what IANA names are, gives an example, and clarifies the default as Beijing time. This fully compensates for the zero schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb ('获取') and resource ('指定时区的当前日期和时间'), distinguishing it from the sibling calculator tool. It also provides usage context, making the purpose unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly tells when to use the tool ('当用户询问现在几点、今天日期或星期时调用'), and even specifies the parameter format and default behavior. This is clear guidance with no alternative tools mentioned, but that's fine because the sibling is unrelated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv0.1.0
    • First observedcalculator.calculate
    • First observedtime.get_current

TDQS

A4.6/5.0

Scored across 2 tools

Disambiguation5/5

The two tools, calculator.calculate and time.get_current, target entirely distinct domains: arithmetic and time information. There is no overlap or ambiguity between them.

Naming Consistency5/5

Both tool names follow the same 'domain.action' pattern with snake_case: calculator.calculate and time.get_current. This is consistent and predictable.

Tool Count3/5

With only 2 tools, the server feels minimal but appropriate for a small utility purpose. It is borderline thin but not unreasonably so.

Completeness4/5

For a simple calculator/time server, the basic operations are covered. Minor gaps exist (e.g., timezone conversion or date arithmetic), but the core use cases are addressed.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A demonstration MCP server that provides calculator functionality through both stdio and FastAPI implementations. Enables users to perform mathematical calculations via MCP tools using the FastMCP framework.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server providing 150+ mathematical functions across arithmetic, trigonometry, statistics, unit conversions, and more, consolidated into 15 powerful tools for seamless integration with VS Code Copilot and other MCP-compatible clients.
    MIT