MCP server providing comprehensive character and text analysis tools for LLMs
npm install mcp-character-toolsA comprehensive MCP (Model Context Protocol) server providing character and text analysis tools to help LLMs work with individual characters—something they struggle with due to tokenization.
Large Language Models tokenize text into subwords, not individual characters. For example, "strawberry" might become tokens like ["straw", "berry"], so the model never truly "sees" individual letters. This MCP server gives LLMs "character-level vision" through a suite of tools.
``bash`
npx mcp-character-tools
`bash`
npm install -g mcp-character-tools
mcp-character-tools
`bash`
git clone https://github.com/Aaryan-Kapoor/mcp-character-tools
cd mcp-character-tools
npm install
npm run build
npm start
Add to your Claude Desktop configuration (claude_desktop_config.json):
`json`
{
"mcpServers": {
"char-tools": {
"command": "npx",
"args": ["mcp-character-tools"]
}
}
}
#### count_letter
Count occurrences of a specific letter in text.
``
Input: { "text": "strawberry", "letter": "r" }
Output: { "count": 3, "positions": [2, 5, 8], "visual": "...", "density": "3 out of 10 (30.0%)" }
#### count_letters
Count multiple letters at once.
``
Input: { "text": "strawberry", "letters": ["r", "s", "e"] }
Output: { "results": [{ "letter": "r", "count": 3 }, { "letter": "s", "count": 1 }, { "letter": "e", "count": 1 }], "total_matches": 5 }
#### count_substring
Count occurrences of a substring/pattern.
``
Input: { "text": "banana", "substring": "ana", "overlapping": true }
Output: { "count": 2, "positions": [1, 3] }
#### letter_frequency
Get frequency distribution of all characters.
``
Input: { "text": "mississippi" }
Output: { "frequency": { "i": 4, "s": 4, "p": 2, "m": 1 }, "most_common": [...] }
#### spell_word
Break text into individual characters with optional indices.
``
Input: { "text": "cat", "include_indices": true }
Output: { "characters": ["c", "a", "t"], "spelled_out": "0:'c', 1:'a', 2:'t'" }
#### char_at
Get character at a specific index (supports negative indices).
``
Input: { "text": "hello", "index": -1 }
Output: { "character": "o" }
#### nth_character
Get the nth character (1-based, human-friendly).
``
Input: { "text": "hello", "position": 2 }
Output: { "character": "e", "description": "The 2nd character of 'hello' is 'e'." }
#### word_length
Get exact length with detailed breakdown.
``
Input: { "text": "hello world" }
Output: { "length": 11, "length_without_spaces": 10, "space_count": 1, "word_count": 2 }
#### reverse_text
Reverse text and detect palindromes.
``
Input: { "text": "racecar" }
Output: { "reversed": "racecar", "is_palindrome": true }
#### compare_texts
Compare letter frequencies between two texts.
``
Input: { "text1": "hello", "text2": "world" }
Output: { "common_characters": ["l", "o"], "unique_to_text1": ["h", "e"], "similarity_score": 25 }
#### analyze_sentence
Word-by-word breakdown for a specific letter.
``
Input: { "text": "The strawberry was very ripe", "letter": "r" }
Output: { "words": [{ "word": "The", "letter_count": 0 }, { "word": "strawberry", "letter_count": 3 }, ...], "total_count": 5 }
#### batch_count
Count a letter across multiple words at once.
``
Input: { "words": ["strawberry", "raspberry", "blueberry"], "letter": "r" }
Output: { "results": [{ "word": "strawberry", "count": 3 }, ...], "total_count": 6 }
#### get_tricky_words
Get list of commonly miscounted words.
``
Output: List of words like "strawberry", "mississippi", "occurrence" with correct counts and explanations of common mistakes.
#### check_tricky_word
Check if a word is commonly miscounted.
``
Input: { "word": "strawberry" }
Output: { "is_tricky": true, "entries": [{ "letter": "r", "count": 3, "common_mistake": 2, "explanation": "..." }] }
| Tool | Description |
|------|-------------|
| count_letter | Count a specific letter |count_letters
| | Count multiple letters at once |count_substring
| | Count substring occurrences |letter_frequency
| | Get frequency distribution |spell_word
| | Break into characters |char_at
| | Get character at index |nth_character
| | Get nth character (1-based) |word_length
| | Get exact length |reverse_text
| | Reverse text, detect palindromes |compare_texts
| | Compare two texts |analyze_sentence
| | Word-by-word breakdown |batch_count
| | Count across multiple words |get_tricky_words
| | List commonly miscounted words |check_tricky_word
| | Check if word is tricky |
`bashInstall dependencies
npm install
Testing
The project includes comprehensive tests for all tools:
`bash
npm test
`Test files:
-
tests/counting.test.ts - Counting tools tests
- tests/spelling.test.ts - Spelling tools tests
- tests/analysis.test.ts - Analysis tools tests
- tests/tricky-words.test.ts - Tricky words resource tests
- tests/visualization.test.ts` - Visualization utility testsMIT