Skip to main content
Glama

mcp-grammar-checker

一个小型 MCP 服务器,将 LanguageTool 的语法和风格检查作为工具暴露出来,使 MCP 客户端(Claude Code、Claude Desktop 或任何其他兼容 MCP 的主机)可以直接检查文本问题。

为什么

构建目的是为 AI 编码助手提供一种真实的、由工具支持的语法/风格检查方式——而不是仅依赖模型自身的判断——同时为 Solution Architect AI 应用动手学习 MCP。

Related MCP server: Writing Tools MCP Server

构建过程说明

最初手工构建(直接针对官方 mcp SDK,通过检查已安装的包来发现其当前 API,而不是遵循教程)。后来按照 Anthropic 官方 mcp-server-dev:build-mcp-server 技能的引导流程重新构建,该流程确认了部署选择(本地 stdio——这是一个单用户个人工具,并非用于分发),但改变了框架:它推荐使用 FastMCP 3.x(PyPI 上的 fastmcp 包,作者为 jlowin)来编写 Python 服务器,而不是 mcp SDK 中捆绑的冻结版 FastMCP 1.0。本仓库现在反映的是第二次、引导式的构建过程。

工具

check_grammar(text: str, language: str = "de-DE") -> str

使用公共 LanguageTool API 检查给定文本,并返回格式化的问题列表(消息、建议的替换、周围上下文),如果没有发现问题则返回确认信息。

设置

需要 Python 3.12+ 和 uv。

git clone <this-repo>
cd mcp-grammar-checker
uv sync

独立运行

uv run python server.py

服务器通过 stdio 通信,期望由 MCP 客户端启动,而不是交互式运行。

与 Claude Code / Claude Desktop 一起使用

添加到你的 MCP 配置中(例如 .claude/settings.json 或 Claude Desktop 配置文件):

{
  "mcpServers": {
    "grammar-checker": {
      "command": "uv",
      "args": ["run", "--directory", "/absolute/path/to/mcp-grammar-checker", "python", "server.py"]
    }
  }
}

重启客户端,check_grammar 工具即可使用。

注意事项

  • 使用公共 LanguageTool API(api.languagetool.org),该 API 有速率限制。对于更重的使用场景,LanguageTool 可以自托管。

  • 通过 language 参数支持 LanguageTool 支持的任何语言(例如 en-US、de-DE、fr)。

Available Tools

1 tool
check_grammarB

Check text for grammar, spelling, and style issues using LanguageTool.

Inputs: text (required), language. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only a single tool, there is no possibility of ambiguity or misselection. The purpose is clearly singular and distinct.

    Naming Consistency5/5

    There is only one tool, so the naming is trivially consistent. The verb-noun pattern ('check_grammar') is clear and follows a predictable convention.

    Tool Count3/5

    A single tool feels thin for a server, though the scope is narrow (grammar checking). It is borderline per the calibration, likely sufficient for its stated purpose but minimal.

    Completeness5/5

    The tool covers grammar, spelling, and style checking, which appears to be the entire domain. There are no obvious missing operations for a grammar-checking service.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP server offering text analysis tools for writing improvement, including spellcheck, readability, keyword analysis, passive voice detection, and AI-generated content detection.
      11
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A professional MCP server for analyzing content against the official Microsoft Writing Style Guide, enabling style, grammar, terminology, and accessibility checks via AI tools like VS Code and GitHub Copilot.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      This MCP server provides direct access to ruff linting, formatting checks, and ty type-checking for Python projects, with token-efficient, structured output.
      9
      MIT