Back to MCP directory
publicPublicdnsLocal runtime

mcp-character-tools

MCP字符工具是一个为大型语言模型提供字符级文本分析能力的服务器,解决LLM因分词而难以处理单个字符的问题,提供14+种字符计数、拼写分析和文本比较工具。

article

README

🚀 MCP 字符工具

MCP 字符工具是一款强大的工具,为大语言模型(LLM)提供 14 种以上全面且实用的字符和文本分析工具。它能帮助大语言模型解决因分词机制而难以处理单个字符的问题,让模型具备“字符级视觉”。

🚀 快速开始

该工具可通过多种方式安装,以下为您详细介绍:

Via npx(推荐)

npx mcp-character-tools

Via npm(全局安装)

npm install -g mcp-character-tools
mcp-character-tools

从源代码安装

git clone https://github.com/Aaryan-Kapoor/mcp-character-tools
cd mcp-character-tools
npm install
npm run build
npm start

✨ 主要特性

  • 精准字符分析:能够准确统计特定字母、子字符串的出现次数,以及获取字母频率分布等。
  • 丰富文本处理:支持文本反转、比较、逐词分析等多种操作。
  • 解决分词难题:帮助大语言模型克服分词机制带来的单个字符处理困难。

📦 安装指南

Via npx(推荐)

npx mcp-character-tools

Via npm(全局安装)

npm install -g mcp-character-tools
mcp-character-tools

从源代码安装

git clone https://github.com/Aaryan-Kapoor/mcp-character-tools
cd mcp-character-tools
npm install
npm run build
npm start

💻 使用示例

与 Claude Desktop 配合使用

将以下内容添加到您的 Claude Desktop 配置文件(claude_desktop_config.json)中:

{
  "mcpServers": {
    "char-tools": {
      "command": "npx",
      "args": ["mcp-character-tools"]
    }
  }
}

📚 详细文档

所有工具参考

请查看 sample_outputs.md 以获取所有 14 种以上工具的完整输入输出示例。

| 工具 | 描述 | |------|-------------| | count_letter | 统计特定字母的数量 | | count_letters | 一次性统计多个字母的数量 | | count_substring | 统计子字符串的出现次数 | | letter_frequency | 获取字母频率分布 | | spell_word | 将单词拆分为字符 | | char_at | 获取指定索引处的字符 | | nth_character | 获取第 n 个字符(从 1 开始计数) | | word_length | 获取单词的准确长度 | | reverse_text | 反转文本,检测回文 | | compare_texts | 比较两个文本 | | analyze_sentence | 逐词分析句子 | | batch_count | 统计多个单词中的字符 | | get_tricky_words | 列出常见的易统计错误的单词 | | check_tricky_word | 检查单词是否为易统计错误的单词 |

🔧 技术细节

开发

# 安装依赖
npm install

# 构建项目
npm run build

# 运行测试
npm test

# 运行带覆盖率的测试
npm run test:coverage

# 开发模式,自动重建
npm run dev

测试

该项目为所有工具提供了全面的测试:

npm test

测试文件:

  • tests/counting.test.ts - 计数工具测试
  • tests/spelling.test.ts - 拼写工具测试
  • tests/analysis.test.ts - 分析工具测试
  • tests/tricky-words.test.ts - 易统计错误单词资源测试
  • tests/visualization.test.ts - 可视化工具测试

📄 许可证

本项目采用 MIT 许可证。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client