@pipeworx/mcp-datacite 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 +265 -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-datacite
|
|
2
|
+
|
|
3
|
+
DataCite MCP — DOIs for research datasets (free, no auth)
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 250+ 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
|
+
"datacite": {
|
|
20
|
+
"url": "https://gateway.pipeworx.io/datacite/mcp"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or connect to the full Pipeworx gateway for access to all 250+ 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 Datacite 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-datacite",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "DataCite MCP — DOIs for research datasets (free, no auth)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "datacite"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-datacite"
|
|
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/datacite",
|
|
4
|
+
"title": "Datacite",
|
|
5
|
+
"description": "DataCite MCP — DOIs for research datasets (free, no auth)",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/datacite",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-datacite",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/datacite/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
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
|
+
* DataCite MCP — DOIs for research datasets (free, no auth)
|
|
21
|
+
*
|
|
22
|
+
* Crossref handles papers and books; DataCite is the DOI registry for
|
|
23
|
+
* **datasets, software, samples, instruments** — anything that isn't a
|
|
24
|
+
* traditional publication but deserves a citation. ~50M DOIs.
|
|
25
|
+
*
|
|
26
|
+
* API: https://support.datacite.org/docs/api
|
|
27
|
+
* Tools:
|
|
28
|
+
* - search_dois: full-text + faceted search across DataCite-registered DOIs
|
|
29
|
+
* - get_doi: full record for one DOI
|
|
30
|
+
* - list_repositories: registered data repositories (clients)
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const BASE_URL = 'https://api.datacite.org';
|
|
35
|
+
|
|
36
|
+
const tools: McpToolExport['tools'] = [
|
|
37
|
+
{
|
|
38
|
+
name: 'search_dois',
|
|
39
|
+
description:
|
|
40
|
+
'Search DataCite-registered DOIs. Filter by free-text query, resource type (dataset, software, etc.), year, publisher, or affiliation. Returns DOI, title, creators, publisher, type, year, citation count.',
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
query: { type: 'string', description: 'Free-text query (titles, descriptions, creators)' },
|
|
45
|
+
resource_type: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Dataset | Software | Text | Image | Sound | Other (case-sensitive)',
|
|
48
|
+
},
|
|
49
|
+
year: { type: 'number', description: 'Publication year' },
|
|
50
|
+
publisher: { type: 'string', description: 'Publisher name filter' },
|
|
51
|
+
affiliation: { type: 'string', description: 'Creator affiliation' },
|
|
52
|
+
page_size: { type: 'number', description: '1-1000 (default 25)' },
|
|
53
|
+
page: { type: 'number', description: '1-based page (default 1)' },
|
|
54
|
+
},
|
|
55
|
+
required: [],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'get_doi',
|
|
60
|
+
description:
|
|
61
|
+
'Fetch a single DOI record. Returns full metadata: title(s), creators with affiliations and ORCIDs, abstract, publisher, year, dates, related identifiers, subjects, license, sizes/formats.',
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
doi: { type: 'string', description: 'DOI (e.g., "10.5281/zenodo.1234567")' },
|
|
66
|
+
},
|
|
67
|
+
required: ['doi'],
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'list_repositories',
|
|
72
|
+
description:
|
|
73
|
+
'List DataCite-registered data repositories (e.g., Zenodo, Dryad, Figshare). Filter by query. Useful for "where do I deposit a dataset" lookups.',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
query: { type: 'string', description: 'Repository name / description filter' },
|
|
78
|
+
page_size: { type: 'number', description: '1-1000 (default 25)' },
|
|
79
|
+
page: { type: 'number', description: '1-based page' },
|
|
80
|
+
},
|
|
81
|
+
required: [],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
87
|
+
switch (name) {
|
|
88
|
+
case 'search_dois':
|
|
89
|
+
return searchDois(args);
|
|
90
|
+
case 'get_doi':
|
|
91
|
+
return getDoi(reqStr(args, 'doi', '"10.5281/zenodo.1234567"'));
|
|
92
|
+
case 'list_repositories':
|
|
93
|
+
return listRepositories(args);
|
|
94
|
+
default:
|
|
95
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function reqStr(args: Record<string, unknown>, key: string, example: string): string {
|
|
100
|
+
const v = args[key];
|
|
101
|
+
if (typeof v !== 'string' || !v.trim()) {
|
|
102
|
+
throw new Error(`Required argument "${key}" is missing or empty. Pass a string like ${example}.`);
|
|
103
|
+
}
|
|
104
|
+
return v;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function dcFetch<T>(path: string, params?: URLSearchParams): Promise<T> {
|
|
108
|
+
const url = `${BASE_URL}${path}${params ? `?${params}` : ''}`;
|
|
109
|
+
const res = await fetch(url, { headers: { Accept: 'application/vnd.api+json' } });
|
|
110
|
+
if (res.status === 404) throw new Error('DataCite: not found (HTTP 404)');
|
|
111
|
+
if (res.status === 429) throw new Error('DataCite: rate-limit (HTTP 429)');
|
|
112
|
+
if (!res.ok) {
|
|
113
|
+
const body = await res.text();
|
|
114
|
+
throw new Error(`DataCite error: ${res.status} ${body.slice(0, 200)}`);
|
|
115
|
+
}
|
|
116
|
+
return res.json() as Promise<T>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
interface DoiAttributes {
|
|
120
|
+
doi?: string;
|
|
121
|
+
identifiers?: { identifier?: string; identifierType?: string }[];
|
|
122
|
+
creators?: { name?: string; affiliation?: { name?: string }[]; nameIdentifiers?: { nameIdentifier?: string; nameIdentifierScheme?: string }[] }[];
|
|
123
|
+
titles?: { title?: string; lang?: string }[];
|
|
124
|
+
publisher?: string;
|
|
125
|
+
publicationYear?: number;
|
|
126
|
+
types?: { resourceType?: string; resourceTypeGeneral?: string };
|
|
127
|
+
subjects?: { subject?: string }[];
|
|
128
|
+
dates?: { date?: string; dateType?: string }[];
|
|
129
|
+
descriptions?: { description?: string; descriptionType?: string }[];
|
|
130
|
+
sizes?: string[];
|
|
131
|
+
formats?: string[];
|
|
132
|
+
rightsList?: { rights?: string; rightsUri?: string }[];
|
|
133
|
+
relatedIdentifiers?: { relatedIdentifier?: string; relatedIdentifierType?: string; relationType?: string }[];
|
|
134
|
+
url?: string;
|
|
135
|
+
citationCount?: number;
|
|
136
|
+
downloadCount?: number;
|
|
137
|
+
viewCount?: number;
|
|
138
|
+
registered?: string;
|
|
139
|
+
updated?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
interface DoiResource {
|
|
143
|
+
id?: string;
|
|
144
|
+
attributes?: DoiAttributes;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function normalizeDoiSummary(r: DoiResource) {
|
|
148
|
+
const a = r.attributes ?? {};
|
|
149
|
+
const titles = a.titles ?? [];
|
|
150
|
+
return {
|
|
151
|
+
doi: a.doi ?? r.id ?? null,
|
|
152
|
+
title: titles[0]?.title ?? null,
|
|
153
|
+
creators: (a.creators ?? []).map((c) => c.name).filter(Boolean),
|
|
154
|
+
publisher: a.publisher ?? null,
|
|
155
|
+
year: a.publicationYear ?? null,
|
|
156
|
+
resource_type: a.types?.resourceTypeGeneral ?? a.types?.resourceType ?? null,
|
|
157
|
+
url: a.url ?? null,
|
|
158
|
+
citation_count: a.citationCount ?? null,
|
|
159
|
+
download_count: a.downloadCount ?? null,
|
|
160
|
+
view_count: a.viewCount ?? null,
|
|
161
|
+
datacite_url: a.doi ? `https://commons.datacite.org/doi.org/${a.doi}` : null,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function normalizeDoiFull(r: DoiResource) {
|
|
166
|
+
const a = r.attributes ?? {};
|
|
167
|
+
return {
|
|
168
|
+
...normalizeDoiSummary(r),
|
|
169
|
+
titles: (a.titles ?? []).map((t) => ({ title: t.title ?? null, lang: t.lang ?? null })),
|
|
170
|
+
creators_full: (a.creators ?? []).map((c) => ({
|
|
171
|
+
name: c.name ?? null,
|
|
172
|
+
affiliations: (c.affiliation ?? []).map((af) => af.name).filter(Boolean),
|
|
173
|
+
orcid: c.nameIdentifiers?.find((i) => i.nameIdentifierScheme === 'ORCID')?.nameIdentifier ?? null,
|
|
174
|
+
})),
|
|
175
|
+
subjects: (a.subjects ?? []).map((s) => s.subject).filter(Boolean),
|
|
176
|
+
descriptions: (a.descriptions ?? []).map((d) => ({ text: d.description ?? null, type: d.descriptionType ?? null })),
|
|
177
|
+
dates: (a.dates ?? []).map((d) => ({ date: d.date ?? null, type: d.dateType ?? null })),
|
|
178
|
+
sizes: a.sizes ?? [],
|
|
179
|
+
formats: a.formats ?? [],
|
|
180
|
+
rights: (a.rightsList ?? []).map((r) => ({ name: r.rights ?? null, uri: r.rightsUri ?? null })),
|
|
181
|
+
related: (a.relatedIdentifiers ?? []).map((r) => ({
|
|
182
|
+
id: r.relatedIdentifier ?? null,
|
|
183
|
+
type: r.relatedIdentifierType ?? null,
|
|
184
|
+
relation: r.relationType ?? null,
|
|
185
|
+
})),
|
|
186
|
+
registered: a.registered ?? null,
|
|
187
|
+
updated: a.updated ?? null,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function searchDois(args: Record<string, unknown>) {
|
|
192
|
+
const params = new URLSearchParams({
|
|
193
|
+
'page[size]': String(Math.min(1000, Math.max(1, (args.page_size as number) ?? 25))),
|
|
194
|
+
'page[number]': String(Math.max(1, (args.page as number) ?? 1)),
|
|
195
|
+
});
|
|
196
|
+
if (args.query) params.set('query', String(args.query));
|
|
197
|
+
if (args.resource_type) params.set('resource-type-id', String(args.resource_type).toLowerCase());
|
|
198
|
+
if (args.year) params.set('publication-year', String(args.year));
|
|
199
|
+
if (args.publisher) params.set('publisher', String(args.publisher));
|
|
200
|
+
if (args.affiliation) params.set('affiliation', String(args.affiliation));
|
|
201
|
+
|
|
202
|
+
const data = await dcFetch<{
|
|
203
|
+
data?: DoiResource[];
|
|
204
|
+
meta?: { total?: number; totalPages?: number };
|
|
205
|
+
}>('/dois', params);
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
total: data.meta?.total ?? 0,
|
|
209
|
+
total_pages: data.meta?.totalPages ?? 0,
|
|
210
|
+
returned: data.data?.length ?? 0,
|
|
211
|
+
results: (data.data ?? []).map(normalizeDoiSummary),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async function getDoi(doi: string) {
|
|
216
|
+
const data = await dcFetch<{ data?: DoiResource }>(`/dois/${encodeURIComponent(doi)}`);
|
|
217
|
+
if (!data.data) throw new Error(`DataCite: no record for DOI ${doi}`);
|
|
218
|
+
return normalizeDoiFull(data.data);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface RepoResource {
|
|
222
|
+
id?: string;
|
|
223
|
+
attributes?: {
|
|
224
|
+
name?: string;
|
|
225
|
+
symbol?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
url?: string;
|
|
228
|
+
re3data?: string;
|
|
229
|
+
repositoryType?: string[];
|
|
230
|
+
softwareType?: string;
|
|
231
|
+
domain?: string;
|
|
232
|
+
yearCreated?: number;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async function listRepositories(args: Record<string, unknown>) {
|
|
237
|
+
const params = new URLSearchParams({
|
|
238
|
+
'page[size]': String(Math.min(1000, Math.max(1, (args.page_size as number) ?? 25))),
|
|
239
|
+
'page[number]': String(Math.max(1, (args.page as number) ?? 1)),
|
|
240
|
+
});
|
|
241
|
+
if (args.query) params.set('query', String(args.query));
|
|
242
|
+
|
|
243
|
+
const data = await dcFetch<{
|
|
244
|
+
data?: RepoResource[];
|
|
245
|
+
meta?: { total?: number };
|
|
246
|
+
}>('/clients', params);
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
total: data.meta?.total ?? 0,
|
|
250
|
+
returned: data.data?.length ?? 0,
|
|
251
|
+
repositories: (data.data ?? []).map((r) => ({
|
|
252
|
+
id: r.id ?? null,
|
|
253
|
+
name: r.attributes?.name ?? null,
|
|
254
|
+
symbol: r.attributes?.symbol ?? null,
|
|
255
|
+
description: r.attributes?.description ?? null,
|
|
256
|
+
url: r.attributes?.url ?? null,
|
|
257
|
+
re3data_url: r.attributes?.re3data ?? null,
|
|
258
|
+
repository_types: r.attributes?.repositoryType ?? [],
|
|
259
|
+
domain: r.attributes?.domain ?? null,
|
|
260
|
+
year_created: r.attributes?.yearCreated ?? null,
|
|
261
|
+
})),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
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
|
+
}
|