QV

qpd-v/mcp-wordcounter

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

10 stars 6 forks 质量 57 趋势 8Apache-2.0

A Model Context Protocol server for analyzing text documents with word and character counting capabilities

概览

A Model Context Protocol server that provides tools for analyzing text documents, including counting words and characters. This server helps LLMs perform text analysis tasks by exposing simple document statistics functionality. - Count words in documents - Count total characters (including spaces) - Count characters excluding spaces - Process files directly without exposing content to LLMs Add to your Claude Desktop configuration (claude_desktop_config.json): Counts words and characters in a text document. Parameters: - filePath (string, required): Path to the text file to analyze Returns: - Word count - Character count (including spaces) - Character count (excluding spaces) MIT License - see LICENSE file for details. Contributions are welcome! Please feel free to submit a Pull Request.

README

MCP Word Counter

A Model Context Protocol server that provides tools for analyzing text documents, including counting words and characters. This server helps LLMs perform text analysis tasks by exposing simple document statistics functionality.

Features

  • Count words in documents
  • Count total characters (including spaces)
  • Count characters excluding spaces
  • Process files directly without exposing content to LLMs

Installation

npm install mcp-wordcounter

Usage

As a CLI tool

npx mcp-wordcounter

In Claude Desktop

Add to your Claude Desktop configuration (claude_desktop_config.json):

{
  "mcpServers": {
    "mcp-wordcounter": {
      "command": "npx",
      "args": ["-y", "mcp-wordcounter"],
      "alwaysAllow": ["analyze_text"]
    }
  }
}

Available Tools

analyze_text

Counts words and characters in a text document.

Parameters:

  • filePath (string, required): Path to the text file to analyze

Returns:

  • Word count
  • Character count (including spaces)
  • Character count (excluding spaces)

Example response:

{
  "content": [{
    "type": "text",
    "text": "Analysis Results:\n• Word count: 150\n• Character count (including spaces): 842\n• Character count (excluding spaces): 702"
  }]
}

Development

# Install dependencies
npm install

# Build the project
npm run build

# Run in watch mode during development
npm run watch

# Test with MCP Inspector
npm run inspector

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

在 GitHub 查看完整 README

安装

npx -y mcp-wordcounter
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp-wordcounter": { "command": "npx", "args": ["-y", "mcp-wordcounter"], "alwaysAllow": ["analyze_text"] } } }