@cyanheads/pubmed-mcp-server 2.10.8 → 2.10.9
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/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/README.md +4 -3
- package/dist/mcp-server/tools/definitions/_text.d.ts +23 -1
- package/dist/mcp-server/tools/definitions/_text.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/_text.js +25 -1
- package/dist/mcp-server/tools/definitions/_text.js.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.d.ts +18 -0
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.js +409 -31
- package/dist/mcp-server/tools/definitions/fetch-fulltext.tool.js.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.d.ts +3 -3
- package/dist/services/europe-pmc/europe-pmc-service.d.ts.map +1 -1
- package/dist/services/europe-pmc/europe-pmc-service.js +8 -16
- package/dist/services/europe-pmc/europe-pmc-service.js.map +1 -1
- package/dist/services/ncbi/parsing/ordered-xml-parser-options.d.ts +44 -0
- package/dist/services/ncbi/parsing/ordered-xml-parser-options.d.ts.map +1 -0
- package/dist/services/ncbi/parsing/ordered-xml-parser-options.js +41 -0
- package/dist/services/ncbi/parsing/ordered-xml-parser-options.js.map +1 -0
- package/dist/services/ncbi/parsing/pmc-article-parser.d.ts +47 -7
- package/dist/services/ncbi/parsing/pmc-article-parser.d.ts.map +1 -1
- package/dist/services/ncbi/parsing/pmc-article-parser.js +322 -48
- package/dist/services/ncbi/parsing/pmc-article-parser.js.map +1 -1
- package/dist/services/ncbi/parsing/pmc-xml-helpers.d.ts +18 -0
- package/dist/services/ncbi/parsing/pmc-xml-helpers.d.ts.map +1 -1
- package/dist/services/ncbi/parsing/pmc-xml-helpers.js +39 -3
- package/dist/services/ncbi/parsing/pmc-xml-helpers.js.map +1 -1
- package/dist/services/ncbi/response-handler.d.ts +3 -9
- package/dist/services/ncbi/response-handler.d.ts.map +1 -1
- package/dist/services/ncbi/response-handler.js +6 -29
- package/dist/services/ncbi/response-handler.js.map +1 -1
- package/dist/services/ncbi/types.d.ts +39 -0
- package/dist/services/ncbi/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/server.json +3 -3
package/AGENTS.md
CHANGED
package/CLAUDE.md
CHANGED
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/pubmed-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/pubmed-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
13
13
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
@@ -88,8 +88,9 @@ Fetch full-text articles via a three-stage chain: NCBI PMC EFetch → Europe PMC
|
|
|
88
88
|
- Structured unavailable reasons (`not-found`, `no-pmc-fallback-disabled`, `no-epmc-fulltext`, `no-body`, `no-doi`, `no-oa`, `fetch-failed`, `parse-failed`, `service-error`) so callers can retry or explain to users without parsing text
|
|
89
89
|
- An `unavailable` entry also carries `unqueriedTiers` when the chain skipped a tier this deployment has not configured and that tier could have served the id — the search was incomplete, and a deployment with those tiers configured may still resolve it
|
|
90
90
|
- Each `unavailable` entry carries `idType` (`pmid` / `pmcid` / `doi`) and `triedTiers` — per-tier outcomes (`not-attempted`, `miss`, `no-fulltext`, `service-error`, …) in execution order, so callers can see which stage failed and why
|
|
91
|
-
- Section filtering by title (case-insensitive match, e.g. `["methods", "results"]`) and configurable max sections apply to PMC output
|
|
92
|
-
-
|
|
91
|
+
- Section filtering by title (case-insensitive substring match at any nesting depth, e.g. `["methods", "results"]`) and configurable max sections apply to PMC output. A section that matches directly is returned whole; one kept only because a nested subsection matched keeps its heading as a breadcrumb with its own text cleared
|
|
92
|
+
- Tables are returned as structured cells (`tables[]` on each PMC article — rows, caption, label, footnotes, and the enclosing section, named for back-matter and appendix tables as well as body ones), covering `<floats-group>`, `<back>` and appendix deposits alongside body tables. `colspan` and `rowspan` are expanded to one entry per grid column, so a value stays under the header it belongs to on both output surfaces; a cell spanning several columns or rows repeats across the cells it covers. A deposit with no readable markup comes back labelled with an `unextractableReason` rather than silently missing. Turn them off with `includeTables: false`
|
|
93
|
+
- Character budgets keep context size predictable: `maxCharacters` caps body text per article (PMC sections, subsections and table content — cell, caption, label and footnote text, not the Markdown grid rendered around it — or the Unpaywall body), `maxCharactersPerSection` caps a single PMC section, and `overflowMode` picks between `truncate` (fill sections in document order) and `outline` (split the budget evenly so every heading survives with an excerpt). Sections are served first and tables spend what is left, in document order until one does not fit; that table and the rest are dropped whole rather than cut mid-row, and named in `truncation.articles[].omittedTableNames`. Budgets run after the semantic filters, and a `truncation` object reports per-article and per-section character counts whenever anything was shortened
|
|
93
94
|
- `maxResponseCharacters` bounds the whole response instead of each body: every field of a returned record counts (abstract, references, metadata, body), one ledger across PMC-, Europe PMC-, and Unpaywall-served articles. Articles past the ceiling are deferred whole, with their ids — in the branch they were requested under — in `deferred.ids` for a follow-up call
|
|
94
95
|
- Up to 10 articles per request
|
|
95
96
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Text helpers shared by the tool definitions: the surrogate-safe
|
|
3
3
|
* character cut used to bound returned text to a budget, and the render-time
|
|
4
|
-
* Markdown
|
|
4
|
+
* Markdown escapes applied to upstream strings interpolated into `format()` —
|
|
5
|
+
* one for an inline position, one for a table cell.
|
|
5
6
|
* @module src/mcp-server/tools/definitions/_text
|
|
6
7
|
*/
|
|
7
8
|
/**
|
|
@@ -44,4 +45,25 @@ export declare function sliceCodeUnits(text: string, limit: number): string;
|
|
|
44
45
|
* only at the start of a line, and the value never reaches one.
|
|
45
46
|
*/
|
|
46
47
|
export declare function escapeMarkdownInline(text: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Escape an upstream string for a Markdown table cell — {@link
|
|
50
|
+
* escapeMarkdownInline} plus the cell delimiter.
|
|
51
|
+
*
|
|
52
|
+
* `|` needs escaping here and nowhere else. Inside a row it ends the cell, so an
|
|
53
|
+
* unescaped one in a value splits it and shifts every value after it one column
|
|
54
|
+
* left: a grid that renders cleanly while reporting the wrong numbers under the
|
|
55
|
+
* wrong headers. Outside a table it is an ordinary character, which is why the
|
|
56
|
+
* inline escape leaves it alone rather than spending a backslash on every value
|
|
57
|
+
* that happens to carry one.
|
|
58
|
+
*
|
|
59
|
+
* Line breaks are already collapsed to a space by the inline escape — a cell
|
|
60
|
+
* needs that too, since a newline inside one ends the row. (#111)
|
|
61
|
+
*
|
|
62
|
+
* Order is load-bearing. The inline escape runs first because it is what escapes
|
|
63
|
+
* the backslash; the backslashes added here for `|` are escape characters and
|
|
64
|
+
* must not be escaped in turn. Reversed, the `\` this step adds is doubled by
|
|
65
|
+
* the backslash pass that follows, which leaves the `|` bare and splits the cell
|
|
66
|
+
* anyway — the exact defect this function exists to prevent.
|
|
67
|
+
*/
|
|
68
|
+
export declare function escapeMarkdownTableCell(text: string): string;
|
|
47
69
|
//# sourceMappingURL=_text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_text.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/_text.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"_text.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/_text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlE;AA2CD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAazD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Text helpers shared by the tool definitions: the surrogate-safe
|
|
3
3
|
* character cut used to bound returned text to a budget, and the render-time
|
|
4
|
-
* Markdown
|
|
4
|
+
* Markdown escapes applied to upstream strings interpolated into `format()` —
|
|
5
|
+
* one for an inline position, one for a table cell.
|
|
5
6
|
* @module src/mcp-server/tools/definitions/_text
|
|
6
7
|
*/
|
|
7
8
|
const HIGH_SURROGATE_FIRST = 0xd800;
|
|
@@ -105,4 +106,27 @@ export function escapeMarkdownInline(text) {
|
|
|
105
106
|
return escaped;
|
|
106
107
|
return escaped.replace(/_/g, (underscore, index) => pairable.has(index) ? `\\${underscore}` : underscore);
|
|
107
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Escape an upstream string for a Markdown table cell — {@link
|
|
111
|
+
* escapeMarkdownInline} plus the cell delimiter.
|
|
112
|
+
*
|
|
113
|
+
* `|` needs escaping here and nowhere else. Inside a row it ends the cell, so an
|
|
114
|
+
* unescaped one in a value splits it and shifts every value after it one column
|
|
115
|
+
* left: a grid that renders cleanly while reporting the wrong numbers under the
|
|
116
|
+
* wrong headers. Outside a table it is an ordinary character, which is why the
|
|
117
|
+
* inline escape leaves it alone rather than spending a backslash on every value
|
|
118
|
+
* that happens to carry one.
|
|
119
|
+
*
|
|
120
|
+
* Line breaks are already collapsed to a space by the inline escape — a cell
|
|
121
|
+
* needs that too, since a newline inside one ends the row. (#111)
|
|
122
|
+
*
|
|
123
|
+
* Order is load-bearing. The inline escape runs first because it is what escapes
|
|
124
|
+
* the backslash; the backslashes added here for `|` are escape characters and
|
|
125
|
+
* must not be escaped in turn. Reversed, the `\` this step adds is doubled by
|
|
126
|
+
* the backslash pass that follows, which leaves the `|` bare and splits the cell
|
|
127
|
+
* anyway — the exact defect this function exists to prevent.
|
|
128
|
+
*/
|
|
129
|
+
export function escapeMarkdownTableCell(text) {
|
|
130
|
+
return escapeMarkdownInline(text).replace(/\|/g, '\\|');
|
|
131
|
+
}
|
|
108
132
|
//# sourceMappingURL=_text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_text.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/_text.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"_text.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/_text.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAa;IACxD,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1B,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,IAAI,oBAAoB,IAAI,IAAI,IAAI,mBAAmB,CAAC;IAC/E,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC;AAED,2EAA2E;AAC3E,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAC7C;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AACtD,mFAAmF;AACnF,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,SAAS,OAAO,CAAC,IAAY,EAAE,SAAiB;IAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;AAC1C,CAA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AAI,CAAC,CAAC;IAClE,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzC,IAAI,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACnE,IAAI,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAElE,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IACtC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,UAAU,EAAE,KAAa,EAAE,EAAE,CACzD,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CACrD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -34,6 +34,7 @@ export declare const fetchFulltextTool: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
34
34
|
pmids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
35
|
dois: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
36
36
|
includeReferences: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
includeTables: z.ZodDefault<z.ZodBoolean>;
|
|
37
38
|
maxSections: z.ZodOptional<z.ZodNumber>;
|
|
38
39
|
sections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
39
40
|
maxCharacters: z.ZodOptional<z.ZodNumber>;
|
|
@@ -87,6 +88,20 @@ export declare const fetchFulltextTool: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
87
88
|
text: z.ZodString;
|
|
88
89
|
}, z.core.$strip>>>;
|
|
89
90
|
}, z.core.$strip>>;
|
|
91
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
92
|
+
label: z.ZodOptional<z.ZodString>;
|
|
93
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
94
|
+
id: z.ZodOptional<z.ZodString>;
|
|
95
|
+
sectionTitle: z.ZodOptional<z.ZodString>;
|
|
96
|
+
headerRowCount: z.ZodNumber;
|
|
97
|
+
rows: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
98
|
+
footnotes: z.ZodOptional<z.ZodString>;
|
|
99
|
+
unextractableReason: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
"cals-tgroup": "cals-tgroup";
|
|
101
|
+
"graphic-only": "graphic-only";
|
|
102
|
+
"no-rows": "no-rows";
|
|
103
|
+
}>>;
|
|
104
|
+
}, z.core.$strip>>>;
|
|
90
105
|
references: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
91
106
|
citation: z.ZodString;
|
|
92
107
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -167,6 +182,7 @@ export declare const fetchFulltextTool: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
167
182
|
originalCharacters: z.ZodNumber;
|
|
168
183
|
returnedCharacters: z.ZodNumber;
|
|
169
184
|
omittedSections: z.ZodNumber;
|
|
185
|
+
omittedTables: z.ZodOptional<z.ZodNumber>;
|
|
170
186
|
articles: z.ZodArray<z.ZodObject<{
|
|
171
187
|
id: z.ZodString;
|
|
172
188
|
source: z.ZodEnum<{
|
|
@@ -181,6 +197,8 @@ export declare const fetchFulltextTool: import("@cyanheads/mcp-ts-core").ToolDef
|
|
|
181
197
|
returnedCharacters: z.ZodNumber;
|
|
182
198
|
truncated: z.ZodBoolean;
|
|
183
199
|
}, z.core.$strip>>>;
|
|
200
|
+
omittedTables: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
omittedTableNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
184
202
|
}, z.core.$strip>>;
|
|
185
203
|
}, z.core.$strip>>;
|
|
186
204
|
deferred: z.ZodOptional<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-fulltext.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/fetch-fulltext.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAsB,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch-fulltext.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/fetch-fulltext.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAsB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAomC/D;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,MAAM,CAiCT;AAID,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA01B5B,CAAC"}
|