@pipeworx/mcp-protein-atlas 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pipeworx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # mcp-protein-atlas
2
+
3
+ Human Protein Atlas (HPA) MCP — keyless.
4
+
5
+ Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 823+ live data sources.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+
12
+ ## Quick Start
13
+
14
+ Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
15
+
16
+ ```json
17
+ {
18
+ "mcpServers": {
19
+ "protein-atlas": {
20
+ "url": "https://gateway.pipeworx.io/protein-atlas/mcp"
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ Or connect to the full Pipeworx gateway for access to all 823+ data sources:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "pipeworx": {
32
+ "url": "https://gateway.pipeworx.io/mcp"
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ## Using with ask_pipeworx
39
+
40
+ Instead of calling tools directly, you can ask questions in plain English:
41
+
42
+ ```
43
+ ask_pipeworx({ question: "your question about Protein Atlas data" })
44
+ ```
45
+
46
+ The gateway picks the right tool and fills the arguments automatically.
47
+
48
+ ## More
49
+
50
+ - [All tools and guides](https://github.com/pipeworx-io/examples)
51
+ - [pipeworx.io](https://pipeworx.io)
52
+
53
+ ## License
54
+
55
+ MIT
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@pipeworx/mcp-protein-atlas",
3
+ "version": "0.1.0",
4
+ "description": "Human Protein Atlas (HPA) MCP — keyless.",
5
+ "type": "module",
6
+ "main": "src/index.ts",
7
+ "types": "src/index.ts",
8
+ "keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "protein-atlas"],
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/pipeworx-io/mcp-protein-atlas"
13
+ },
14
+ "scripts": {
15
+ "typecheck": "tsc --noEmit"
16
+ },
17
+ "devDependencies": {
18
+ "typescript": "^5.7.0"
19
+ }
20
+ }
package/server.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.pipeworx-io/protein-atlas",
4
+ "title": "Protein Atlas",
5
+ "description": "Human Protein Atlas (HPA) MCP — keyless.",
6
+ "version": "0.1.0",
7
+ "websiteUrl": "https://pipeworx.io/packs/protein-atlas",
8
+ "repository": {
9
+ "url": "https://github.com/pipeworx-io/mcp-protein-atlas",
10
+ "source": "github"
11
+ },
12
+ "remotes": [
13
+ {
14
+ "type": "streamable-http",
15
+ "url": "https://gateway.pipeworx.io/protein-atlas/mcp"
16
+ }
17
+ ]
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,165 @@
1
+ interface McpToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: 'object';
6
+ properties: Record<string, unknown>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ interface McpToolExport {
12
+ tools: McpToolDefinition[];
13
+ callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
14
+ meter?: { credits: number };
15
+ cost?: Record<string, unknown>;
16
+ provider?: string;
17
+ }
18
+
19
+ /**
20
+ * Human Protein Atlas (HPA) MCP — keyless.
21
+ *
22
+ * Expression & localization atlas for human proteins: search genes, get a
23
+ * protein's tissue/cell expression, subcellular localization, protein class,
24
+ * and disease involvement, or list its top-expressing tissues by RNA nTPM.
25
+ * Use Ensembl gene ids (search_genes returns them).
26
+ */
27
+
28
+
29
+ const BASE = 'https://www.proteinatlas.org';
30
+ const UA = 'pipeworx/1.0 (+https://pipeworx.io)';
31
+
32
+ const tools: McpToolExport['tools'] = [
33
+ {
34
+ name: 'search_genes',
35
+ description:
36
+ 'Search the Human Protein Atlas for human genes/proteins by gene symbol or keyword. Returns each gene with its Ensembl gene id (needed by get_protein and top_tissues), synonyms, and description. Keyless.',
37
+ inputSchema: {
38
+ type: 'object',
39
+ properties: {
40
+ query: { type: 'string', description: 'Gene symbol (e.g. "EGFR") or keyword (e.g. "insulin receptor").' },
41
+ limit: { type: 'number', description: 'Max genes to return (default 15).' },
42
+ },
43
+ required: ['query'],
44
+ },
45
+ },
46
+ {
47
+ name: 'get_protein',
48
+ description:
49
+ "Get a trimmed Human Protein Atlas profile for one protein by Ensembl gene id (e.g. \"ENSG00000146648\"): gene, description, protein class, biological process, molecular function, RNA tissue specificity/distribution, subcellular location, and disease involvement. Use search_genes to find the Ensembl id. Keyless.",
50
+ inputSchema: {
51
+ type: 'object',
52
+ properties: {
53
+ ensembl_id: { type: 'string', description: 'An Ensembl gene id like "ENSG00000146648".' },
54
+ },
55
+ required: ['ensembl_id'],
56
+ },
57
+ },
58
+ {
59
+ name: 'top_tissues',
60
+ description:
61
+ 'List a protein\'s top-expressing human tissues by RNA expression (nTPM), highest first, for one Ensembl gene id. Use search_genes to find the Ensembl id. Keyless.',
62
+ inputSchema: {
63
+ type: 'object',
64
+ properties: {
65
+ ensembl_id: { type: 'string', description: 'An Ensembl gene id like "ENSG00000146648".' },
66
+ limit: { type: 'number', description: 'Max tissues to return (default 10).' },
67
+ },
68
+ required: ['ensembl_id'],
69
+ },
70
+ },
71
+ ];
72
+
73
+ async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
74
+ try {
75
+ switch (name) {
76
+ case 'search_genes':
77
+ return await searchGenes(args);
78
+ case 'get_protein':
79
+ return await getProtein(args);
80
+ case 'top_tissues':
81
+ return await topTissues(args);
82
+ default:
83
+ return { error: `Unknown tool: ${name}` };
84
+ }
85
+ } catch (err) {
86
+ return { error: err instanceof Error ? err.message : String(err) };
87
+ }
88
+ }
89
+
90
+ async function searchGenes(args: Record<string, unknown>): Promise<unknown> {
91
+ const query = reqStr(args, 'query');
92
+ const limit = numArg(args.limit, 15);
93
+ const url = `${BASE}/api/search_download.php?search=${encodeURIComponent(query)}&format=json&columns=g,gs,eg,gd&compress=no`;
94
+ const data = await fetchJson(url);
95
+ const rows = Array.isArray(data) ? data : [];
96
+ const genes = rows.slice(0, limit).map((g: any) => ({
97
+ gene: g.Gene,
98
+ ensembl: g.Ensembl,
99
+ synonyms: g['Gene synonym'],
100
+ description: g['Gene description'],
101
+ }));
102
+ return { count: genes.length, genes };
103
+ }
104
+
105
+ async function getProtein(args: Record<string, unknown>): Promise<unknown> {
106
+ const ensemblId = reqStr(args, 'ensembl_id');
107
+ const url = `${BASE}/${encodeURIComponent(ensemblId)}.json`;
108
+ let d: any;
109
+ try {
110
+ d = await fetchJson(url);
111
+ } catch {
112
+ return { error: 'protein not found', ensembl_id: ensemblId };
113
+ }
114
+ if (!d || typeof d !== 'object') return { error: 'protein not found', ensembl_id: ensemblId };
115
+ return {
116
+ gene: d.Gene,
117
+ ensembl: d.Ensembl,
118
+ description: d['Gene description'],
119
+ protein_class: d['Protein class'],
120
+ biological_process: d['Biological process'],
121
+ molecular_function: d['Molecular function'],
122
+ rna_tissue_specificity: d['RNA tissue specificity'],
123
+ rna_tissue_distribution: d['RNA tissue distribution'],
124
+ subcellular_location: d['Subcellular main location'] ?? d['Subcellular location'],
125
+ disease_involvement: d['Disease involvement'],
126
+ };
127
+ }
128
+
129
+ async function topTissues(args: Record<string, unknown>): Promise<unknown> {
130
+ const ensemblId = reqStr(args, 'ensembl_id');
131
+ const limit = numArg(args.limit, 10);
132
+ const url = `${BASE}/${encodeURIComponent(ensemblId)}.json`;
133
+ let d: any;
134
+ try {
135
+ d = await fetchJson(url);
136
+ } catch {
137
+ return { ensembl_id: ensemblId, tissues: [] };
138
+ }
139
+ const ntpm = d?.['RNA tissue specific nTPM'];
140
+ if (!ntpm || typeof ntpm !== 'object') return { ensembl_id: ensemblId, tissues: [] };
141
+ const tissues = Object.entries(ntpm as Record<string, unknown>)
142
+ .map(([tissue, value]) => ({ tissue, nTPM: Number(value) }))
143
+ .sort((a, b) => b.nTPM - a.nTPM)
144
+ .slice(0, limit);
145
+ return { ensembl_id: ensemblId, gene: d.Gene, tissues };
146
+ }
147
+
148
+ async function fetchJson(url: string): Promise<unknown> {
149
+ const res = await fetch(url, { headers: { Accept: 'application/json', 'User-Agent': UA } });
150
+ if (!res.ok) throw new Error(`HPA: ${res.status} ${await res.text().then((t) => t.slice(0, 200))}`);
151
+ return res.json();
152
+ }
153
+
154
+ function reqStr(args: Record<string, unknown>, key: string): string {
155
+ const v = args[key];
156
+ if (typeof v !== 'string' || !v.trim()) throw new Error(`Required argument "${key}" is missing.`);
157
+ return v;
158
+ }
159
+
160
+ function numArg(v: unknown, fallback: number): number {
161
+ const n = typeof v === 'number' ? v : typeof v === 'string' ? Number(v) : NaN;
162
+ return Number.isFinite(n) && n > 0 ? Math.floor(n) : fallback;
163
+ }
164
+
165
+ export default { tools, callTool, meter: { credits: 1 } } satisfies McpToolExport;
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "outDir": "dist",
10
+ "rootDir": "src",
11
+ "declaration": true
12
+ },
13
+ "include": ["src"]
14
+ }