@deventerprisesoftware/scrapi-mcp 0.2.0 → 0.2.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 +6 -12
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { z } from "zod";
|
|
|
8
8
|
const PORT = process.env.PORT || 5000;
|
|
9
9
|
const SCRAPI_API_KEY = process.env.SCRAPI_API_KEY || "00000000-0000-0000-0000-000000000000";
|
|
10
10
|
const SCRAPI_SERVER_NAME = "ScrAPI MCP Server";
|
|
11
|
-
const SCRAPI_SERVER_VERSION = "0.2.
|
|
11
|
+
const SCRAPI_SERVER_VERSION = "0.2.1";
|
|
12
12
|
const app = express();
|
|
13
13
|
app.use(cors({
|
|
14
14
|
origin: "*",
|
|
@@ -135,6 +135,9 @@ export default function createServer({ config, }) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
try {
|
|
138
|
+
const requestBody = JSON.stringify(body);
|
|
139
|
+
console.log(`Using ScrAPI on URL: ${url} with format: ${format}`);
|
|
140
|
+
console.log(`Request body: ${requestBody}`);
|
|
138
141
|
const response = await fetch("https://api.scrapi.tech/v1/scrape", {
|
|
139
142
|
method: "POST",
|
|
140
143
|
headers: {
|
|
@@ -142,7 +145,7 @@ export default function createServer({ config, }) {
|
|
|
142
145
|
"Content-Type": "application/json",
|
|
143
146
|
"X-API-KEY": config.scrapiApiKey || SCRAPI_API_KEY,
|
|
144
147
|
},
|
|
145
|
-
body:
|
|
148
|
+
body: requestBody,
|
|
146
149
|
signal: AbortSignal.timeout(300000),
|
|
147
150
|
});
|
|
148
151
|
const data = await response.text();
|
|
@@ -216,15 +219,6 @@ app.all("/mcp", async (req, res) => {
|
|
|
216
219
|
}
|
|
217
220
|
}
|
|
218
221
|
});
|
|
219
|
-
app.options("/*", (req, res) => {
|
|
220
|
-
const reqHeaders = req.header("access-control-request-headers");
|
|
221
|
-
if (reqHeaders) {
|
|
222
|
-
res.setHeader("Access-Control-Allow-Headers", reqHeaders);
|
|
223
|
-
}
|
|
224
|
-
res.setHeader("Access-Control-Allow-Methods", "GET,POST,OPTIONS");
|
|
225
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
226
|
-
res.sendStatus(204);
|
|
227
|
-
});
|
|
228
222
|
// Main function to start the server in the appropriate mode
|
|
229
223
|
async function main() {
|
|
230
224
|
const transport = process.env.TRANSPORT || "stdio";
|
|
@@ -245,7 +239,7 @@ async function main() {
|
|
|
245
239
|
// Start receiving messages on stdin and sending messages on stdout
|
|
246
240
|
const stdioTransport = new StdioServerTransport();
|
|
247
241
|
await server.connect(stdioTransport);
|
|
248
|
-
console.
|
|
242
|
+
console.log("MCP Server running in stdio mode");
|
|
249
243
|
}
|
|
250
244
|
}
|
|
251
245
|
// Start the server
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deventerprisesoftware/scrapi-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "MCP server for using ScrAPI to scrape web pages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/cors": "^2.8.19",
|
|
47
47
|
"@types/express": "^5.0.6",
|
|
48
|
-
"@types/node": "^25.0.
|
|
48
|
+
"@types/node": "^25.0.6",
|
|
49
49
|
"shx": "^0.4.0",
|
|
50
50
|
"typescript": "^5.9.3"
|
|
51
51
|
}
|