Content
# Japanese Text Analyzer MCP Server
This is an MCP server that performs morphological analysis of Japanese text. It measures and evaluates the characteristics of sentences from a linguistic perspective, providing feedback for text generation.
<a href="https://glama.ai/mcp/servers/@Mistizz/mcp-JapaneseTextAnalyzer">
<img width="380" height="200" src="https://glama.ai/mcp/servers/@Mistizz/mcp-JapaneseTextAnalyzer/badge" alt="Japanese Text Analyzer MCP server" />
</a>
## Features
- Counts the number of characters in Japanese text (actual character count excluding spaces and line breaks)
- Counts the number of words in Japanese text
- Analyzes detailed linguistic features of Japanese text (average sentence length, part-of-speech ratios, vocabulary diversity, etc.)
- Supports both file paths and direct text input
- Flexible file path resolution (can search using absolute paths, relative paths, or just file names)
## Tools
Currently, the following tools are implemented:
### count-chars
Measures the number of characters in a file. Please specify an absolute path (either Windows format C:\Users\... or WSL/Linux format /c/Users/... is acceptable). Counts the actual number of characters excluding spaces and line breaks.
**Input:**
- `filePath` (string): The path of the file for which to count characters (absolute path in Windows or WSL/Linux format is recommended)
**Output:**
- The number of characters in the file (actual character count excluding spaces and line breaks)
### count-words
Measures the number of words in a file. Please specify an absolute path (either Windows format C:\Users\... or WSL/Linux format /c/Users/... is acceptable). Counts words separated by spaces in English and uses morphological analysis for Japanese.
**Input:**
- `filePath` (string): The path of the file for which to count words (absolute path in Windows or WSL/Linux format is recommended)
- `language` (string, optional, default: "en"): The language of the file (en: English, ja: Japanese)
**Output:**
- The number of words in the file
- In Japanese mode, detailed results of the morphological analysis are also displayed
### count-clipboard-chars
Measures the number of characters in the text. Counts the actual number of characters excluding spaces and line breaks.
**Input:**
- `text` (string): The text for which to count characters
**Output:**
- The number of characters in the text (actual character count excluding spaces and line breaks)
### count-clipboard-words
Measures the number of words in the text. Counts words separated by spaces in English and uses morphological analysis for Japanese.
**Input:**
- `text` (string): The text for which to count words
- `language` (string, optional, default: "en"): The language of the text (en: English, ja: Japanese)
**Output:**
- The number of words in the text
- In Japanese mode, detailed results of the morphological analysis are also displayed
### analyze-text
Performs detailed morphological analysis and linguistic feature analysis of the text. Analyzes sentence complexity, part-of-speech ratios, vocabulary diversity, etc.
**Input:**
- `text` (string): The text to analyze
**Output:**
- Basic information about the text (total character count, number of sentences, total number of morphemes)
- Detailed analysis results (average sentence length, part-of-speech ratios, character type ratios, vocabulary diversity, etc.)
### analyze-file
Performs detailed morphological analysis and linguistic feature analysis of a file. Analyzes sentence complexity, part-of-speech ratios, vocabulary diversity, etc.
**Input:**
- `filePath` (string): The path of the file to analyze (absolute path in Windows or WSL/Linux format is recommended)
**Output:**
- Basic information about the file (total character count, number of sentences, total number of morphemes)
- Detailed analysis results (average sentence length, part-of-speech ratios, character type ratios, vocabulary diversity, etc.)
## Usage
### Running with npx
This package can be run directly from the GitHub repository using npx:
```bash
npx -y github:Mistizz/mcp-JapaneseTextAnalyzer
```
### Using with Claude for Desktop
Please add the following to the configuration file for Claude for Desktop:
**Windows:**
`%AppData%\Claude\claude_desktop_config.json`
**macOS:**
`~/Library/Application Support/Claude/claude_desktop_config.json`
```json
{
"mcpServers": {
"JapaneseTextAnalyzer": {
"command": "npx",
"args": [
"-y",
"github:Mistizz/mcp-JapaneseTextAnalyzer"
]
}
}
}
```
### Using with Cursor
Similarly, add the configuration to the `mcp.json` file in the `.cursor` folder.
**Windows:**
`%USERPROFILE%\.cursor\mcp.json`
**macOS/Linux:**
`~/.cursor/mcp.json`
General configuration (works in most environments):
```json
{
"mcpServers": {
"JapaneseTextAnalyzer": {
"command": "npx",
"args": [
"-y",
"github:Mistizz/mcp-JapaneseTextAnalyzer"
]
}
}
}
```
If it does not work in a Windows environment, try the following:
```json
{
"mcpServers": {
"JapaneseTextAnalyzer": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"github:Mistizz/mcp-JapaneseTextAnalyzer"
]
}
}
}
```
## Usage Examples
### Count characters in direct text
```
Please count the number of characters in this text.
```
### Count words in a file in Japanese mode
```
Please count the number of words in C:\path\to\your\file.txt in Japanese mode.
```
### Count words using a WSL/Linux format path
```
Please count the number of words in /c/Users/username/Documents/file.txt in Japanese mode.
```
### Count words using just the file name
```
Please count the number of words in README.md in English mode.
```
### Paste text and count Japanese words
```
Please count the number of Japanese words in the following text:
吾輩は猫である。名前はまだ無い。どこで生れたかとんと見当がつかぬ。何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。
```
### Analyze detailed linguistic features of text
```
Please analyze the following text in detail:
私は昨日、新しい本を買いました。とても面白そうな小説で、友人からの評判も良かったです。今週末にゆっくり読む予定です。
```
### Analyze detailed linguistic features of a file
```
Please analyze C:\path\to\your\file.txt in detail.
```
## File Path Resolution
This tool flexibly explores files when a file path is specified:
1. If an absolute path is specified, it is used as is
- Automatically detects and converts both Windows format absolute paths (e.g., `C:\Users\username\Documents\file.txt`) and WSL/Linux format absolute paths (e.g., `/c/Users/username/Documents/file.txt`)
2. Resolves relative paths based on the current directory (working directory)
3. Searches based on the home directory (`%USERPROFILE%` or `$HOME`)
4. Searches based on the desktop directory
5. Searches based on the documents directory
This allows you to specify just a file name like "README.md", and it will automatically search in several common directories, using the file if found. Additionally, paths obtained from WSL environments or Git Bash (in `/c/Users/...` format) can also be used directly in Windows environments.
## Internal Operations
This tool uses the morphological analysis library "kuromoji.js" for counting Japanese words. Morphological analysis is a fundamental process in natural language processing that breaks down sentences into their smallest meaningful units (morphemes).
The morphological analysis process may take some time to initialize, especially since it needs to load dictionary data, which can cause a slight delay during the first execution. By initializing the morphological analyzer when the server starts, we minimize delays during tool execution.
### Analysis of Linguistic Features
The "analyze-text" and "analyze-file" tools calculate various linguistic features of the text based on the results of morphological analysis. These include the following metrics:
- **Average Sentence Length**: The average number of characters per sentence. A higher value may indicate a more difficult-to-read text.
- **Number of Morphemes per Sentence**: The average number of morphemes per sentence, reflecting the density and complexity of the syntax.
- **Part-of-Speech Ratios**: Indicates the proportion of different parts of speech (nouns, verbs, adjectives, etc.) used in the text.
- **Particle Ratios**: Indicates the frequency of specific particles, analyzing the structure and flow of sentences.
- **Character Type Ratios**: Shows the composition ratios of hiragana, katakana, kanji, and alphanumeric characters.
- **Vocabulary Diversity**: Indicates the ratio of different words to the total number of words (type/token ratio), measuring the richness of vocabulary.
- **Katakana Word Ratio**: Indicates the frequency of katakana words, reflecting the prevalence of loanwords and technical terms, as well as the casualness of the writing style.
- **Honorific Frequency**: Indicates the frequency of honorific expressions, measuring the politeness and formality of the text.
- **Average Number of Punctuation Marks**: Indicates the average number of punctuation marks per sentence, providing insights into sentence breaks and readability.
By combining these metrics, we can analyze the characteristics of the text from multiple angles, evaluating style, readability, and expertise.
## License
This MCP server is provided under the MIT License. This means you can freely use, modify, and distribute the software in accordance with the terms of the MIT License. For more details, please refer to the LICENSE file in the project repository.
Connection Info
You Might Also Like
Fetch
Model Context Protocol Servers
semantic-kernel
Integrate cutting-edge LLM technology quickly and easily into your apps
repomix
Repomix packages your codebase into AI-friendly formats for seamless integration.
Serena
A powerful coding agent toolkit providing semantic retrieval and editing...
Blender
BlenderMCP integrates Blender with Claude AI for enhanced 3D modeling.
pydantic-ai
GenAI Agent Framework, the Pydantic way