@cyanheads/pubchem-mcp-server 0.3.0 → 0.4.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/README.md +2 -1
- package/dist/mcp-server/tools/definitions/get-bioactivity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-bioactivity.tool.js +2 -1
- package/dist/mcp-server/tools/definitions/get-bioactivity.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-3d-structure.tool.d.ts +12 -1
- package/dist/mcp-server/tools/definitions/get-compound-3d-structure.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-3d-structure.tool.js +106 -4
- package/dist/mcp-server/tools/definitions/get-compound-3d-structure.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-details.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-details.tool.js +12 -4
- package/dist/mcp-server/tools/definitions/get-compound-details.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-interactions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-interactions.tool.js +8 -3
- package/dist/mcp-server/tools/definitions/get-compound-interactions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-safety.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-safety.tool.js +4 -3
- package/dist/mcp-server/tools/definitions/get-compound-safety.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-xrefs.tool.d.ts +3 -1
- package/dist/mcp-server/tools/definitions/get-compound-xrefs.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-compound-xrefs.tool.js +14 -0
- package/dist/mcp-server/tools/definitions/get-compound-xrefs.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-summary.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-summary.tool.js +17 -4
- package/dist/mcp-server/tools/definitions/get-summary.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +32 -3
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-assays.tool.d.ts +12 -1
- package/dist/mcp-server/tools/definitions/search-assays.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-assays.tool.js +31 -4
- package/dist/mcp-server/tools/definitions/search-assays.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-compounds.tool.d.ts +6 -0
- package/dist/mcp-server/tools/definitions/search-compounds.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-compounds.tool.js +94 -22
- package/dist/mcp-server/tools/definitions/search-compounds.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/untrusted-text.d.ts +35 -0
- package/dist/mcp-server/tools/definitions/untrusted-text.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/untrusted-text.js +65 -0
- package/dist/mcp-server/tools/definitions/untrusted-text.js.map +1 -0
- package/manifest.json +1 -1
- package/package.json +3 -3
- package/server.json +3 -3
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Framing helpers that render upstream-controlled free text as
|
|
3
|
+
* clearly-delimited DATA in MCP `content[]` output. PubChem descriptions,
|
|
4
|
+
* summaries, interaction statements, synonyms, and assay/GHS text are relayed
|
|
5
|
+
* verbatim into the model's context; rendered as bare prose they blur the
|
|
6
|
+
* boundary between server-authored instructions and retrieved data and can
|
|
7
|
+
* inject markdown structure. These helpers keep that boundary explicit and
|
|
8
|
+
* neutralize markdown-structure injection. `structuredContent` always carries
|
|
9
|
+
* the raw value — this only shapes the human/LLM text-rendering surface.
|
|
10
|
+
* @module mcp-server/tools/definitions/untrusted-text
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Inline markdown delimiters an upstream value could use to break out of a
|
|
14
|
+
* surrounding emphasis/code span (`**bold**`, `` `code` ``) or inject its own.
|
|
15
|
+
* Deliberately narrow — ordinary chemistry punctuation (hyphens, parentheses,
|
|
16
|
+
* brackets, commas, +/=/#) is left intact so legitimate names are not mangled.
|
|
17
|
+
* Underscore is intentionally excluded: CommonMark treats intraword `_` as
|
|
18
|
+
* literal, so it is a far weaker vector than `*`, and escaping it collides with
|
|
19
|
+
* the format-parity linter's underscored sentinels.
|
|
20
|
+
*/
|
|
21
|
+
const INLINE_MARKDOWN = /[`*~]/g;
|
|
22
|
+
/**
|
|
23
|
+
* Frame a single upstream value for safe inline interpolation into `content[]`
|
|
24
|
+
* markdown. Collapses embedded newlines (so the value cannot start a new
|
|
25
|
+
* markdown block) and escapes emphasis / inline-code delimiters. Proportionate
|
|
26
|
+
* by design: the goal is a data boundary, not heavy escaping.
|
|
27
|
+
*/
|
|
28
|
+
export function inlineData(value) {
|
|
29
|
+
return value
|
|
30
|
+
.replace(/\s*[\r\n]+\s*/g, ' ')
|
|
31
|
+
.replace(INLINE_MARKDOWN, '\\$&')
|
|
32
|
+
.trim();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Frame multi-line upstream prose as a markdown blockquote — an explicit
|
|
36
|
+
* "quoted data" boundary distinct from server-authored instructions. Every
|
|
37
|
+
* line (blank ones included) is prefixed with `>` so the payload cannot break
|
|
38
|
+
* out of the quote; inline emphasis/code is escaped and a leading block marker
|
|
39
|
+
* (heading, quote, bullet, ordered list) is defused so it cannot restructure
|
|
40
|
+
* the surrounding document.
|
|
41
|
+
*/
|
|
42
|
+
export function quoteData(text) {
|
|
43
|
+
return text
|
|
44
|
+
.split(/\r\n?|\n/)
|
|
45
|
+
.map((rawLine) => {
|
|
46
|
+
const line = rawLine
|
|
47
|
+
.replace(INLINE_MARKDOWN, '\\$&')
|
|
48
|
+
.replace(/^(\s*)([#>+-])/, '$1\\$2')
|
|
49
|
+
.replace(/^(\s*\d{1,9})([.)])/, '$1\\$2');
|
|
50
|
+
return line.trim().length > 0 ? `> ${line}` : '>';
|
|
51
|
+
})
|
|
52
|
+
.join('\n');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Wrap raw upstream text in a fenced code block whose fence is guaranteed
|
|
56
|
+
* longer than any backtick run inside the payload, so a stray ``` cannot close
|
|
57
|
+
* the fence early and let following lines render as markdown. Preserves the
|
|
58
|
+
* content verbatim (no character substitution) — used for raw V2000 SDF.
|
|
59
|
+
*/
|
|
60
|
+
export function fencedData(content, language = '') {
|
|
61
|
+
const longestRun = Math.max(0, ...[...content.matchAll(/`+/g)].map((m) => m[0].length));
|
|
62
|
+
const fence = '`'.repeat(Math.max(3, longestRun + 1));
|
|
63
|
+
return `${fence}${language}\n${content}\n${fence}`;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=untrusted-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"untrusted-text.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/untrusted-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AACH,MAAM,eAAe,GAAG,QAAQ,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,KAAK;SACT,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;SAC9B,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC;SAChC,IAAI,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI;SACR,KAAK,CAAC,UAAU,CAAC;SACjB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACf,MAAM,IAAI,GAAG,OAAO;aACjB,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC;aAChC,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC;aACnC,OAAO,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IACpD,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,QAAQ,GAAG,EAAE;IACvD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACxF,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACtD,OAAO,GAAG,KAAK,GAAG,QAAQ,KAAK,OAAO,KAAK,KAAK,EAAE,CAAC;AACrD,CAAC"}
|
package/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "pubchem-mcp-server",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "Search the PubChem chemical database for compounds, properties, safety data, bioactivity, cross-references, and entity summaries via MCP. STDIO or Streamable HTTP.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "cyanheads"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/pubchem-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Search the PubChem chemical database for compounds, properties, safety data, bioactivity, cross-references, and entity summaries via MCP. STDIO or Streamable HTTP.",
|
|
5
5
|
"mcpName": "io.github.cyanheads/pubchem-mcp-server",
|
|
6
6
|
"type": "module",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"zod": "^4.4.3"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@biomejs/biome": "^2.5.
|
|
82
|
-
"@types/node": "^26.0
|
|
81
|
+
"@biomejs/biome": "^2.5.2",
|
|
82
|
+
"@types/node": "^26.1.0",
|
|
83
83
|
"depcheck": "^1.4.7",
|
|
84
84
|
"ignore": "^7.0.5",
|
|
85
85
|
"tsc-alias": "^1.8.17",
|
package/server.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/cyanheads/pubchem-mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.4.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/pubchem-mcp-server",
|
|
21
21
|
"runtimeHint": "bun",
|
|
22
|
-
"version": "0.
|
|
22
|
+
"version": "0.4.0",
|
|
23
23
|
"packageArguments": [
|
|
24
24
|
{ "type": "positional", "value": "run" },
|
|
25
25
|
{ "type": "positional", "value": "start:stdio" }
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
43
43
|
"identifier": "@cyanheads/pubchem-mcp-server",
|
|
44
44
|
"runtimeHint": "bun",
|
|
45
|
-
"version": "0.
|
|
45
|
+
"version": "0.4.0",
|
|
46
46
|
"packageArguments": [
|
|
47
47
|
{ "type": "positional", "value": "run" },
|
|
48
48
|
{ "type": "positional", "value": "start:http" }
|