essay-stats-mcp 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1
4
+
5
+ - Tool descriptions now include example prompts, so clients can show what to ask each tool.
6
+ - New tool word_frequency lists the most used words, with counts and share of the text, to spot overused terms.
7
+ - style_flags now returns a sentence_list with the number of each passive or long sentence, and says that sentence numbers follow the order of the text.
8
+ - Error messages for empty or wordless text and for a minimum above the limit now include a worked example call so a client can fix its input.
9
+
3
10
  ## 0.1.0
4
11
 
5
12
  - First version.
package/README.md CHANGED
@@ -1,12 +1,26 @@
1
1
  # Essay Stats MCP
2
2
 
3
- Offline writing metrics for essays. It covers word and page counts, readability, passive voice, repeated words and reading time, so you can check your work against assignment requirements before you hand it in.
3
+ You are about to hand in an essay and you are not sure if it is over the word limit, or how many pages it is. A chat assistant tends to guess at word counts. This server counts them properly, on your computer, so your assistant can give you real numbers.
4
4
 
5
- It runs on your computer. There is no account, no API key and no network call. Your essay text never leaves your machine.
5
+ Install it in Claude Code with one line:
6
+
7
+ ```
8
+ claude mcp add essay-stats -- npx -y essay-stats-mcp
9
+ ```
10
+
11
+ Then ask things like:
12
+
13
+ - "My limit is 1500 words, not counting the works cited or quotes. Am I over?"
14
+ - "How many pages is this essay in Arial 11 point with 1.5 spacing?"
15
+ - "Find the passive voice and filler words in my draft."
16
+
17
+ Essay Stats MCP is an essay word counter and writing checker that runs offline. It counts words and pages, gives a readability score, and flags passive voice, filler words, long sentences and repeated sentence openers. It also gives the reading time.
18
+
19
+ There is no account, no API key and no network call. Your essay text never leaves your machine.
6
20
 
7
21
  ## Quick start
8
22
 
9
- Add this to the MCP config of your app:
23
+ For Claude Code, use the one line above. For other apps, add this to the MCP config:
10
24
 
11
25
  ```json
12
26
  {
@@ -24,7 +38,6 @@ It needs Node.js 20 or newer.
24
38
  Where the config lives:
25
39
 
26
40
  - Claude Desktop: Settings, Developer, Edit Config (`claude_desktop_config.json`).
27
- - Claude Code: run `claude mcp add essay-stats -- npx -y essay-stats-mcp`.
28
41
  - Cursor: Settings, MCP, or `.cursor/mcp.json` in your project.
29
42
  - VS Code: `.vscode/mcp.json`. VS Code uses a `servers` key instead of `mcpServers`.
30
43
  - Windsurf: `~/.codeium/windsurf/mcp_config.json`.
@@ -37,8 +50,9 @@ Where the config lives:
37
50
  | `readability_scores` | Flesch Kincaid grade, Flesch reading ease, Gunning Fog and SMOG. |
38
51
  | `style_flags` | Passive voice, repeated sentence openers, filler words and long sentences. |
39
52
  | `check_word_limit` | Compares the text with a word limit. Optional minimum, tolerance, and leaving out references and quotes. |
53
+ | `word_frequency` | The words used most often, with counts and share of the text, to spot overused terms. |
40
54
 
41
- All four tools only read the text you give them. Each one returns a short written answer and the same numbers as structured fields.
55
+ All five tools only read the text you give them. Each one returns a short written answer and the same numbers as structured fields.
42
56
 
43
57
  ### count_text
44
58
 
@@ -52,6 +66,12 @@ Input: `text`. The grades are roughly US school grades, so 12 is the end of high
52
66
 
53
67
  Inputs: `text` and optional `max_sentence_words` (default 30). The checks are simple pattern rules. Use them as a prompt to reread a sentence, not as proof of a mistake.
54
68
 
69
+ Sentence numbers start at 1 and follow the order of the text. The `sentence_list` field gives each passive or long sentence with its number, and the text summary ends with a line listing those numbers, so a reply can point you to the right sentence.
70
+
71
+ ### word_frequency
72
+
73
+ Inputs: `text`, and optional `top` (how many words to list, default 10), `min_count` (fewest uses for a word to be listed, default 2) and `include_common_words` (also count small words such as the, and, of and to, default false). Case is ignored, and words under 3 letters are skipped unless `include_common_words` is true.
74
+
55
75
  ### check_word_limit
56
76
 
57
77
  Inputs: `text`, `limit`, and optional `minimum`, `tolerance_percent`, `exclude_references` and `exclude_quotes`. References are cut from a heading line such as References, Works Cited or Bibliography to the end. Quotes are lines starting with `>` and text inside double quotes.
@@ -63,6 +83,18 @@ Inputs: `text`, `limit`, and optional `minimum`, `tolerance_percent`, `exclude_r
63
83
  - "Find the passive voice and filler words in my draft."
