Skip to main content
Glama
qpd-v

MCP Word Counter

by qpd-v
README.md
# 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

```bash
npm install mcp-wordcounter
```

## Usage

### As a CLI tool

```bash
npx mcp-wordcounter
```

### In Claude Desktop

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

```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:
```json
{
  "content": [{
    "type": "text",
    "text": "Analysis Results:\n• Word count: 150\n• Character count (including spaces): 842\n• Character count (excluding spaces): 702"
  }]
}
```

## Development

```bash
# 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.

TDQS

B3.1/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools. The tool 'analyze_text' has a single, clearly defined purpose of counting words and characters, so an agent cannot misselect between non-existent alternatives.

Naming Consistency5/5

A single tool inherently has perfect naming consistency, as there are no other tools to compare it against. The name 'analyze_text' follows a clear verb_noun pattern, which would be consistent if more tools were added.

Tool Count2/5

The server 'MCP Word Counter' has only one tool, which feels thin for its apparent scope of text analysis. While word and character counting is a specific task, a typical text analysis server might include additional tools (e.g., for sentiment, readability, or language detection) to provide more comprehensive functionality.

Completeness2/5

The tool set is severely incomplete for a text analysis domain. It only covers basic word and character counting, with obvious gaps such as sentence counting, paragraph analysis, frequency analysis, or other common text metrics. This limited surface will likely cause agent failures when more advanced text processing is needed.

Maintenance

ActivityInactive
ResponsivenessNo issues