Markdown Word Counter Mcp
@Logan66666
A Model Context Protocol (MCP) server that provides word counting functionality for Markdown files, with support for both Chinese characters and English words.
Overview
What is Markdown Word Counter MCP?
Markdown Word Counter MCP is a Model Context Protocol server that provides word counting for Markdown files. It accurately counts both Chinese characters and English words, with optional processing to strip Markdown syntax, HTML tags, and link markup. It is intended for developers using MCP-compatible clients who need word count statistics from Markdown documents while controlling what content is included or excluded.
How to use Markdown Word Counter MCP?
Install dependencies with npm install, then build with npm run build. Configure your MCP client to point at the built build/index.js file using the node command. The server exposes two tools: count_words (returns total word count) and detailed_word_count (returns breakdown with processing info). Both accept a file_path (required) and optional boolean flags to control processing (e.g., remove_html_tags, process_markdown_links, remove_markdown_headers, remove_markdown_lists, normalize_whitespace). You can also run the server directly with npm start.
Key features of Markdown Word Counter MCP
- Accurately counts both Chinese characters and English words
- Minimal processing by default (only whitespace normalization)
- Configurable options for removing Markdown syntax, HTML, and link URLs
- Provides two tools: basic count and detailed statistics
- All processing flags default to off except whitespace normalization
Use cases of Markdown Word Counter MCP
- Get a clean word count from a Markdown file while preserving all syntax
- Obtain a word count that excludes Markdown headers, list markers, and link URLs
- Count words in bilingual Markdown documents mixing Chinese and English
- Integrate word count checks into a documentation workflow via MCP
FAQ from Markdown Word Counter MCP
What processing does the server apply by default?
By default, only whitespace normalization is applied (collapsing multiple spaces and newlines). All other processing—removing HTML tags, processing Markdown links, removing headers, and removing list markers—is optional and disabled unless explicitly enabled.
How are Chinese characters and English words counted separately?
Chinese characters are identified using the Unicode range [\u4e00-\u9fa5], and English words are matched using word boundaries \b\w+\b. The total word count is the sum of Chinese characters plus English words.
What tools does the server provide?
Two tools are available: count_words returns the total word count, and detailed_word_count returns the same statistics along with processing information (such as which options were applied). Both accept the same parameters.
Can I run the server without an MCP client?
Yes, you can run the server directly with npm start. This launches the MCP server over stdio, which can be connected to by any MCP-compatible client or tested manually.
What are the runtime dependencies?
The server requires Node.js and installs its dependencies via npm as a standard TypeScript project. No external database or network service is needed; it reads files from the local filesystem.