scraper-api-mcp 0.1.0 → 0.1.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/dist/index.js +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.js
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { realpathSync } from "node:fs";
|
|
5
6
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
8
|
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
@@ -2930,7 +2931,7 @@ async function callApi(path, params) {
|
|
|
2930
2931
|
}
|
|
2931
2932
|
function createServer() {
|
|
2932
2933
|
const server = new Server(
|
|
2933
|
-
{ name: "scraper-api", version: "0.1.
|
|
2934
|
+
{ name: "scraper-api", version: "0.1.1" },
|
|
2934
2935
|
{ capabilities: { tools: {} }, instructions: SERVER_INSTRUCTIONS }
|
|
2935
2936
|
);
|
|
2936
2937
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
@@ -2966,7 +2967,16 @@ async function main() {
|
|
|
2966
2967
|
process.stderr.write(`scraper-api MCP server ready (${TOOLS.length} tools).
|
|
2967
2968
|
`);
|
|
2968
2969
|
}
|
|
2969
|
-
|
|
2970
|
+
function isDirectRun() {
|
|
2971
|
+
const entry = process.argv[1];
|
|
2972
|
+
if (!entry) return false;
|
|
2973
|
+
try {
|
|
2974
|
+
return import.meta.url === pathToFileURL(realpathSync(entry)).href;
|
|
2975
|
+
} catch {
|
|
2976
|
+
return import.meta.url === pathToFileURL(entry).href;
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
if (isDirectRun()) {
|
|
2970
2980
|
main().catch((err) => {
|
|
2971
2981
|
process.stderr.write(`${err?.message ?? err}
|
|
2972
2982
|
`);
|
package/package.json
CHANGED