@cyanheads/openalex-mcp-server 0.7.16 → 0.8.0
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 +32 -30
- package/CLAUDE.md +32 -30
- package/Dockerfile +88 -32
- package/README.md +6 -2
- package/changelog/0.8.x/0.8.0.md +38 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/literature-review.prompt.js +1 -1
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.js +23 -6
- package/dist/mcp-server/tools/definitions/analyze-trends.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts +21 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/citation-graph.tool.js +42 -42
- package/dist/mcp-server/tools/definitions/citation-graph.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.js +1 -1
- package/dist/mcp-server/tools/definitions/resolve-name.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts +35 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-entities.tool.js +110 -62
- package/dist/mcp-server/tools/definitions/search-entities.tool.js.map +1 -1
- package/dist/mcp-server/tools/render-entity-record.d.ts +12 -1
- package/dist/mcp-server/tools/render-entity-record.d.ts.map +1 -1
- package/dist/mcp-server/tools/render-entity-record.js +23 -8
- package/dist/mcp-server/tools/render-entity-record.js.map +1 -1
- package/dist/mcp-server/tools/response-budget.d.ts +159 -0
- package/dist/mcp-server/tools/response-budget.d.ts.map +1 -0
- package/dist/mcp-server/tools/response-budget.js +480 -0
- package/dist/mcp-server/tools/response-budget.js.map +1 -0
- package/dist/services/openalex/openalex-service.d.ts +13 -0
- package/dist/services/openalex/openalex-service.d.ts.map +1 -1
- package/dist/services/openalex/openalex-service.js +46 -34
- package/dist/services/openalex/openalex-service.js.map +1 -1
- package/dist/services/openalex/provider-text.d.ts +12 -5
- package/dist/services/openalex/provider-text.d.ts.map +1 -1
- package/dist/services/openalex/provider-text.js +357 -33
- package/dist/services/openalex/provider-text.js.map +1 -1
- package/dist/services/openalex/types.d.ts +1 -1
- package/dist/services/openalex/types.js +1 -1
- package/package.json +8 -7
- package/server.json +3 -3
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Normalization of provider text — the titles, abstracts, names, and affiliation
|
|
3
3
|
* strings OpenAlex passes through from its sources unsanitized. Decodes HTML character
|
|
4
|
-
* references against the full WHATWG table in one pass, then
|
|
5
|
-
* a small allowlist of HTML/JATS/MathML elements
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* references against the full WHATWG table in one pass, then, in a second single pass, removes
|
|
5
|
+
* HTML comments, unwraps a small allowlist of HTML/JATS/MathML elements, unwraps CDATA sections
|
|
6
|
+
* and IOP's `<?CDATA …?>` instructions, drops the `<?MML …?>` instructions that restate them, and
|
|
7
|
+
* turns a double-escaped line break (a literal backslash + `n`) into a space. Everything else
|
|
8
|
+
* stays literal, so text such as `A < B`, `Fish <Actinopterygii>`, a SICI DOI, or TeX like `\nu`
|
|
9
|
+
* survives untouched. Output is plain text; Markdown escaping for `content[]` happens at the
|
|
10
|
+
* render boundary, never here. Identifier and URL fields of a record are not provider text and
|
|
11
|
+
* pass through byte-identical, so each one resolves when passed back.
|
|
8
12
|
* @module services/openalex/provider-text
|
|
9
13
|
*/
|
|
10
14
|
import entityTable from './html-entities.json' with { type: 'json' };
|
|
@@ -146,6 +150,12 @@ const SCRIPT_OPENERS = new Map([
|
|
|
146
150
|
]);
|
|
147
151
|
/** A complete tag, checked against one `<…>` candidate that holds no other `<` or `>`. */
|
|
148
152
|
const TAG = /^<(\/?)([A-Za-z][\w:.-]*)(?:\s[^<>]*)?\/?>$/;
|
|
153
|
+
function isAllowlistedElement(name) {
|
|
154
|
+
return (INLINE_ELEMENTS.has(name) ||
|
|
155
|
+
name.startsWith('mml:') ||
|
|
156
|
+
BLOCK_ELEMENTS.has(name) ||
|
|
157
|
+
SCRIPT_OPENERS.has(name));
|
|
158
|
+
}
|
|
149
159
|
/**
|
|
150
160
|
* What an allowlisted tag becomes, or `undefined` for any other `<…>` span, which stays literal.
|
|
151
161
|
* Matching a whole tag name — never a prefix — is what keeps `i1<i2<` and `<Actinopterygii>`.
|
|
@@ -170,6 +180,35 @@ function replaceTag(candidate) {
|
|
|
170
180
|
const COMMENT_OPEN = '<!--';
|
|
171
181
|
/** `<!---->` — the shortest span that closes a comment it opened. */
|
|
172
182
|
const MIN_COMMENT_LENGTH = 7;
|
|
183
|
+
/**
|
|
184
|
+
* `<!--inline-formula>`: an A&A/JATS formula opener written as a comment opener that never
|
|
185
|
+
* closes. An allowlisted name straight after `<!--` makes it a tag to remove, not a comment —
|
|
186
|
+
* left open, it would delete everything up to the next `-->`, which math text supplies as an
|
|
187
|
+
* arrow (`--->`). A space after `<!--`, as every real comment in the corpus has, keeps it a
|
|
188
|
+
* comment. The length cap bounds the check to the one `>` that can end such a name.
|
|
189
|
+
*/
|
|
190
|
+
const FORMULA_OPENER = /^<!--([A-Za-z][\w:.-]*)>$/;
|
|
191
|
+
const MAX_FORMULA_OPENER_LENGTH = 64;
|
|
192
|
+
const CDATA_OPEN = '<![CDATA[';
|
|
193
|
+
const CDATA_CLOSE = ']]>';
|
|
194
|
+
/** The closer without its `>`, which some sources end a section with. */
|
|
195
|
+
const CDATA_BARE_CLOSE = ']]';
|
|
196
|
+
/**
|
|
197
|
+
* Processing instructions IOP wraps inline math in: `<?CDATA x?>` carries the TeX and is
|
|
198
|
+
* unwrapped; the `<?MML y?>` that always follows restates it flattened (`10^4` reads `10 4`) and
|
|
199
|
+
* is removed whole. Only these two targets — a generic `<?name` rule would eat `<?php` text.
|
|
200
|
+
*/
|
|
201
|
+
const INSTRUCTION_CDATA = '<?CDATA';
|
|
202
|
+
const INSTRUCTION_MML = '<?MML';
|
|
203
|
+
const INSTRUCTION_CLOSE = '?>';
|
|
204
|
+
/**
|
|
205
|
+
* The longest `<?MML … ?>` removed, `<?MML` through `?>`. Every one in a 3,543-record sample
|
|
206
|
+
* spans at most 64 characters; one that runs longer lost its `?>` and stays literal rather than
|
|
207
|
+
* deleting prose up to some later `?>`.
|
|
208
|
+
*/
|
|
209
|
+
const MAX_MML_SPAN = 128;
|
|
210
|
+
/** A double-escaped line break: the two characters `\` and `n`, not a newline. */
|
|
211
|
+
const LITERAL_NEWLINE = '\\n';
|
|
173
212
|
function endsWith(out, suffix) {
|
|
174
213
|
if (out.length < suffix.length)
|
|
175
214
|
return false;
|
|
@@ -179,50 +218,284 @@ function endsWith(out, suffix) {
|
|
|
179
218
|
}
|
|
180
219
|
return true;
|
|
181
220
|
}
|
|
221
|
+
const isBlank = (ch) => ch === ' ' || ch === '\t';
|
|
222
|
+
const isAsciiLetter = (ch) => ch !== undefined && ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'));
|
|
223
|
+
/** Characters that end a processing-instruction target. */
|
|
224
|
+
const endsInstructionTarget = (ch) => ch === ' ' || ch === '\t' || ch === '\n' || ch === '\r' || ch === '?';
|
|
225
|
+
/** Whether `out` ends with a formula opener whose `<` sits at `start`. */
|
|
226
|
+
function isFormulaOpener(out, start) {
|
|
227
|
+
if (out.length - start > MAX_FORMULA_OPENER_LENGTH)
|
|
228
|
+
return false;
|
|
229
|
+
if (out[start + 1] !== '!' || !isAsciiLetter(out[start + COMMENT_OPEN.length]))
|
|
230
|
+
return false;
|
|
231
|
+
const name = FORMULA_OPENER.exec(out.slice(start).join(''))?.[1];
|
|
232
|
+
return name !== undefined && isAllowlistedElement(name.toLowerCase());
|
|
233
|
+
}
|
|
182
234
|
/**
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
235
|
+
* Handle markup in one left-to-right pass, reaching the result that repeating a regex
|
|
236
|
+
* replacement until nothing changes would reach — no allowlisted tag, comment, or delimiter can
|
|
237
|
+
* re-form in the output — in linear time. A replace-until-stable loop costs one full pass per
|
|
238
|
+
* nesting level, which is quadratic on nested input such as `<<<i>i>i>`.
|
|
239
|
+
*
|
|
240
|
+
* Characters are copied to `out`. Removing a tag, comment, or delimiter can join the text on
|
|
241
|
+
* either side into a new one (`<<i>i>`, `<!-<!---->- x -->`, `<![CDA<i></i>TA[`), so every
|
|
242
|
+
* removal truncates `out` and scanning simply continues, and every delimiter is recognized by
|
|
243
|
+
* how `out` ends rather than by the input: `opens` holds the positions of each `<` that could
|
|
244
|
+
* still begin a tag, and `commentStart` the earliest unclosed `<!--`. A tag ends at the first `>`
|
|
245
|
+
* after its `<`, so a `>` settles the innermost open `<`: kept as text, it also blocks every `<`
|
|
246
|
+
* below it, except those before an unclosed comment, which come back into play if that comment
|
|
247
|
+
* closes. Each character is examined a bounded number of times.
|
|
248
|
+
*
|
|
249
|
+
* CDATA: the `<![CDATA[` opener is dropped where it forms and `cdataStart` marks where the
|
|
250
|
+
* section's text begins. `]]>` closes it. Sources also drop the `>`, so a bare `]]` followed by
|
|
251
|
+
* anything but `>` or `]` — the end of the text included — closes it as well, unless the text
|
|
252
|
+
* still holds a `]]>` before its next opener: then the `]]` belongs to the section, as in TeX's
|
|
253
|
+
* `k[[x]]`. A bare `]]` at most one space before an opener closed a section whose opener was
|
|
254
|
+
* lost, and goes with it. With no open section, `]]` and `]]>` are text.
|
|
187
255
|
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
256
|
+
* `<?MML`: a pending instruction closes at the next `?>` unless another `<?` forms first or the
|
|
257
|
+
* span passes `MAX_MML_SPAN`; either way it stays literal, since its `?>` was lost. A `?>` that
|
|
258
|
+
* closes nothing is dropped when another pass would pair it with such a literal `<?MML` — no
|
|
259
|
+
* `<?` between them, within the cap — so the output stays a fixed point.
|
|
260
|
+
*
|
|
261
|
+
* Literal `\n`: sources that double-escaped their line breaks leave a backslash and an `n`. One
|
|
262
|
+
* whose backslash is not itself escaped and which no ASCII letter follows becomes a single
|
|
263
|
+
* space, merged with the spaces around it and dropped at either end of the text. Most wrap
|
|
264
|
+
* mid-sentence, so it is never a paragraph break. A letter after it reads as TeX (`\nu`,
|
|
265
|
+
* `\neq`, `\nabla`, a custom `\np`), and no local rule tells those from a glued `\nand`, so
|
|
266
|
+
* those stay. A backslash just before a removed opener forms one with the `n` after it; the
|
|
267
|
+
* section or instruction that opener began stays open.
|
|
195
268
|
*/
|
|
196
269
|
function stripMarkup(text) {
|
|
197
|
-
if (!text.includes('<'))
|
|
270
|
+
if (!text.includes('<') && !text.includes(LITERAL_NEWLINE))
|
|
198
271
|
return text;
|
|
199
272
|
const out = [];
|
|
200
273
|
const opens = [];
|
|
274
|
+
const instructions = [];
|
|
201
275
|
let commentStart = -1;
|
|
276
|
+
let cdataStart = -1;
|
|
277
|
+
/** A space standing where text was removed, dropped if nothing follows it. */
|
|
278
|
+
let softSpace = -1;
|
|
279
|
+
/** Swallow spaces and tabs up to the next other character. */
|
|
280
|
+
let skipBlanks = false;
|
|
281
|
+
/** An unescaped `\n` was just copied; the next character decides what it is. */
|
|
282
|
+
let newlinePending = false;
|
|
283
|
+
/** A pending `<?MML` was left literal, so a stray `?>` may pair with it on another pass. */
|
|
284
|
+
let literalMml = false;
|
|
285
|
+
/**
|
|
286
|
+
* Where the next `]]>` and `<![CDATA[` start in `text`, -1 for none. The scan position only
|
|
287
|
+
* advances, so each is searched again only once passed, and every search covers new ground.
|
|
288
|
+
*/
|
|
289
|
+
let nextSectionClose = -2;
|
|
290
|
+
let nextSectionOpen = -2;
|
|
291
|
+
/** Whether `text` holds a `]]>` at or after `from`, before any further section opener. */
|
|
292
|
+
const sectionCloseAhead = (from) => {
|
|
293
|
+
if (nextSectionClose !== -1 && nextSectionClose < from) {
|
|
294
|
+
nextSectionClose = text.indexOf(CDATA_CLOSE, from);
|
|
295
|
+
}
|
|
296
|
+
if (nextSectionClose < 0)
|
|
297
|
+
return false;
|
|
298
|
+
if (nextSectionOpen !== -1 && nextSectionOpen < from) {
|
|
299
|
+
nextSectionOpen = text.indexOf(CDATA_OPEN, from);
|
|
300
|
+
}
|
|
301
|
+
return nextSectionOpen < 0 || nextSectionClose < nextSectionOpen;
|
|
302
|
+
};
|
|
303
|
+
const truncate = (length) => {
|
|
304
|
+
out.length = length;
|
|
305
|
+
while (opens.length > 0 && opens.at(-1) >= length)
|
|
306
|
+
opens.pop();
|
|
307
|
+
if (commentStart >= length)
|
|
308
|
+
commentStart = -1;
|
|
309
|
+
if (cdataStart > length)
|
|
310
|
+
cdataStart = -1;
|
|
311
|
+
while (instructions.length > 0) {
|
|
312
|
+
const { kind, start } = instructions.at(-1);
|
|
313
|
+
if (kind === 'mml' ? start < length : start <= length)
|
|
314
|
+
break;
|
|
315
|
+
instructions.pop();
|
|
316
|
+
}
|
|
317
|
+
if (softSpace >= length)
|
|
318
|
+
softSpace = -1;
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Open a processing instruction when `out` ends with its target and `separator` ends that
|
|
322
|
+
* target — whitespace, a `?`, or the space or break a removal leaves. Returns whether the
|
|
323
|
+
* separator is consumed: the whitespace after a CDATA target only separates it from the content.
|
|
324
|
+
*/
|
|
325
|
+
const openInstruction = (separator) => {
|
|
326
|
+
if (endsWith(out, INSTRUCTION_CDATA)) {
|
|
327
|
+
truncate(out.length - INSTRUCTION_CDATA.length);
|
|
328
|
+
instructions.push({ kind: 'cdata', start: out.length });
|
|
329
|
+
return separator !== '?';
|
|
330
|
+
}
|
|
331
|
+
if (endsWith(out, INSTRUCTION_MML)) {
|
|
332
|
+
instructions.push({ kind: 'mml', start: out.length - INSTRUCTION_MML.length });
|
|
333
|
+
}
|
|
334
|
+
return false;
|
|
335
|
+
};
|
|
336
|
+
/** Replace the `\n` that ends `out` with one space, merging the blanks before it. */
|
|
337
|
+
const replaceNewline = () => {
|
|
338
|
+
// Blanks before a section or instruction opener stay, so the opener keeps its position.
|
|
339
|
+
const instruction = instructions.at(-1);
|
|
340
|
+
const floor = Math.max(cdataStart, instruction?.start ?? -1);
|
|
341
|
+
let length = out.length - LITERAL_NEWLINE.length;
|
|
342
|
+
while (length > floor && length > 0 && isBlank(out[length - 1]))
|
|
343
|
+
length--;
|
|
344
|
+
// The backslash sits before a removed opener whose section or instruction the `n` began.
|
|
345
|
+
const reopenSection = cdataStart > length;
|
|
346
|
+
const reopenInstruction = instruction?.kind === 'cdata' && instruction.start > length;
|
|
347
|
+
truncate(length);
|
|
348
|
+
if (reopenSection)
|
|
349
|
+
cdataStart = length;
|
|
350
|
+
if (reopenInstruction)
|
|
351
|
+
instructions.push({ kind: 'cdata', start: length });
|
|
352
|
+
skipBlanks = true;
|
|
353
|
+
if (!openInstruction(' ') && length > 0 && !isBlank(out[length - 1])) {
|
|
354
|
+
out.push(' ');
|
|
355
|
+
softSpace = length;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
/**
|
|
359
|
+
* Whether the `?>` ending `out` would close a literal `<?MML` on another pass: the nearest `<?`
|
|
360
|
+
* before it, within `MAX_MML_SPAN` of its end, begins one.
|
|
361
|
+
*/
|
|
362
|
+
const pairsWithLiteralMml = () => {
|
|
363
|
+
const floor = Math.max(0, out.length - MAX_MML_SPAN);
|
|
364
|
+
for (let at = out.length - INSTRUCTION_CLOSE.length - 1; at >= floor; at--) {
|
|
365
|
+
if (out[at] !== '<' || out[at + 1] !== '?')
|
|
366
|
+
continue;
|
|
367
|
+
for (let i = 2; i < INSTRUCTION_MML.length; i++) {
|
|
368
|
+
if (out[at + i] !== INSTRUCTION_MML[i])
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
const separator = out[at + INSTRUCTION_MML.length];
|
|
372
|
+
return separator !== undefined && endsInstructionTarget(separator);
|
|
373
|
+
}
|
|
374
|
+
return false;
|
|
375
|
+
};
|
|
376
|
+
/** After removing a span: merge the blanks around it, and drop it cleanly at either end. */
|
|
377
|
+
const settleRemoval = () => {
|
|
378
|
+
if (out.length === 0) {
|
|
379
|
+
skipBlanks = true;
|
|
380
|
+
}
|
|
381
|
+
else if (isBlank(out.at(-1))) {
|
|
382
|
+
skipBlanks = true;
|
|
383
|
+
softSpace = out.length - 1;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
const openSection = () => {
|
|
387
|
+
let start = out.length - CDATA_OPEN.length;
|
|
388
|
+
const gap = out[start - 1] === ' ' ? 1 : 0;
|
|
389
|
+
const lostClose = out[start - 1 - gap] === ']' && out[start - 2 - gap] === ']';
|
|
390
|
+
if (lostClose)
|
|
391
|
+
start -= CDATA_BARE_CLOSE.length + gap;
|
|
392
|
+
truncate(start);
|
|
393
|
+
if (lostClose && gap > 0 && out.length > 0 && !isBlank(out.at(-1)) && !openInstruction(' ')) {
|
|
394
|
+
out.push(' ');
|
|
395
|
+
}
|
|
396
|
+
// Sections do not nest; a second opener inside one only goes.
|
|
397
|
+
if (cdataStart < 0)
|
|
398
|
+
cdataStart = out.length;
|
|
399
|
+
};
|
|
400
|
+
let offset = 0;
|
|
202
401
|
for (const ch of text) {
|
|
402
|
+
const at = offset;
|
|
403
|
+
offset += ch.length;
|
|
404
|
+
if (newlinePending) {
|
|
405
|
+
newlinePending = false;
|
|
406
|
+
if (!isAsciiLetter(ch))
|
|
407
|
+
replaceNewline();
|
|
408
|
+
}
|
|
409
|
+
if (skipBlanks) {
|
|
410
|
+
if (isBlank(ch))
|
|
411
|
+
continue;
|
|
412
|
+
skipBlanks = false;
|
|
413
|
+
}
|
|
414
|
+
if (cdataStart >= 0 &&
|
|
415
|
+
ch !== '>' &&
|
|
416
|
+
ch !== ']' &&
|
|
417
|
+
out.length - CDATA_BARE_CLOSE.length >= cdataStart &&
|
|
418
|
+
endsWith(out, CDATA_BARE_CLOSE) &&
|
|
419
|
+
!sectionCloseAhead(at)) {
|
|
420
|
+
truncate(out.length - CDATA_BARE_CLOSE.length);
|
|
421
|
+
cdataStart = -1;
|
|
422
|
+
// `x ]] y` leaves one space, not two.
|
|
423
|
+
if (isBlank(ch) && isBlank(out.at(-1)))
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
if (endsInstructionTarget(ch) && openInstruction(ch))
|
|
427
|
+
continue;
|
|
203
428
|
out.push(ch);
|
|
429
|
+
if (ch === 'n' && out.at(-2) === '\\' && out.at(-3) !== '\\') {
|
|
430
|
+
newlinePending = true;
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
204
433
|
if (ch === '<') {
|
|
205
434
|
opens.push(out.length - 1);
|
|
206
435
|
continue;
|
|
207
436
|
}
|
|
437
|
+
if (ch === '[') {
|
|
438
|
+
if (endsWith(out, CDATA_OPEN))
|
|
439
|
+
openSection();
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
208
442
|
if (ch === '-') {
|
|
209
443
|
if (commentStart < 0 && endsWith(out, COMMENT_OPEN))
|
|
210
444
|
commentStart = out.length - 4;
|
|
211
445
|
continue;
|
|
212
446
|
}
|
|
447
|
+
if (ch === '?') {
|
|
448
|
+
if (out.at(-2) === '<' && instructions.at(-1)?.kind === 'mml') {
|
|
449
|
+
instructions.pop();
|
|
450
|
+
literalMml = true;
|
|
451
|
+
}
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
213
454
|
if (ch !== '>')
|
|
214
455
|
continue;
|
|
456
|
+
if (cdataStart >= 0 &&
|
|
457
|
+
out.length - CDATA_CLOSE.length >= cdataStart &&
|
|
458
|
+
endsWith(out, CDATA_CLOSE)) {
|
|
459
|
+
truncate(out.length - CDATA_CLOSE.length);
|
|
460
|
+
cdataStart = -1;
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
if (endsWith(out, INSTRUCTION_CLOSE)) {
|
|
464
|
+
let instruction = instructions.at(-1);
|
|
465
|
+
if (instruction?.kind === 'mml' && out.length - instruction.start > MAX_MML_SPAN) {
|
|
466
|
+
instructions.pop();
|
|
467
|
+
instruction = instructions.at(-1);
|
|
468
|
+
}
|
|
469
|
+
if (instruction) {
|
|
470
|
+
instructions.pop();
|
|
471
|
+
if (instruction.kind === 'cdata') {
|
|
472
|
+
truncate(out.length - INSTRUCTION_CLOSE.length);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
truncate(instruction.start);
|
|
476
|
+
settleRemoval();
|
|
477
|
+
}
|
|
478
|
+
continue;
|
|
479
|
+
}
|
|
480
|
+
if (literalMml && pairsWithLiteralMml()) {
|
|
481
|
+
truncate(out.length - INSTRUCTION_CLOSE.length);
|
|
482
|
+
settleRemoval();
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
215
486
|
if (commentStart >= 0 &&
|
|
216
487
|
out.length - commentStart >= MIN_COMMENT_LENGTH &&
|
|
217
488
|
endsWith(out, '-->')) {
|
|
218
|
-
|
|
219
|
-
commentStart = -1;
|
|
220
|
-
while (opens.length > 0 && opens.at(-1) >= out.length)
|
|
221
|
-
opens.pop();
|
|
489
|
+
truncate(commentStart);
|
|
222
490
|
continue;
|
|
223
491
|
}
|
|
224
|
-
//
|
|
492
|
+
// Like a tag, a formula opener goes even inside an unclosed comment.
|
|
225
493
|
const top = opens.at(-1);
|
|
494
|
+
if (top !== undefined && isFormulaOpener(out, top)) {
|
|
495
|
+
truncate(top);
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
// Inside an unclosed comment, only a `<` opened after it can form a tag.
|
|
226
499
|
if (top === undefined || top <= commentStart)
|
|
227
500
|
continue;
|
|
228
501
|
opens.pop();
|
|
@@ -232,10 +505,21 @@ function stripMarkup(text) {
|
|
|
232
505
|
opens.pop();
|
|
233
506
|
continue;
|
|
234
507
|
}
|
|
235
|
-
|
|
508
|
+
truncate(top);
|
|
509
|
+
if (replacement === PARAGRAPH_BREAK && openInstruction(replacement))
|
|
510
|
+
continue;
|
|
236
511
|
if (replacement)
|
|
237
512
|
out.push(replacement);
|
|
238
513
|
}
|
|
514
|
+
if (newlinePending)
|
|
515
|
+
replaceNewline();
|
|
516
|
+
if (cdataStart >= 0 &&
|
|
517
|
+
out.length - CDATA_BARE_CLOSE.length >= cdataStart &&
|
|
518
|
+
endsWith(out, CDATA_BARE_CLOSE)) {
|
|
519
|
+
truncate(out.length - CDATA_BARE_CLOSE.length);
|
|
520
|
+
}
|
|
521
|
+
if (softSpace >= 0 && softSpace === out.length - 1)
|
|
522
|
+
out.length = softSpace;
|
|
239
523
|
// A break element can only come from a block tag (input is copied one character at a time),
|
|
240
524
|
// and one inside a comment was truncated with it.
|
|
241
525
|
const stripped = out.join('');
|
|
@@ -259,18 +543,58 @@ export function normalizeProviderText(text) {
|
|
|
259
543
|
function isRecord(value) {
|
|
260
544
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
261
545
|
}
|
|
262
|
-
/**
|
|
263
|
-
|
|
546
|
+
/**
|
|
547
|
+
* Keys holding identifiers and URLs — what a caller passes back to look a record up, filter on,
|
|
548
|
+
* or open. Their strings stay byte-identical to upstream: OpenAlex stores some DOIs with a
|
|
549
|
+
* literal `&`, and only that spelling resolves. Named by the key holding the string or the
|
|
550
|
+
* array of strings, at any depth: these, and any key ending in `_id`, `_ids`, `_url`, or
|
|
551
|
+
* `_lineage`. No display-text field (`title`, `display_name`, `abstract`, `raw_*`,
|
|
552
|
+
* `host_organization_name`, `description`, `hint`, …) matches.
|
|
553
|
+
*/
|
|
554
|
+
const IDENTIFIER_KEYS = new Set([
|
|
555
|
+
'doi',
|
|
556
|
+
'host_organization',
|
|
557
|
+
'id',
|
|
558
|
+
'issn',
|
|
559
|
+
'issn_l',
|
|
560
|
+
'lineage',
|
|
561
|
+
'orcid',
|
|
562
|
+
'parent_publisher',
|
|
563
|
+
'raw_orcid',
|
|
564
|
+
'referenced_works',
|
|
565
|
+
'related_works',
|
|
566
|
+
'ror',
|
|
567
|
+
'url',
|
|
568
|
+
'wikidata',
|
|
569
|
+
]);
|
|
570
|
+
const IDENTIFIER_SUFFIX = /_(?:id|ids|url|lineage)$/;
|
|
571
|
+
/** Objects whose every value is an identifier or URL (`ids.doi`, `content_urls.pdf`). */
|
|
572
|
+
const IDENTIFIER_MAPS = new Set(['content_urls', 'ids']);
|
|
573
|
+
function isIdentifierKey(key) {
|
|
574
|
+
return IDENTIFIER_KEYS.has(key) || IDENTIFIER_SUFFIX.test(key);
|
|
575
|
+
}
|
|
576
|
+
function normalizeLeaves(value, identifier) {
|
|
264
577
|
if (typeof value === 'string')
|
|
265
|
-
return normalizeProviderText(value);
|
|
578
|
+
return identifier ? value : normalizeProviderText(value);
|
|
266
579
|
if (Array.isArray(value))
|
|
267
|
-
return value.map(
|
|
268
|
-
if (isRecord(value))
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
580
|
+
return value.map((item) => normalizeLeaves(item, identifier));
|
|
581
|
+
if (!isRecord(value))
|
|
582
|
+
return value;
|
|
583
|
+
// `fromEntries` defines each key as an own data property; assigning an own `__proto__` key
|
|
584
|
+
// onto an object literal would run the inherited setter and drop it. An object under an
|
|
585
|
+
// identifier key is still walked by its own keys, so a `display_name` inside it is normalized.
|
|
586
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
587
|
+
key,
|
|
588
|
+
IDENTIFIER_MAPS.has(key) && isRecord(item)
|
|
589
|
+
? item
|
|
590
|
+
: normalizeLeaves(item, isIdentifierKey(key)),
|
|
591
|
+
]));
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Normalize every string leaf of a JSON value except identifiers and URLs, which pass through
|
|
595
|
+
* byte-identical; keys, numbers, booleans, and nulls pass through too.
|
|
596
|
+
*/
|
|
597
|
+
export function normalizeProviderValue(value) {
|
|
598
|
+
return normalizeLeaves(value, false);
|
|
275
599
|
}
|
|
276
600
|
//# sourceMappingURL=provider-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-text.js","sourceRoot":"","sources":["../../../src/services/openalex/provider-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,WAAW,MAAM,sBAAsB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAErE;;;;;GAKG;AACH,MAAM,gBAAgB,GAAgC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAEjG,kGAAkG;AAClG,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC;IAC1D,KAAK;IACL,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH,SAAS,cAAc,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAClC,OAAO,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvF,CAAC;AAED,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAExC;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,6DAA6D,CAAC;AAE1F,iGAAiG;AACjG,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,OAAO,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AA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AE,OAAO,KAAK,CAAC;IACnC,2FAA2F;IAC3F,wFAAwF;IACxF,+FAA+F;IAC/F,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;QACzC,GAAG;QACH,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC;YACxC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC;KAChD,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAI,KAAQ;IAChD,OAAO,eAAe,CAAC,KAAK,EAAE,KAAK,CAAM,CAAC;AAC5C,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
export declare const ENTITY_TYPES: readonly ['works', 'authors', 'sources', 'institutions', 'topics', 'keywords', 'publishers', 'funders'];
|
|
6
6
|
export type EntityType = (typeof ENTITY_TYPES)[number];
|
|
7
7
|
/**
|
|
8
|
-
* Default `select` fields applied to
|
|
8
|
+
* Default `select` fields applied to searches and single-entity lookups alike when the caller
|
|
9
9
|
* doesn't specify `select`. Prevents 20-70KB-per-record responses from blowing up context windows.
|
|
10
10
|
*
|
|
11
11
|
* `best_oa_location` earns its place on works despite the payload it adds (~36% on a 25-record
|
|
@@ -13,7 +13,7 @@ export const ENTITY_TYPES = [
|
|
|
13
13
|
'funders',
|
|
14
14
|
];
|
|
15
15
|
/**
|
|
16
|
-
* Default `select` fields applied to
|
|
16
|
+
* Default `select` fields applied to searches and single-entity lookups alike when the caller
|
|
17
17
|
* doesn't specify `select`. Prevents 20-70KB-per-record responses from blowing up context windows.
|
|
18
18
|
*
|
|
19
19
|
* `best_oa_location` earns its place on works despite the payload it adds (~36% on a 25-record
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/openalex-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Access the OpenAlex academic research catalog - 270M+ publications through MCP. STDIO & Streamable HTTP.",
|
|
5
5
|
"mcpName": "io.github.cyanheads/openalex-mcp-server",
|
|
6
6
|
"type": "module",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"changelog/",
|
|
14
14
|
"dist/",
|
|
15
|
+
"!dist/*.mcpb",
|
|
15
16
|
"README.md",
|
|
16
17
|
"LICENSE",
|
|
17
18
|
"CLAUDE.md",
|
|
@@ -83,27 +84,27 @@
|
|
|
83
84
|
"node": ">=24.0.0",
|
|
84
85
|
"bun": ">=1.4.0"
|
|
85
86
|
},
|
|
86
|
-
"packageManager": "bun@1.4.
|
|
87
|
+
"packageManager": "bun@1.4.2",
|
|
87
88
|
"publishConfig": {
|
|
88
89
|
"access": "public"
|
|
89
90
|
},
|
|
90
91
|
"trustedDependencies": ["@socketsecurity/bun-security-scanner"],
|
|
91
92
|
"dependencies": {
|
|
92
|
-
"@cyanheads/mcp-ts-core": "^0.13.
|
|
93
|
+
"@cyanheads/mcp-ts-core": "^0.13.10",
|
|
93
94
|
"pino-pretty": "^13.1.3",
|
|
94
95
|
"zod": "^4.6.5"
|
|
95
96
|
},
|
|
96
97
|
"devDependencies": {
|
|
97
98
|
"@biomejs/biome": "^2.5.14",
|
|
98
|
-
"@socketsecurity/bun-security-scanner": "^1.1.
|
|
99
|
-
"@types/node": "^26.6.
|
|
99
|
+
"@socketsecurity/bun-security-scanner": "^1.1.3",
|
|
100
|
+
"@types/node": "^26.6.3",
|
|
100
101
|
"depcheck": "^1.4.7",
|
|
101
|
-
"ignore": "^7.0.
|
|
102
|
+
"ignore": "^7.0.10",
|
|
102
103
|
"mdast-util-from-markdown": "^2.0.3",
|
|
103
104
|
"mdast-util-gfm": "^3.1.0",
|
|
104
105
|
"micromark-extension-gfm": "^3.0.0",
|
|
105
106
|
"tsc-alias": "^1.9.5",
|
|
106
107
|
"typescript": "^7.0.2",
|
|
107
|
-
"vitest": "^5.0.
|
|
108
|
+
"vitest": "^5.0.2"
|
|
108
109
|
}
|
|
109
110
|
}
|
package/server.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/cyanheads/openalex-mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.8.0",
|
|
10
10
|
"remotes": [
|
|
11
11
|
{
|
|
12
12
|
"type": "streamable-http",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
20
20
|
"identifier": "@cyanheads/openalex-mcp-server",
|
|
21
21
|
"runtimeHint": "node",
|
|
22
|
-
"version": "0.
|
|
22
|
+
"version": "0.8.0",
|
|
23
23
|
"packageArguments": [
|
|
24
24
|
{
|
|
25
25
|
"type": "positional",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
68
68
|
"identifier": "@cyanheads/openalex-mcp-server",
|
|
69
69
|
"runtimeHint": "node",
|
|
70
|
-
"version": "0.
|
|
70
|
+
"version": "0.8.0",
|
|
71
71
|
"packageArguments": [
|
|
72
72
|
{
|
|
73
73
|
"type": "positional",
|