64
84
  - "My limit is 1500 words, not counting the works cited or quotes. Am I over?"
65
85
  - "Which sentences are over 25 words long?"
86
+ - "Which words do I overuse in this essay?"
87
+
88
+ ## Works well with
89
+
90
+ If your school uses Brightspace, you can run [brightspace-d2l-mcp](https://www.npmjs.com/package/brightspace-d2l-mcp) next to Essay Stats MCP in the same app. That server has its own setup, so follow its README to install and sign in. Essay Stats MCP does not talk to it and does not need it.
91
+
92
+ With both added to your MCP config, you can ask your assistant to look up the word limit in your assignment details, then pass that number to `check_word_limit` along with your draft. For example:
93
+
94
+ - "Find the word limit for my history essay in Brightspace, then check this draft against it, leaving out the works cited."
95
+ - "Look up my assignment instructions, then tell me if this draft is under the limit and how many pages it is."
96
+
97
+ The assignment details come from the other server. The counting and checking happen here, on your machine, and Essay Stats MCP makes no network calls.
66
98
 
67
99
  ## Privacy
68
100
 
@@ -1,7 +1,7 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { registerTools } from "./core/tools.js";
3
3
  import { tools } from "./tools.js";
4
- export const VERSION = "0.1.0";
4
+ export const VERSION = "0.1.1";
5
5
  export function createServer() {
6
6
  const server = new McpServer({ name: "essay-stats-mcp", version: VERSION });
7
7
  registerTools(server, tools);
package/build/src/text.js CHANGED
@@ -192,3 +192,18 @@ export function stripQuotes(text) {
192
192
  });
193
193
  return { body, removed: removed.join("\n") };
194
194
  }
