sciverse-mcp-server 0.7.2 → 0.8.1
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 +1 -1
- package/dist/generated/tools.d.ts +1 -1
- package/dist/generated/tools.js +96 -2
- package/dist/tools.js +26 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ default (`https://api.sciverse.space`).
|
|
|
88
88
|
|
|
89
89
|
| Tool | Purpose |
|
|
90
90
|
|---|---|
|
|
91
|
-
| `search_papers` | Structured metadata search
|
|
91
|
+
| `search_papers` | Structured metadata search over papers / authors / sources (set `collection`) |
|
|
92
92
|
| `semantic_search` | Natural-language semantic chunk retrieval (RAG) |
|
|
93
93
|
| `read_content` | Byte-range read of original paper text |
|
|
94
94
|
| `list_catalog` | Field introspection (returns all field names + enum sample values, agents should call this first to learn the schema) |
|
package/dist/generated/tools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Auto-generated by scripts/gen-tools.mjs. Do not edit.
|
|
2
2
|
// Source of truth: openapi.yaml
|
|
3
|
-
export const TOOLS_VERSION = "0.
|
|
3
|
+
export const TOOLS_VERSION = "0.8.1";
|
|
4
4
|
export const TOOLS = [
|
|
5
5
|
{
|
|
6
6
|
"name": "search_papers",
|
|
@@ -8,6 +8,17 @@ export const TOOLS = [
|
|
|
8
8
|
"inputSchema": {
|
|
9
9
|
"type": "object",
|
|
10
10
|
"properties": {
|
|
11
|
+
"collection": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": [
|
|
14
|
+
"papers",
|
|
15
|
+
"authors",
|
|
16
|
+
"sources"
|
|
17
|
+
],
|
|
18
|
+
"default": "papers",
|
|
19
|
+
"description": "检索的实体集合。papers(默认,论文)/ authors(作者)/ sources(来源期刊)。 各 collection 字段集不同,用 list_catalog(collection=<name>)学习对应 schema。 注意:本工具的便捷字段(authors/journals/year_from/subjects 等)只对 papers 有意义; 查 authors/sources 时改用 filters_advanced + 该 collection 的字段名(如 authors 的 summary_stats.h_index / orcid,sources 的 issn / is_oa)。authors 用 orcid、 sources 用 issn 与论文检索结果关联。",
|
|
20
|
+
"x-en-description": "Entity collection to search. papers (default) / authors / sources. Each collection has its own field schema — call list_catalog(collection=<name>). The convenience fields (authors/journals/year_from/subjects) apply to papers only; for authors/sources use filters_advanced with that collection's field names."
|
|
21
|
+
},
|
|
11
22
|
"query": {
|
|
12
23
|
"type": "string",
|
|
13
24
|
"description": "BM25 全文关键词,匹配标题/摘要/期刊名/关键词字段。留空则纯靠结构化过滤。"
|
|
@@ -64,6 +75,7 @@ export const TOOLS = [
|
|
|
64
75
|
},
|
|
65
76
|
"operator": {
|
|
66
77
|
"type": "string",
|
|
78
|
+
"description": "过滤操作符。MATCH(分词模糊)适用于 author、keywords(输入 \"Hinton\" 命中 \"Geoffrey Hinton\"); MATCH_PHRASE(短语模糊)适用于 publication_venue_name_unified,整词连续匹配(\"Nature\" 命中 \"Nature Communications\";非前缀匹配,\"Nature Comm\" 不会命中); doi 用 EQ,服务端归一化(去 doi.org 前缀+转小写)后精确匹配。MATCH/MATCH_PHRASE 仅对配了 text 子字段的字段有效。",
|
|
67
79
|
"enum": [
|
|
68
80
|
"FILTER_OP_EQ",
|
|
69
81
|
"FILTER_OP_NE",
|
|
@@ -73,7 +85,9 @@ export const TOOLS = [
|
|
|
73
85
|
"FILTER_OP_LTE",
|
|
74
86
|
"FILTER_OP_IN",
|
|
75
87
|
"FILTER_OP_NIN",
|
|
76
|
-
"FILTER_OP_CONTAINS"
|
|
88
|
+
"FILTER_OP_CONTAINS",
|
|
89
|
+
"FILTER_OP_MATCH",
|
|
90
|
+
"FILTER_OP_MATCH_PHRASE"
|
|
77
91
|
],
|
|
78
92
|
"default": "FILTER_OP_EQ"
|
|
79
93
|
},
|
|
@@ -81,6 +95,30 @@ export const TOOLS = [
|
|
|
81
95
|
}
|
|
82
96
|
}
|
|
83
97
|
},
|
|
98
|
+
"sort_advanced": {
|
|
99
|
+
"type": "array",
|
|
100
|
+
"description": "高级排序逃生舱(按任意可排序字段)。papers 用 sort_by_year 即可; authors/sources 想按 h-index / 被引 / works_count 排序时用本字段。 与 query 互斥(query 走相关性排序)。",
|
|
101
|
+
"items": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"required": [
|
|
104
|
+
"field",
|
|
105
|
+
"order"
|
|
106
|
+
],
|
|
107
|
+
"properties": {
|
|
108
|
+
"field": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"order": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"enum": [
|
|
114
|
+
"SORT_ORDER_DESC",
|
|
115
|
+
"SORT_ORDER_ASC"
|
|
116
|
+
],
|
|
117
|
+
"default": "SORT_ORDER_DESC"
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
84
122
|
"sort_by_year": {
|
|
85
123
|
"type": "string",
|
|
86
124
|
"enum": [
|
|
@@ -164,15 +202,67 @@ export const TOOLS = [
|
|
|
164
202
|
"inputSchema": {
|
|
165
203
|
"type": "object",
|
|
166
204
|
"properties": {
|
|
205
|
+
"collection": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"enum": [
|
|
208
|
+
"papers",
|
|
209
|
+
"authors",
|
|
210
|
+
"sources"
|
|
211
|
+
],
|
|
212
|
+
"default": "papers",
|
|
213
|
+
"description": "字段 catalog 所属实体集合。papers(默认)/ authors / sources,各 collection 字段不同。"
|
|
214
|
+
},
|
|
167
215
|
"include_sample_values": {
|
|
168
216
|
"type": "boolean",
|
|
169
217
|
"default": false,
|
|
170
218
|
"description": "是否拉取 enum-like 字段的取值样本。false 仅返回静态 schema(毫秒级);true 触发 OpenSearch terms agg(首次几百毫秒,之后 24h 走缓存)。"
|
|
219
|
+
},
|
|
220
|
+
"include_field_stats": {
|
|
221
|
+
"type": "boolean",
|
|
222
|
+
"default": false,
|
|
223
|
+
"description": "是否返回字段统计(keyword 字段基数 + 数值字段 min/max/avg/p50/p95)。触发 OpenSearch 聚合,缓存 24h。"
|
|
171
224
|
}
|
|
172
225
|
},
|
|
173
226
|
"required": []
|
|
174
227
|
}
|
|
175
228
|
},
|
|
229
|
+
{
|
|
230
|
+
"name": "list_paper_relations",
|
|
231
|
+
"description": "Paginate the full relation list of a paper. citations/references/related_works\nare unbounded arrays (a highly-cited paper can have thousands); search_papers\nonly inlines a truncated few, so use this endpoint for the full list.\nUse when: \"What does paper X cite?\" (relation=REFERENCES), \"Which papers cite\npaper X?\" (relation=CITATIONS), \"Works related to paper X\" (relation=RELATED_WORKS).\nNote: CITATIONS (incoming: who cites me) and REFERENCES (outgoing: who I cite)\nare opposite directions.\nTypical chain: get unique_id from search_papers / semantic_search, then paginate\nhere by relation.",
|
|
232
|
+
"inputSchema": {
|
|
233
|
+
"type": "object",
|
|
234
|
+
"required": [
|
|
235
|
+
"unique_id",
|
|
236
|
+
"relation"
|
|
237
|
+
],
|
|
238
|
+
"properties": {
|
|
239
|
+
"unique_id": {
|
|
240
|
+
"type": "string",
|
|
241
|
+
"description": "目标论文 unique_id(如 paper:10.1038/xxx),来自 search_papers / semantic_search;勿传 doc_id。"
|
|
242
|
+
},
|
|
243
|
+
"relation": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"enum": [
|
|
246
|
+
"CITATIONS",
|
|
247
|
+
"REFERENCES",
|
|
248
|
+
"RELATED_WORKS"
|
|
249
|
+
],
|
|
250
|
+
"description": "关系类型。CITATIONS=被引(谁引用了我);REFERENCES=参考文献(我引用了谁);RELATED_WORKS=相关工作。"
|
|
251
|
+
},
|
|
252
|
+
"page": {
|
|
253
|
+
"type": "integer",
|
|
254
|
+
"default": 1,
|
|
255
|
+
"minimum": 1
|
|
256
|
+
},
|
|
257
|
+
"page_size": {
|
|
258
|
+
"type": "integer",
|
|
259
|
+
"default": 25,
|
|
260
|
+
"minimum": 1,
|
|
261
|
+
"maximum": 200
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
},
|
|
176
266
|
{
|
|
177
267
|
"name": "read_content",
|
|
178
268
|
"description": "Read a UTF-8 byte range of a paper's original text. Typically used with\na doc_id/offset returned by semantic_search to expand context (read\nmore bytes before or after a chunk).\nReturns: text fragment, bytes_returned, next_offset, more (boolean).",
|
|
@@ -230,6 +320,10 @@ export const ENDPOINTS = {
|
|
|
230
320
|
"method": "GET",
|
|
231
321
|
"path": "/meta-catalog"
|
|
232
322
|
},
|
|
323
|
+
"list_paper_relations": {
|
|
324
|
+
"method": "POST",
|
|
325
|
+
"path": "/meta-paper-relations"
|
|
326
|
+
},
|
|
233
327
|
"read_content": {
|
|
234
328
|
"method": "GET",
|
|
235
329
|
"path": "/content"
|
package/dist/tools.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// 后续如有第 4 处复制,再用 codegen 收敛。
|
|
6
6
|
import { ENDPOINTS } from "./generated/tools.js";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
|
-
const PASSTHROUGH = ["query", "page", "page_size", "fields"];
|
|
8
|
+
const PASSTHROUGH = ["query", "page", "page_size", "fields", "collection"];
|
|
9
9
|
function toBackendPayload(args) {
|
|
10
10
|
const out = {};
|
|
11
11
|
const filters = [];
|
|
@@ -46,6 +46,12 @@ function toBackendPayload(args) {
|
|
|
46
46
|
order: sortByYear === "desc" ? "SORT_ORDER_DESC" : "SORT_ORDER_ASC",
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
if (Array.isArray(args.sort_advanced)) {
|
|
50
|
+
for (const item of args.sort_advanced) {
|
|
51
|
+
if (item && item.field)
|
|
52
|
+
sort.push({ field: item.field, order: item.order ?? "SORT_ORDER_DESC" });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
49
55
|
if (filters.length > 0)
|
|
50
56
|
out.filters = filters;
|
|
51
57
|
if (sort.length > 0)
|
|
@@ -149,10 +155,15 @@ export async function executeTool(config, name, args) {
|
|
|
149
155
|
case "semantic_search":
|
|
150
156
|
return call(config, "POST", endpoint.path, { body: args });
|
|
151
157
|
case "list_catalog": {
|
|
152
|
-
const { include_sample_values } = args;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
158
|
+
const { include_sample_values, include_field_stats, collection } = args;
|
|
159
|
+
const query = {
|
|
160
|
+
include_sample_values: String(Boolean(include_sample_values)),
|
|
161
|
+
};
|
|
162
|
+
if (include_field_stats)
|
|
163
|
+
query.include_field_stats = "true";
|
|
164
|
+
if (collection)
|
|
165
|
+
query.collection = collection;
|
|
166
|
+
return call(config, "GET", endpoint.path, { query });
|
|
156
167
|
}
|
|
157
168
|
case "read_content": {
|
|
158
169
|
const { doc_id, offset, limit } = args;
|
|
@@ -174,6 +185,16 @@ export async function executeTool(config, name, args) {
|
|
|
174
185
|
}
|
|
175
186
|
return callBinary(config, endpoint.path, { file_name });
|
|
176
187
|
}
|
|
188
|
+
case "list_paper_relations": {
|
|
189
|
+
const { unique_id, relation } = args;
|
|
190
|
+
if (!unique_id || !relation) {
|
|
191
|
+
return {
|
|
192
|
+
isError: true,
|
|
193
|
+
content: [{ type: "text", text: JSON.stringify({ error: "unique_id and relation are required" }) }],
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return call(config, "POST", endpoint.path, { body: args });
|
|
197
|
+
}
|
|
177
198
|
default:
|
|
178
199
|
return {
|
|
179
200
|
isError: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sciverse-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Sciverse MCP server — exposes academic paper retrieval (search_papers / semantic_search / read_content) to MCP-compatible coding agents (Claude Code, Cursor, Codex CLI, Windsurf, ...).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/opendatalab/Sciverse-Agent-Tools/tree/main/packages/mcp",
|