scholar-sidekick-mcp 0.3.3 → 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/dist/mcp-server.mjs +61 -12
- package/package.json +1 -1
package/dist/mcp-server.mjs
CHANGED
|
@@ -22170,7 +22170,7 @@ var StdioServerTransport = class {
|
|
|
22170
22170
|
// src/types.ts
|
|
22171
22171
|
var FormatCitationInput = {
|
|
22172
22172
|
text: external_exports.string().describe(
|
|
22173
|
-
"One or more identifiers (DOIs, PMIDs, ISBNs, arXiv IDs, etc.) separated by newlines"
|
|
22173
|
+
"One or more identifiers (DOIs, PMIDs, ISBNs, arXiv IDs, etc.) separated by newlines or commas"
|
|
22174
22174
|
),
|
|
22175
22175
|
style: external_exports.string().optional().describe("Citation style: vancouver (default), ama, apa, ieee, cse, or any CSL style ID"),
|
|
22176
22176
|
lang: external_exports.string().optional().describe("Locale for formatting (e.g. en-US, en-GB, fr-FR)"),
|
|
@@ -22178,7 +22178,7 @@ var FormatCitationInput = {
|
|
|
22178
22178
|
output: external_exports.enum(["text", "html", "json"]).optional().describe("Output format (default: text)")
|
|
22179
22179
|
};
|
|
22180
22180
|
var ExportCitationInput = {
|
|
22181
|
-
text: external_exports.string().describe("One or more identifiers (DOIs, PMIDs, ISBNs, etc.) separated by newlines"),
|
|
22181
|
+
text: external_exports.string().describe("One or more identifiers (DOIs, PMIDs, ISBNs, etc.) separated by newlines or commas"),
|
|
22182
22182
|
format: external_exports.enum([
|
|
22183
22183
|
"bib",
|
|
22184
22184
|
"ris",
|
|
@@ -22196,7 +22196,7 @@ var ExportCitationInput = {
|
|
|
22196
22196
|
};
|
|
22197
22197
|
var ResolveIdentifierInput = {
|
|
22198
22198
|
text: external_exports.string().describe(
|
|
22199
|
-
"One or more identifiers to resolve (DOIs, PMIDs, PMCIDs, ISBNs, arXiv IDs, ISSNs, ADS bibcodes) separated by newlines"
|
|
22199
|
+
"One or more identifiers to resolve (DOIs, PMIDs, PMCIDs, ISBNs, arXiv IDs, ISSNs, ADS bibcodes) separated by newlines or commas"
|
|
22200
22200
|
)
|
|
22201
22201
|
};
|
|
22202
22202
|
var SCHOLAR_HEADER_NAMES = [
|
|
@@ -30075,6 +30075,9 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
30075
30075
|
};
|
|
30076
30076
|
|
|
30077
30077
|
// src/tools/helpers.ts
|
|
30078
|
+
function normalizeIdentifiers(text) {
|
|
30079
|
+
return text.includes(",") && !text.includes("\n") ? text.split(",").map((s) => s.trim()).filter(Boolean).join("\n") : text;
|
|
30080
|
+
}
|
|
30078
30081
|
function errorResult(result) {
|
|
30079
30082
|
const parts = [];
|
|
30080
30083
|
if (result.error) parts.push(result.error);
|
|
@@ -30084,6 +30087,22 @@ function errorResult(result) {
|
|
|
30084
30087
|
isError: true
|
|
30085
30088
|
};
|
|
30086
30089
|
}
|
|
30090
|
+
var MISSING_KEY_MESSAGE = [
|
|
30091
|
+
"Scholar Sidekick is not configured. Set the RAPIDAPI_KEY environment variable to use this tool.",
|
|
30092
|
+
"",
|
|
30093
|
+
"Get a free key:",
|
|
30094
|
+
" 1. Sign up at https://rapidapi.com/scholar-sidekick-scholar-sidekick-api/api/scholar-sidekick",
|
|
30095
|
+
" 2. Subscribe to the free tier and copy your RapidAPI key",
|
|
30096
|
+
" 3. Restart this MCP server with RAPIDAPI_KEY set",
|
|
30097
|
+
"",
|
|
30098
|
+
"If you installed via Claude Desktop, open the Scholar Sidekick extension settings and paste the key there."
|
|
30099
|
+
].join("\n");
|
|
30100
|
+
function missingKeyResult() {
|
|
30101
|
+
return {
|
|
30102
|
+
content: [{ type: "text", text: MISSING_KEY_MESSAGE }],
|
|
30103
|
+
isError: true
|
|
30104
|
+
};
|
|
30105
|
+
}
|
|
30087
30106
|
function buildMetadata(result) {
|
|
30088
30107
|
const meta3 = {};
|
|
30089
30108
|
if (result.requestId) meta3.requestId = result.requestId;
|
|
@@ -30105,8 +30124,9 @@ function registerExportTool(server, config2) {
|
|
|
30105
30124
|
inputSchema: ExportCitationInput
|
|
30106
30125
|
},
|
|
30107
30126
|
async (input) => {
|
|
30127
|
+
if (!config2.rapidApiKey) return missingKeyResult();
|
|
30108
30128
|
const result = await exportCitation(config2, {
|
|
30109
|
-
text: input.text,
|
|
30129
|
+
text: normalizeIdentifiers(input.text),
|
|
30110
30130
|
format: input.format,
|
|
30111
30131
|
style: input.style ?? void 0,
|
|
30112
30132
|
lang: input.lang ?? void 0
|
|
@@ -30131,8 +30151,9 @@ function registerFormatTool(server, config2) {
|
|
|
30131
30151
|
inputSchema: FormatCitationInput
|
|
30132
30152
|
},
|
|
30133
30153
|
async (input) => {
|
|
30154
|
+
if (!config2.rapidApiKey) return missingKeyResult();
|
|
30134
30155
|
const result = await formatCitation(config2, {
|
|
30135
|
-
text: input.text,
|
|
30156
|
+
text: normalizeIdentifiers(input.text),
|
|
30136
30157
|
style: input.style ?? void 0,
|
|
30137
30158
|
lang: input.lang ?? void 0,
|
|
30138
30159
|
footnote: input.footnote ?? void 0,
|
|
@@ -30167,8 +30188,9 @@ function registerResolveTool(server, config2) {
|
|
|
30167
30188
|
inputSchema: ResolveIdentifierInput
|
|
30168
30189
|
},
|
|
30169
30190
|
async (input) => {
|
|
30191
|
+
if (!config2.rapidApiKey) return missingKeyResult();
|
|
30170
30192
|
const result = await formatCitation(config2, {
|
|
30171
|
-
text: input.text,
|
|
30193
|
+
text: normalizeIdentifiers(input.text),
|
|
30172
30194
|
output: "json"
|
|
30173
30195
|
});
|
|
30174
30196
|
if (!result.ok || result.data?.ok === false) {
|
|
@@ -30191,13 +30213,34 @@ function registerResolveTool(server, config2) {
|
|
|
30191
30213
|
|
|
30192
30214
|
// src/server.ts
|
|
30193
30215
|
var SERVER_NAME = "scholar-sidekick";
|
|
30194
|
-
var SERVER_VERSION = "0.
|
|
30216
|
+
var SERVER_VERSION = "0.4.0";
|
|
30217
|
+
var SERVER_INSTRUCTIONS = `Scholar Sidekick MCP turns academic identifiers into clean citations.
|
|
30218
|
+
|
|
30219
|
+
When to use this server:
|
|
30220
|
+
- The user mentions a bibliographic identifier \u2014 DOI, PMID, PMCID, ISBN, arXiv ID, ISSN, or ADS bibcode
|
|
30221
|
+
- The user asks to format references in a citation style (Vancouver, APA, AMA, IEEE, Chicago, Harvard, MLA, Nature, BMJ, Lancet, or any of 10,000+ CSL styles)
|
|
30222
|
+
- The user asks to export a bibliography to BibTeX, RIS, EndNote, RefWorks, MEDLINE, Zotero RDF, CSL JSON, or CSV
|
|
30223
|
+
|
|
30224
|
+
Tool selection:
|
|
30225
|
+
- resolveIdentifier \u2014 when the user wants raw structured metadata (returns CSL JSON: title, authors, journal, year, identifiers)
|
|
30226
|
+
- formatCitation \u2014 when the user wants a human-readable citation in a specific style (returns text, HTML, or JSON)
|
|
30227
|
+
- exportCitation \u2014 when the user wants a downloadable bibliography file (returns the file contents as a string)
|
|
30228
|
+
|
|
30229
|
+
Tips:
|
|
30230
|
+
- All tools accept multiple identifiers separated by newlines or commas \u2014 batch when possible to save calls
|
|
30231
|
+
- Pass identifiers verbatim. The server tolerates DOI URLs (https://doi.org/...), "PMID:" / "PMC" prefixes, "arXiv:" prefixes, and ISBN hyphens
|
|
30232
|
+
- Default style for formatCitation is Vancouver. If the user does not name a style, ask before defaulting`;
|
|
30195
30233
|
function createMcpServer(config2) {
|
|
30196
30234
|
const cfg = config2 ?? createConfig();
|
|
30197
|
-
const server = new McpServer(
|
|
30198
|
-
|
|
30199
|
-
|
|
30200
|
-
|
|
30235
|
+
const server = new McpServer(
|
|
30236
|
+
{
|
|
30237
|
+
name: SERVER_NAME,
|
|
30238
|
+
version: SERVER_VERSION
|
|
30239
|
+
},
|
|
30240
|
+
{
|
|
30241
|
+
instructions: SERVER_INSTRUCTIONS
|
|
30242
|
+
}
|
|
30243
|
+
);
|
|
30201
30244
|
registerFormatTool(server, cfg);
|
|
30202
30245
|
registerExportTool(server, cfg);
|
|
30203
30246
|
registerResolveTool(server, cfg);
|
|
@@ -30227,7 +30270,13 @@ async function checkConnection(baseUrl) {
|
|
|
30227
30270
|
}
|
|
30228
30271
|
async function main() {
|
|
30229
30272
|
const config2 = createConfig();
|
|
30230
|
-
|
|
30273
|
+
if (config2.rapidApiKey) {
|
|
30274
|
+
await checkConnection(config2.baseUrl);
|
|
30275
|
+
} else {
|
|
30276
|
+
process.stderr.write(
|
|
30277
|
+
"Scholar Sidekick MCP started without RAPIDAPI_KEY \u2014 tools will return a configuration message until a key is set. Get one at https://rapidapi.com/scholar-sidekick-scholar-sidekick-api/api/scholar-sidekick\n"
|
|
30278
|
+
);
|
|
30279
|
+
}
|
|
30231
30280
|
const server = createMcpServer(config2);
|
|
30232
30281
|
const transport = new StdioServerTransport();
|
|
30233
30282
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scholar-sidekick-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"mcpName": "io.github.mlava/scholar-sidekick-mcp",
|
|
5
5
|
"description": "MCP server for Scholar Sidekick — resolve, format, and export academic citations from any AI assistant",
|
|
6
6
|
"license": "MIT",
|