docstats
Computes readability scores for supplied text or documents.
Input sources: direct text, public web page URLs, and Google Cloud Storage PDF URIs (
gs://).Metrics returned: consensus text standard plus Flesch Reading Ease, Flesch-Kincaid, Gunning Fog, SMOG, Coleman-Liau, ARI, Linsear Write, Dale-Chall, and Spache scores.
Integration: works as an MCP tool (
get_readability_scores) and as a FastAPI REST endpoint.Use cases: CI/CD acceptance gates, PR reviews, and pre-publish editorial QA.
Allows processing of PDF files stored in Google Cloud Storage, extracting text for readability analysis.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@docstatsAnalyze the readability of this text: 'It was a dark and stormy night.'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
docstats
Docstats calculates readability scores and provides deterministic house-style linting for plain text, web pages, and PDFs. Designed as a post-hoc acceptance gate for CI/CD pipelines, PR reviews, and pre-publish editorial QA, docstats runs as an MCP server for AI coding assistants or as a FastAPI web service.
Table of Contents
Related MCP server: mcp-pdf-tools
Features
Readability scoring (Axis A): Computes consensus grade level plus 9 standard formulas (Flesch Reading Ease, Flesch-Kincaid, Gunning Fog, SMOG, Coleman-Liau, and more).
House-style linting (Axis B): Deterministic pattern checking for throat-clearing openers, binary contrast frames, non-technical filler adverbs, rhetorical em dashes, and rhythm indicators.
Multiple inputs: Reads direct text, public web pages, and PDFs from web URLs or Google Cloud Storage (
gs://).Agent Plugin v1.0.0: Native MCP STDIO tool (
readability-docstats) and prompt skill (readability-analysis).Flexible runtime: Runs as a local REST API, an MCP STDIO server, or a streamable HTTP server.
Recommended Workflow: Post-Hoc Acceptance Gate
Docstats is optimized as an asynchronous acceptance gate and editorial linter rather than an in-prompt generative dial. Empirical research indicates that injecting live numeric metrics during text generation does not improve prose quality over clear textual guidance and risks artificial metric gaming. Use docstats to audit drafts, run pre-commit checks, or gate documentation CI workflows.
Quickstart
Run docstats right away with uv:
# Start the MCP server over STDIO (for Claude Code, Gemini CLI, Cursor, etc.)
uv run python main.py --server-type mcp
# Or start the local REST API server
uv run uvicorn fastapi_app:fastapi_app --reloadSend a test request to the REST API:
curl -X POST "http://127.0.0.1:8000/scores/" \
-H "Content-Type: application/json" \
-d '{"text": "Docstats makes readability analysis fast, delightful, and robust."}'Example response:
{
"flesch_reading_ease": 45.1,
"flesch_kincaid_grade": 8.8,
"text_standard": "8.0",
"word_count": 8,
"sentence_count": 1
}Installation
Prerequisites
Python 3.10+
uvpackage manager
Setup
Clone the repository and install dependencies:
git clone https://github.com/ghchinoy/docstats.git
cd docstats
uv sync(Optional) If you read PDFs from Google Cloud Storage (gs://), log in with Application Default Credentials:
gcloud auth application-default loginAgent Plugin & MCP Usage
Docstats implements the Agent Plugins v1.0.0 spec. Agent runtimes find the plugin manifest, MCP tool, and skill guidance automatically.
File | Purpose |
Plugin metadata and version information | |
MCP STDIO server declaration | |
Skill guidance for AI assistants |
Manual MCP Client Setup
To configure an MCP client manually (such as in ~/.claude/settings.json or Gemini CLI):
{
"mcpServers": {
"readability_docstats": {
"command": "uv",
"args": ["run", "python", "/ABSOLUTE/PATH/TO/docstats/main.py", "--server-type", "mcp"],
"cwd": "/ABSOLUTE/PATH/TO/docstats"
}
}
}Server Modes
Docstats supports three execution modes:
MCP STDIO Server:
uv run python main.py --server-type mcpFastAPI REST API:
uv run uvicorn fastapi_app:fastapi_app --host 127.0.0.1 --port 8000 --reloadInteractive Swagger docs open at
http://127.0.0.1:8000/docs.MCP Streamable HTTP Server:
uv run python main.py --server-type mcp-http --host 127.0.0.1 --port 8001
Development & Testing
Run Tests
Run the test suite with pytest:
# Run all tests
uv run pytest
# Run fast unit tests only (no network needed)
uv run pytest test_unit.py
# Run tests without slow integration tests
uv run pytest -m "not slow"Golden Set Benchmarks
Check score consistency against baseline sample files:
uv run python baseline_analysis.pyCode Quality
Run formatting and lint checks:
uv run ruff check .
uv run ruff format --check .Readability Scores
Docstats provides the following metrics:
Metric | Target / Range | Description |
Text Standard | Consensus grade | Best overall summary grade |
Flesch Reading Ease | 0 to 100 (higher is easier) | 90–100: Grade 5; 60–70: Plain English; <30: Difficult |
Flesch-Kincaid Grade | Grade level | Years of education needed |
Gunning Fog Index | Grade level | Counts complex words with 3 or more syllables |
SMOG Index | Grade level | Standard for consumer and health copy |
Coleman-Liau Index | Grade level | Based on character count per word |
Automated Readability (ARI) | Grade level | Based on letter and sentence counts |
Linsear Write | Grade level | Common technical writing formula |
Dale-Chall Score | 0.0 to 10.0+ | Measures hard words outside common word lists |
Spache Score | Primary grade level | For primary school level texts |
Documentation
The full documentation site is published at ghchinoy.github.io/docstats (built with Astro Starlight; source in site/). It covers a user-first explainer, MCP and skills integration, and technical deep dives on the linguistics and statistics.
Source-of-truth references:
User Guide — Comprehensive guide to configuration, endpoints, extraction pipelines, and troubleshooting.
Scoring Specification — Specification for two-axis assessment and house-style linting.
Readability Analysis Skill — Model-facing prompt skill and interpretation guide.
Contributing
We welcome contributions!
Fork and clone the repository.
Create a feature branch (
git checkout -b feature/my-feature).Run tests (
uv run pytest) and linters (uv run ruff check .).Check baseline scores (
uv run python baseline_analysis.py).Open a Pull Request.
License & Disclaimer
License: Apache License 2.0. See LICENSE for details.
Disclaimer: This is not an officially supported Google product.
Available Tools
1 toolget_readability_scoresA
Calculates readability scores for text from direct input, a web URL, or a GCS PDF URI.
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | ||
| web_url | No | ||
| gcs_pdf_uri | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must convey all behavioral traits. It mentions calculation and input sources but does not disclose whether it fetches remote content, any safety profile, or output format—leaving significant behavioral aspects unspecified.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that is front-loaded with the core action and source options. No redundant words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool has no annotations and no output schema, yet the description does not specify which readability formulas are used, the return structure, or input validation rules. This is a notable gap, though the basic functionality is clear.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema provides no descriptions; the description adds context by naming the three source types, which maps to the text, web_url, and gcs_pdf_uri parameters. However, it does not clarify mutual exclusivity or format requirements, so the added value is limited.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb 'Calculates' and identifies the resource as 'readability scores', with clear input sources (text, web URL, GCS PDF URI). This clearly differentiates the tool's function.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies the tool is for calculating readability when given one of the three source types, but it does not explicitly state when to prefer this tool over alternatives, nor does it mention any exclusions or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
With only one tool, there is no possibility of confusing it with another. The tool's purpose is singular and well-defined, eliminating any disambiguation concerns.
The single tool follows a clear verb_noun naming pattern ('get_readability_scores'), which is consistent and predictable. Since there's only one tool, naming consistency is trivially maintained.
A server with only one tool is too few for the apparent scope of 'docstats', which implies a broader set of document statistics. The tool is not trivial, but the server feels underpopulated for its purpose.
The server only provides readability scores, which is a narrow slice of document statistics. Given the server name 'docstats', one would expect additional metrics like word count, sentence length, or writing level, leaving notable gaps.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
MCP server for detecting and redacting PII (Personally Identifiable Information) in PDF documents.
Hosted MCP server: convert PDFs to clean, LLM-ready Markdown with tables, formulas and OCR.
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
Related MCP Servers
- AlicenseDqualityDmaintenanceAn MCP server that extracts meaningful content from websites and converts HTML to high-quality Markdown, using Mozilla's Readability engine.17,0068MIT
- AlicenseAqualityNot gradedmaintenanceAn MCP server that enables users to read, search, and analyze PDF documents. It provides tools for extracting text, viewing metadata, searching content with context, and generating word statistics.5
- AlicenseNot gradedqualityAmaintenanceMCP server offering text analysis tools for writing improvement, including spellcheck, readability, keyword analysis, passive voice detection, and AI-generated content detection.10MIT
- AlicenseNot gradedqualityDmaintenanceAlgorithmic text and NLP analysis server providing sentiment, readability, keyword extraction, language detection, stats, and more via REST and MCP.2MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ghchinoy/docstats'
If you have feedback or need assistance with the MCP directory API, please join our Discord server