195
+ const COMMON_WORDS = new Set("a about after all also an and any are as at be because been but by can could did do does for from had has have he her his how i if in into is it its may more most my no not of on one or our out she so some than that the their them then there these they this to up was we were what when which who will with would you your".split(" "));
196
+ /** Counts how often each word is used, ignoring case. Common small words are skipped unless asked for. */
197
+ export function wordFrequency(text, includeCommon = false) {
198
+ const all = words(text).map((w) => w.toLowerCase().replace(/['’]s$/, ""));
199
+ const counted = new Map();
200
+ for (const w of all) {
201
+ if (!includeCommon && (COMMON_WORDS.has(w) || w.length < 3))
202
+ continue;
203
+ counted.set(w, (counted.get(w) ?? 0) + 1);
204
+ }
205
+ const hits = [...counted.entries()]
206
+ .map(([word, count]) => ({ word, count, percent: round((count / all.length) * 100, 2) }))
207
+ .sort((a, b) => b.count - a.count || a.word.localeCompare(b.word));
208
+ return { total: all.length, unique: new Set(all).size, hits };
209
+ }
@@ -1,15 +1,19 @@
1
1
  import { z } from "zod";
2
- import { counts, findFiller, findPassive, findRepeatedOpeners, pageEstimate, round, splitParagraphs, splitSentences, stripQuotes, stripReferences, wordCount, } from "./text.js";
3
- const textInput = z.string().min(1, "text is empty. Paste the essay text to analyse.");
4
- function requireText(text) {
2
+ import { counts, findFiller, findPassive, findRepeatedOpeners, pageEstimate, round, splitParagraphs, splitSentences, stripQuotes, stripReferences, wordCount, wordFrequency, } from "./text.js";
3
+ const EMPTY_TEXT_HINT = `text is empty. Paste the essay text to analyse. Worked example: { "text": "Your essay content here." }`;
4
+ const textInput = z.string().min(1, EMPTY_TEXT_HINT);
5
+ function requireText(text, toolName) {
5
6
  if (!/[A-Za-z0-9]/.test(text)) {
6
- throw new Error("The text has no words in it. Paste the essay text and try again.");
7
+ const example = toolName === "check_word_limit"
8
+ ? `{ "text": "Your essay content here.", "limit": 1500, "exclude_references": true }`
9
+ : `{ "text": "Your essay content here." }`;
10
+ throw new Error(`The text has no words in it. Paste the essay text and try again. Worked example for ${toolName}: ${example}`);
7
11
  }
8
12
  }
9
13
  const countText = {
10
14
  name: "count_text",
11
15
  title: "Count words, sentences and pages",
12
- description: "Count the words, characters, sentences and paragraphs in a text, and estimate how many pages it fills at a given font, font size and line spacing. Inputs: text, and optional font (times new roman, arial, calibri, georgia, courier new or verdana, default times new roman), font_size in points (default 12) and spacing (single, 1.5 or double, default double). The page count is an estimate from typical words per page, so a word processor may differ by a little. Also returns an estimated reading time at 238 words per minute.",
16
+ description: "Count the words, characters, sentences and paragraphs in a text, and estimate how many pages it fills at a given font, font size and line spacing. Inputs: text, and optional font (times new roman, arial, calibri, georgia, courier new or verdana, default times new roman), font_size in points (default 12) and spacing (single, 1.5 or double, default double). The page count is an estimate from typical words per page, so a word processor may differ by a little. Also returns an estimated reading time at 238 words per minute. Example: \"Count the words in this essay and estimate the pages in Times New Roman 12 double spaced.",
13
17
  inputSchema: {
14
18
  text: textInput,
15
19
  font: z.string().optional().describe("Font name. Default times new roman."),
@@ -29,7 +33,7 @@ const countText = {
29
33
  reading_minutes: z.number(),
30
34
  },
31
35
  run: ({ text, font = "times new roman", font_size = 12, spacing = "double" }) => {
32
- requireText(text);
36
+ requireText(text, "count_text");
33
37
  const w = wordCount(text);
34
38
  const pages = round(pageEstimate(w, font, font_size, spacing), 1);
35
39
  const minutes = round(w / 238, 1);
@@ -69,7 +73,7 @@ function fleschLabel(score) {
69
73
  const readabilityScores = {
70
74
  name: "readability_scores",
71
75
  title: "Readability scores",
72
- description: "Score how hard a text is to read with three standard formulas: Flesch Kincaid grade level (plus the Flesch reading ease score), Gunning Fog index and SMOG index. Each grade is roughly a US school grade, so 12 is the end of high school and 16 is a college degree. Input: text. SMOG is built for samples of 30 sentences or more, so on shorter text the tool still returns a number but marks it as less reliable.",
76
+ description: "Score how hard a text is to read with three standard formulas: Flesch Kincaid grade level (plus the Flesch reading ease score), Gunning Fog index and SMOG index. Each grade is roughly a US school grade, so 12 is the end of high school and 16 is a college degree. Input: text. SMOG is built for samples of 30 sentences or more, so on shorter text the tool still returns a number but marks it as less reliable. Example: \"Give me the Flesch Kincaid, Gunning Fog and SMOG scores for this paper.",
73
77
  inputSchema: { text: textInput },
74
78
  outputSchema: {
75
79
  words: z.number(),
@@ -84,7 +88,7 @@ const readabilityScores = {
84
88
  smog_reliable: z.boolean(),
85
89
  },
86
90
  run: ({ text }) => {
87
- requireText(text);
91
+ requireText(text, "readability_scores");
88
92
  const c = counts(text);
89
93
  if (c.words === 0 || c.sentences === 0) {
90
94
  throw new Error("The text needs at least one word and one sentence to score.");
@@ -117,7 +121,7 @@ const readabilityScores = {
117
121
  const styleFlags = {
118
122
  name: "style_flags",
119
123
  title: "Style flags",
120
- description: "Flag common style problems in an essay: sentences in the passive voice, sentences that start with the same word as a neighbour (or three or more times), filler words and phrases such as very, just, in order to, and sentences that are too long. Inputs: text, and optional max_sentence_words (default 30), the length above which a sentence counts as long. The checks are simple pattern rules, so treat them as prompts to reread, not as errors.",
124
+ description: "Flag common style problems in an essay: sentences in the passive voice, sentences that start with the same word as a neighbour (or three or more times), filler words and phrases such as very, just, in order to, and sentences that are too long. Inputs: text, and optional max_sentence_words (default 30), the length above which a sentence counts as long. Sentence numbers start at 1 and follow the order of the text, so number 3 is the third sentence. The sentence_list field gives each passive or long sentence with its number, and the text summary ends with a line listing those numbers. The checks are simple pattern rules, so treat them as prompts to reread, not as errors. Example: \"Flag passive voice and filler words in my draft.",
121
125
  inputSchema: {
122
126
  text: textInput,
123
127
  max_sentence_words: z.number().int().min(5).max(200).optional().describe("Sentence length that counts as long. Default 30."),
@@ -131,9 +135,10 @@ const styleFlags = {
131
135
  filler_count: z.number(),
132
136
  long_sentences: z.array(z.object({ number: z.number(), words: z.number(), sentence: z.string() })),
133
137
  max_sentence_words: z.number(),
138
+ sentence_list: z.array(z.object({ number: z.number(), passive: z.boolean(), long: z.boolean(), sentence: z.string() })),
134
139
  },
135
140
  run: ({ text, max_sentence_words = 30 }) => {
136
- requireText(text);
141
+ requireText(text, "style_flags");
137
142
  const sentences = splitSentences(text);
138
143
  const passive = findPassive(sentences);
139
144
  const openers = findRepeatedOpeners(sentences);
@@ -142,12 +147,23 @@ const styleFlags = {
142
147
  .map((s, i) => ({ number: i + 1, words: wordCount(s), sentence: s }))
143
148
  .filter((s) => s.words > max_sentence_words);
144
149
  const fillerCount = filler.reduce((n, f) => n + f.count, 0);
150
+ let next = 0;
151
+ const longNumbers = new Set(long.map((l) => l.number));
152
+ const sentenceList = sentences
153
+ .map((s, i) => {
154
+ const isPassive = next < passive.length && passive[next].sentence === s;
155
+ if (isPassive)
156
+ next++;
157
+ return { number: i + 1, passive: isPassive, long: longNumbers.has(i + 1), sentence: s };
158
+ })
159
+ .filter((s) => s.passive || s.long);
145
160
  const lines = [
146
161
  `${sentences.length} sentences checked.`,
147
162
  `Passive voice: ${passive.length}${passive.length ? " (" + passive.slice(0, 3).map((p) => `"${p.phrase}"`).join(", ") + (passive.length > 3 ? ", ..." : "") + ")" : ""}.`,
148
163
  `Repeated openers: ${openers.length ? openers.map((o) => `"${o.word}" x${o.count}`).join(", ") : "none"}.`,
149
164
  `Filler: ${fillerCount ? filler.map((f) => `"${f.text}" x${f.count}`).join(", ") : "none"}.`,
150
165
  `Long sentences over ${max_sentence_words} words: ${long.length ? long.map((l) => `#${l.number} (${l.words} words)`).join(", ") : "none"}.`,
166
+ `Passive or long sentence numbers, in text order: ${sentenceList.length ? sentenceList.map((s) => s.number).join(", ") : "none"}.`,
151
167
  ];
152
168
  return {
153
169
  text: lines.join("\n"),
@@ -160,6 +176,7 @@ const styleFlags = {
160
176
  filler_count: fillerCount,
161
177
  long_sentences: long,
162
178
  max_sentence_words,
179
+ sentence_list: sentenceList,
163
180
  },
164
181
  };
165
182
  },
@@ -167,7 +184,7 @@ const styleFlags = {
167
184
  const checkWordLimit = {
168
185
  name: "check_word_limit",
169
186
  title: "Check a word limit",
170
- description: "Compare an essay against a word limit. Inputs: text, limit (the maximum word count), optional minimum (a lower bound), optional tolerance_percent (how far over the limit is still acceptable, default 0, a common rule is 10), optional exclude_references (cut everything from a heading line such as References, Works Cited or Bibliography to the end) and optional exclude_quotes (leave out block quotes that start with > and text inside double quotes). Returns the counted words, how many are left or over, and what was excluded.",
187
+ description: "Compare an essay against a word limit. Inputs: text, limit (the maximum word count), optional minimum (a lower bound), optional tolerance_percent (how far over the limit is still acceptable, default 0, a common rule is 10), optional exclude_references (cut everything from a heading line such as References, Works Cited or Bibliography to the end) and optional exclude_quotes (leave out block quotes that start with > and text inside double quotes). Returns the counted words, how many are left or over, and what was excluded. Example: \"Is this under 2000 words if I leave out the works cited and quotes?.",
171
188
  inputSchema: {
172
189
  text: textInput,
173
190
  limit: z.number().int().positive().describe("Maximum number of words."),
@@ -189,9 +206,9 @@ const checkWordLimit = {
189
206
  words_over: z.number(),
190
207
  },
191
208
  run: ({ text, limit, minimum, tolerance_percent = 0, exclude_references = false, exclude_quotes = false }) => {
192
- requireText(text);
209
+ requireText(text, "check_word_limit");
193
210
  if (minimum !== undefined && minimum > limit) {
194
- throw new Error(`minimum (${minimum}) is above limit (${limit}). Check the two numbers.`);
211
+ throw new Error(`minimum (${minimum}) is above limit (${limit}). Set minimum to at most the limit. Worked example: { "text": "Your essay content here.", "limit": 1500, "minimum": 1200 }`);
195
212
  }
196
213
  const total = wordCount(text);
197
214
  let body = text;
@@ -247,4 +264,34 @@ const checkWordLimit = {
247
264
  };
248
265
  },
249
266
  };
250
- export const tools = [countText, readabilityScores, styleFlags, checkWordLimit];
267
+ const wordFrequencyTool = {
268
+ name: "word_frequency",
269
+ title: "Word frequency",
270
+ description: "Find the words an essay uses most, to spot overused or repeated terms. Inputs: text, and optional top (how many words to list, default 10), min_count (fewest uses for a word to be listed, default 2) and include_common_words (also count small words such as the, and, of and to, default false). Case is ignored, and words under 3 letters are skipped unless include_common_words is true. Each word comes with its count and its share of all the words in the text. Example: \"Which words do I overuse in this essay?.",
271
+ inputSchema: {
272
+ text: textInput,
273
+ top: z.number().int().min(1).max(100).optional().describe("How many words to list. Default 10."),
274
+ min_count: z.number().int().min(1).optional().describe("Fewest uses for a word to be listed. Default 2."),
275
+ include_common_words: z.boolean().optional().describe("Also count small common words. Default false."),
276
+ },
277
+ outputSchema: {
278
+ total_words: z.number(),
279
+ unique_words: z.number(),
280
+ words: z.array(z.object({ word: z.string(), count: z.number(), percent: z.number() })),
281
+ top: z.number(),
282
+ min_count: z.number(),
283
+ },
284
+ run: ({ text, top = 10, min_count = 2, include_common_words = false }) => {
285
+ requireText(text, "word_frequency");
286
+ const f = wordFrequency(text, include_common_words);
287
+ const list = f.hits.filter((h) => h.count >= min_count).slice(0, top);
288
+ const summary = list.length
289
+ ? `Most used words: ${list.map((h) => `"${h.word}" x${h.count} (${h.percent} percent)`).join(", ")}.`
290
+ : `No word is used ${min_count} or more times.`;
291
+ return {
292
+ text: `${f.total} words, ${f.unique} different. ${summary}`,
293
+ structured: { total_words: f.total, unique_words: f.unique, words: list, top, min_count },
294
+ };
295
+ },
296
+ };
297
+ export const tools = [countText, readabilityScores, styleFlags, checkWordLimit, wordFrequencyTool];
package/llms.txt CHANGED
@@ -28,6 +28,7 @@ All tools are read only and work on text passed in the call.
28
28
  - count_text: words, characters, sentences, paragraphs, reading time and estimated pages. Inputs: text, optional font (times new roman, arial, calibri, georgia, courier new, verdana), font_size (default 12) and spacing (single, 1.5, double; default double).
29
29
  - readability_scores: Flesch Kincaid grade, Flesch reading ease, Gunning Fog and SMOG. Input: text. SMOG is marked less reliable under 30 sentences.
30
30
  - style_flags: passive voice, repeated sentence openers, filler words and long sentences. Inputs: text, optional max_sentence_words (default 30).
31
+ - word_frequency: the most used words with counts and share of the text, to spot overused terms. Inputs: text, optional top (default 10), min_count (default 2) and include_common_words (default false).
31
32
  - check_word_limit: compares text with a limit. Inputs: text, limit, optional minimum, tolerance_percent, exclude_references and exclude_quotes. Returns a status of under_minimum, within_limit, within_tolerance or over_limit.
32
33
 
33
34
  ## Example prompts
@@ -35,6 +36,7 @@ All tools are read only and work on text passed in the call.
35
36
  - "Count the words in this essay and estimate the pages in Times New Roman 12 double spaced."
36
37
  - "Give me the Flesch Kincaid, Gunning Fog and SMOG scores for this paper."
37
38
  - "Flag passive voice and filler words in my draft."
39
+ - "Which words do I overuse in this essay?"
38
40
  - "Is this under 2000 words if I leave out the works cited and quotes?"
39
41
 
40
42
  ## Privacy
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "essay-stats-mcp",
3
- "version": "0.1.0",
4
- "description": "Offline writing metrics for essays. Word and page counts, readability scores, passive voice, repeated openers, filler words, long sentences and word limit checks, so students can check their work against assignment requirements. No account, no network.",
3
+ "version": "0.1.1",
4
+ "description": "Essay Stats MCP counts words and pages offline for essays, scores readability, flags passive voice and filler words, and checks word limits against assignment requirements. No account, no network.",
5
5
  "type": "module",
6
6
  "main": "build/src/index.js",
7
7
  "bin": {
@@ -25,16 +25,20 @@
25
25
  },
26
26
  "keywords": [
27
27
  "essay stats mcp",
28
+ "essay stats",
28
29
  "essay word counter",
30
+ "word counter",
29
31
  "word count",
30
32
  "page count",
31
33
  "readability",
34
+ "readability score",
32
35
  "flesch kincaid",
33
36
  "gunning fog",
34
37
  "smog index",
35
38
  "passive voice",
36
39
  "writing metrics",
37
40
  "word limit",
41
+ "word frequency",
38
42
  "reading time",
39
43
  "style checker",
40
44
  "student writing",