mcp-micro-tools

mcp-micro-tools

Provides a set of micro-tools (time calculation, regex, encoding, JSON diff, etc.) for LLM agents to handle deterministic, precision tasks that models often get wrong.

Category
Visit Server

README

mcp-micro-tools

<div align="center">

Agent 的瑞士军刀 —— 把 LLM 不擅长的微任务交给它

PyPI MCP Python

</div>


为什么需要这个?

大模型在处理自然语言时很强,但有些"精确计算"类的任务经常出错:

任务 模型表现 mcp-micro-tools
"3月15日 + 45个工作日是哪天" 经常算错 time_calc("2026-03-15 + 45 days")
复杂正则提取 编造正则、幻觉匹配 regex_test() 真实 Python re 引擎 ✅
Base64 解码 偶尔编造内容 decode() 精确计算 ✅
URL query 参数提取 可能遗漏 url_parse() 结构化输出 ✅
JSON 深度对比 100行以上必丢字段 json_diff() 递归精确对比 ✅

一句话:把确定性计算还给工具,把不确定性推理留给模型。


安装

pip install mcp-micro-tools

需要 Python 3.10+。


配置 AI Agent

Claude Code / Claude Desktop

{
  "mcpServers": {
    "micro-tools": {
      "command": "python",
      "args": ["-m", "mcp_micro_tools.server"]
    }
  }
}

Codex / Cursor / Continue

{
  "mcpServers": {
    "micro-tools": {
      "command": "python",
      "args": ["-m", "mcp_micro_tools.server"]
    }
  }
}

OpenClaw

openclaw.json 中添加:

{
  "mcp_servers": [
    {
      "name": "micro-tools",
      "command": "python",
      "args": ["-m", "mcp_micro_tools.server"]
    }
  ]
}

工具列表

工具 功能 示例
time_calc 日期时间运算 "now + 3 weeks - 1 day"
timezone_convert 时区转换 UTC → Asia/Shanghai
regex_test 正则测试(findall/search/match/split) 提取所有邮箱
regex_replace 正则替换 格式化电话号码
encode 编码 base64 / URL / hex / HTML
decode 解码 base64 / URL / hex / HTML
json_query JSON 路径查询 users.0.email
json_diff JSON 深度对比 递归找出所有差异
url_parse URL 解析 scheme / host / path / query
hash_text 哈希计算 md5 / sha1 / sha256 / sha512
generate_uuid UUID 生成 单个或批量

使用示例

场景 1:时间计算

User: "合同签于 2026-03-15,90 个工作日后是哪天?"

Agent 调用 → time_calc("2026-03-15 + 90 days")
结果 → 2026-06-13T00:00:00

场景 2:正则提取

User: "从这段日志里提取所有 IP 地址"

Agent 调用 → regex_test("\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}", log_text)
结果 → ["192.168.1.1", "10.0.0.5", ...]

场景 3:JSON 对比

User: "对比这两个 API 返回的 JSON,看看少了什么字段"

Agent 调用 → json_diff(api_response_a, api_response_b)
结果 → {"users[2].email": {"removed": "..."}, "metadata.version": {"changed": {...}}}

场景 4:编码解码

User: "这段 Base64 解码出来是什么?"

Agent 调用 → decode("SGVsbG8gV29ybGQ=", "base64")
结果 → Hello World

设计哲学

  1. 零依赖(核心):除 mcppython-dateutil 外,只用 Python 标准库
  2. 单文件:核心逻辑一个 server.py,方便审查和 fork
  3. 无状态:每次调用独立,不存任何数据
  4. 静默输出:只返回结果,不废话

扩展

欢迎贡献更多微工具。一个好的微工具满足:

  • LLM 天然不擅长(精确计算、结构化操作)
  • 输入输出明确(可 JSON 序列化)
  • 单次调用完成(无状态)

PR 直接开,README 底部留个 Credits 就够。


License

MIT


相关项目

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
Qdrant Server

Qdrant Server

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

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