@pipeworx/mcp-pride 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 +21 -0
- package/README.md +55 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +174 -0
- package/tsconfig.json +14 -0
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-pride
|
|
2
|
+
|
|
3
|
+
EBI PRIDE Archive MCP — proteomics (mass-spectrometry) data repository.
|
|
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
|
+
"pride": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/pride/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 Pride 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-pride",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "EBI PRIDE Archive MCP — proteomics (mass-spectrometry) data repository.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "pride"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-pride"
|
|
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/pride",
|
|
4
|
+
"title": "Pride",
|
|
5
|
+
"description": "EBI PRIDE Archive MCP — proteomics (mass-spectrometry) data repository.",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/pride",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-pride",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/pride/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
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
|
+
* EBI PRIDE Archive MCP — proteomics (mass-spectrometry) data repository.
|
|
21
|
+
* Keyless. Wraps the public PRIDE Archive REST API (v3).
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
const BASE = 'https://www.ebi.ac.uk/pride/ws/archive/v3';
|
|
26
|
+
const UA = 'pipeworx/1.0 (+https://pipeworx.io)';
|
|
27
|
+
|
|
28
|
+
const tools: McpToolExport['tools'] = [
|
|
29
|
+
{
|
|
30
|
+
name: 'search_projects',
|
|
31
|
+
description:
|
|
32
|
+
'Search EBI PRIDE Archive — the largest public proteomics/mass-spectrometry dataset repository — for projects by keyword (disease, organism, technique, protein, instrument). Returns matching project accessions with title, organisms, diseases, and instruments. Keyless.',
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
keyword: { type: 'string', description: 'Free-text search term, e.g. "breast cancer", "SARS-CoV-2", "TMT".' },
|
|
37
|
+
limit: { type: 'number', description: 'Max results per page (default 20, max 100).' },
|
|
38
|
+
page: { type: 'number', description: 'Zero-based page index (default 0).' },
|
|
39
|
+
},
|
|
40
|
+
required: ['keyword'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'get_project',
|
|
45
|
+
description:
|
|
46
|
+
'Get full metadata for one PRIDE Archive proteomics project by accession (e.g. "PXD000001"): title, description, sample-processing and data-processing protocols, organisms, organism parts, diseases, instruments, keywords, and DOI.',
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
accession: { type: 'string', description: 'PRIDE project accession, e.g. "PXD000001".' },
|
|
51
|
+
},
|
|
52
|
+
required: ['accession'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
58
|
+
try {
|
|
59
|
+
switch (name) {
|
|
60
|
+
case 'search_projects':
|
|
61
|
+
return await searchProjects(args);
|
|
62
|
+
case 'get_project':
|
|
63
|
+
return await getProject(args);
|
|
64
|
+
default:
|
|
65
|
+
return { error: `Unknown tool: ${name}` };
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
return { error: err instanceof Error ? err.message : String(err) };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function searchProjects(args: Record<string, unknown>): Promise<unknown> {
|
|
73
|
+
const keyword = reqStr(args, 'keyword');
|
|
74
|
+
const limit = clampNum(args.limit, 20, 1, 100);
|
|
75
|
+
const page = clampNum(args.page, 0, 0, 1_000_000);
|
|
76
|
+
const url = `${BASE}/search/projects?keyword=${encodeURIComponent(keyword)}&pageSize=${limit}&page=${page}`;
|
|
77
|
+
const res = await fetch(url, { headers: { Accept: 'application/json', 'User-Agent': UA } });
|
|
78
|
+
if (!res.ok) return { error: `PRIDE search failed: ${res.status}`, keyword };
|
|
79
|
+
const data = await safeJson(res);
|
|
80
|
+
const list = asProjectArray(data);
|
|
81
|
+
const projects = list.map((p) => ({
|
|
82
|
+
accession: p.accession ?? null,
|
|
83
|
+
title: p.title ?? null,
|
|
84
|
+
submission_date: p.submissionDate ?? null,
|
|
85
|
+
organisms: nameList(p.organisms),
|
|
86
|
+
diseases: nameList(p.diseases),
|
|
87
|
+
instruments: nameList(p.instruments),
|
|
88
|
+
}));
|
|
89
|
+
return { count: projects.length, projects };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function getProject(args: Record<string, unknown>): Promise<unknown> {
|
|
93
|
+
const accession = reqStr(args, 'accession');
|
|
94
|
+
const url = `${BASE}/projects/${encodeURIComponent(accession)}`;
|
|
95
|
+
const res = await fetch(url, { headers: { Accept: 'application/json', 'User-Agent': UA } });
|
|
96
|
+
if (!res.ok) return { error: 'project not found', accession };
|
|
97
|
+
const p = await safeJson(res);
|
|
98
|
+
if (!p || typeof p !== 'object') return { error: 'project not found', accession };
|
|
99
|
+
const o = p as Record<string, unknown>;
|
|
100
|
+
return {
|
|
101
|
+
accession: o.accession ?? accession,
|
|
102
|
+
title: o.title ?? null,
|
|
103
|
+
description: o.projectDescription ?? null,
|
|
104
|
+
sample_protocol: truncate(o.sampleProcessingProtocol),
|
|
105
|
+
data_protocol: truncate(o.dataProcessingProtocol),
|
|
106
|
+
submission_date: o.submissionDate ?? null,
|
|
107
|
+
publication_date: o.publicationDate ?? null,
|
|
108
|
+
organisms: nameList(o.organisms),
|
|
109
|
+
organism_parts: nameList(o.organismParts ?? o.organismsPart),
|
|
110
|
+
diseases: nameList(o.diseases),
|
|
111
|
+
instruments: nameList(o.instruments),
|
|
112
|
+
keywords: nameList(o.keywords),
|
|
113
|
+
doi: o.doi || null,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** PRIDE returns either a bare array or (rarely) a HAL-wrapped object. Prefer the array. */
|
|
118
|
+
function asProjectArray(data: unknown): Record<string, unknown>[] {
|
|
119
|
+
if (Array.isArray(data)) return data as Record<string, unknown>[];
|
|
120
|
+
if (data && typeof data === 'object') {
|
|
121
|
+
const embedded = (data as Record<string, unknown>)._embedded;
|
|
122
|
+
if (embedded && typeof embedded === 'object') {
|
|
123
|
+
const vals = Object.values(embedded as Record<string, unknown>);
|
|
124
|
+
const arr = vals.find((v) => Array.isArray(v));
|
|
125
|
+
if (Array.isArray(arr)) return arr as Record<string, unknown>[];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Normalize an organisms/diseases/instruments/keywords field to a string[].
|
|
133
|
+
* Search returns plain strings; project detail returns CvParam objects with a `name`.
|
|
134
|
+
*/
|
|
135
|
+
function nameList(v: unknown): string[] {
|
|
136
|
+
if (!Array.isArray(v)) return [];
|
|
137
|
+
const out: string[] = [];
|
|
138
|
+
for (const item of v) {
|
|
139
|
+
if (typeof item === 'string') {
|
|
140
|
+
if (item.trim()) out.push(item);
|
|
141
|
+
} else if (item && typeof item === 'object') {
|
|
142
|
+
const name = (item as Record<string, unknown>).name;
|
|
143
|
+
if (typeof name === 'string' && name.trim()) out.push(name);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function truncate(v: unknown, max = 600): string | null {
|
|
150
|
+
if (typeof v !== 'string') return null;
|
|
151
|
+
return v.length > max ? `${v.slice(0, max)}…` : v;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function safeJson(res: Response): Promise<unknown> {
|
|
155
|
+
try {
|
|
156
|
+
return await res.json();
|
|
157
|
+
} catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function clampNum(v: unknown, def: number, min: number, max: number): number {
|
|
163
|
+
const n = typeof v === 'number' ? v : typeof v === 'string' ? Number(v) : NaN;
|
|
164
|
+
if (!Number.isFinite(n)) return def;
|
|
165
|
+
return Math.min(max, Math.max(min, Math.floor(n)));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function reqStr(args: Record<string, unknown>, key: string): string {
|
|
169
|
+
const v = args[key];
|
|
170
|
+
if (typeof v !== 'string' || !v.trim()) throw new Error(`Required argument "${key}" is missing.`);
|
|
171
|
+
return v.trim();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
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
|
+
}
|