@scrapi.ai/mcp-server 2.0.3 → 2.0.5
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 +4 -4
- package/dist/http.js +58 -11
- package/dist/http.js.map +1 -1
- package/dist/utils/api.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark-horizontal.png">
|
|
4
|
-
<source media="(prefers-color-scheme: light)" srcset="assets/logo-white-horizontal.png">
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark-horizontal-trans.png">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/logo-white-horizontal-trans.png">
|
|
5
5
|
<img alt="Scrapi AI" src="assets/logo-white-horizontal.png" width="360">
|
|
6
6
|
</picture>
|
|
7
7
|
</p>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
20
20
|
</p>
|
|
21
21
|
|
|
22
|
-
**⚡ Fast & Reliable** — Built on
|
|
22
|
+
**⚡ Fast & Reliable** — Built on 8+ years of web scraping expertise, 1,900+ production crawlers, and battle-tested anti-bot handling.
|
|
23
23
|
|
|
24
24
|
## What is this?
|
|
25
25
|
|
|
@@ -684,7 +684,7 @@ export class ExampleApiClient {
|
|
|
684
684
|
|
|
685
685
|
## Why Scrapi?
|
|
686
686
|
|
|
687
|
-
Built by the team behind [Scrapi](https://scrapi.ai), with
|
|
687
|
+
Built by the team behind [Scrapi](https://scrapi.ai), with 8+ years of web scraping experience:
|
|
688
688
|
|
|
689
689
|
- ✅ 1,900+ production crawlers
|
|
690
690
|
- ✅ JavaScript rendering support
|
package/dist/http.js
CHANGED
|
@@ -3,8 +3,13 @@ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/
|
|
|
3
3
|
import { createMcpExpressApp } from "@modelcontextprotocol/sdk/server/express.js";
|
|
4
4
|
import { createMcpServer } from "./server.js";
|
|
5
5
|
const PORT = parseInt(process.env.PORT || "3000", 10);
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const BIND = process.env.BIND || "127.0.0.1";
|
|
7
|
+
const ALLOWED_HOSTS = process.env.ALLOWED_HOSTS
|
|
8
|
+
? process.env.ALLOWED_HOSTS.split(",")
|
|
9
|
+
: undefined;
|
|
10
|
+
const app = createMcpExpressApp(ALLOWED_HOSTS
|
|
11
|
+
? { host: BIND, allowedHosts: ALLOWED_HOSTS }
|
|
12
|
+
: { host: BIND });
|
|
8
13
|
// ── Stats ──────────────────────────────────────
|
|
9
14
|
const stats = {
|
|
10
15
|
startedAt: new Date(),
|
|
@@ -63,13 +68,55 @@ app.post("/api", async (req, res) => {
|
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
});
|
|
66
|
-
// GET
|
|
67
|
-
app.get("/api", (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
// GET /api — browser-friendly landing page
|
|
72
|
+
app.get("/api", (req, res) => {
|
|
73
|
+
const accept = req.headers.accept || "";
|
|
74
|
+
if (!accept.includes("text/html")) {
|
|
75
|
+
res.status(405).json({
|
|
76
|
+
jsonrpc: "2.0",
|
|
77
|
+
error: { code: -32000, message: "Method not allowed. Use POST for MCP requests." },
|
|
78
|
+
id: null,
|
|
79
|
+
});
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
res.status(200).send(`<!DOCTYPE html>
|
|
83
|
+
<html lang="en">
|
|
84
|
+
<head>
|
|
85
|
+
<meta charset="utf-8">
|
|
86
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
87
|
+
<title>Scrapi MCP Server</title>
|
|
88
|
+
<style>
|
|
89
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
90
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #0a0a0a; color: #e5e5e5; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
|
|
91
|
+
.container { max-width: 560px; padding: 2.5rem; text-align: center; }
|
|
92
|
+
.logo { font-size: 2rem; font-weight: 700; color: #fff; margin-bottom: 0.5rem; }
|
|
93
|
+
.logo span { color: #6366f1; }
|
|
94
|
+
.badge { display: inline-block; background: #1e1b4b; color: #a5b4fc; font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.75rem; border-radius: 9999px; margin-bottom: 1.5rem; letter-spacing: 0.05em; }
|
|
95
|
+
p { color: #a3a3a3; line-height: 1.7; margin-bottom: 1.25rem; font-size: 0.95rem; }
|
|
96
|
+
.endpoint { background: #171717; border: 1px solid #262626; border-radius: 0.5rem; padding: 1rem; margin: 1.5rem 0; font-family: 'SF Mono', Monaco, monospace; font-size: 0.85rem; color: #a5b4fc; word-break: break-all; }
|
|
97
|
+
.links { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; flex-wrap: wrap; }
|
|
98
|
+
.links a { color: #818cf8; text-decoration: none; font-size: 0.875rem; font-weight: 500; padding: 0.5rem 1rem; border: 1px solid #312e81; border-radius: 0.375rem; transition: all 0.15s; }
|
|
99
|
+
.links a:hover { background: #1e1b4b; border-color: #4338ca; }
|
|
100
|
+
.divider { border: none; border-top: 1px solid #262626; margin: 1.5rem 0; }
|
|
101
|
+
code { background: #171717; padding: 0.15rem 0.4rem; border-radius: 0.25rem; font-size: 0.85rem; color: #c4b5fd; }
|
|
102
|
+
</style>
|
|
103
|
+
</head>
|
|
104
|
+
<body>
|
|
105
|
+
<div class="container">
|
|
106
|
+
<div class="logo">Scrapi<span>.ai</span></div>
|
|
107
|
+
<div class="badge">MCP STREAMABLE HTTP</div>
|
|
108
|
+
<p>This is a <strong>Model Context Protocol</strong> endpoint for AI agents. It accepts <code>POST</code> requests only and is not meant to be opened in a browser.</p>
|
|
109
|
+
<div class="endpoint">POST https://scrapi.ai/api</div>
|
|
110
|
+
<p>Connect your AI client (Claude Desktop, Cursor, Windsurf, etc.) to this endpoint to start scraping the web with AI.</p>
|
|
111
|
+
<hr class="divider">
|
|
112
|
+
<div class="links">
|
|
113
|
+
<a href="https://scrapi.ai">Homepage</a>
|
|
114
|
+
<a href="https://github.com/bamchi/scrapi-mcp-server">GitHub</a>
|
|
115
|
+
<a href="https://www.npmjs.com/package/@scrapi.ai/mcp-server">npm</a>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</body>
|
|
119
|
+
</html>`);
|
|
73
120
|
});
|
|
74
121
|
app.delete("/api", (_req, res) => {
|
|
75
122
|
res.status(405).json({
|
|
@@ -79,8 +126,8 @@ app.delete("/api", (_req, res) => {
|
|
|
79
126
|
});
|
|
80
127
|
});
|
|
81
128
|
// ── Start server ───────────────────────────────
|
|
82
|
-
app.listen(PORT,
|
|
83
|
-
console.error(`Scrapi MCP server running on http://${
|
|
129
|
+
app.listen(PORT, BIND, () => {
|
|
130
|
+
console.error(`Scrapi MCP server running on http://${BIND}:${PORT}/api`);
|
|
84
131
|
});
|
|
85
132
|
process.on("SIGINT", () => {
|
|
86
133
|
console.error("Shutting down...");
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,WAAW,CA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AAO;IACT,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCf,CAAC,CAAC;AACV,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,IAAa,EAAE,GAAa,EAAE,EAAE;IAClD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,qBAAqB,EAAE;QACvD,EAAE,EAAE,IAAI;KACT,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,kDAAkD;AAClD,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;IAC1B,OAAO,CAAC,KAAK,CAAC,uCAAuC,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC;AAC3E,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/utils/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
const API_URL = process.env.SCRAPI_API_URL || process.env.HASHSCRAPER_API_URL || "https://
|
|
2
|
+
const API_URL = process.env.SCRAPI_API_URL || process.env.HASHSCRAPER_API_URL || "https://www.hashscraper.com";
|
|
3
3
|
const API_KEY = process.env.SCRAPI_API_KEY || process.env.HASHSCRAPER_API_KEY;
|
|
4
4
|
// 디버그용: 현재 사용 중인 API URL 반환
|
|
5
5
|
export function getApiUrl() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scrapi.ai/mcp-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Scrapi MCP Server - Web scraping for AI agents. Bypass anti-bot systems and get clean, LLM-ready content via MCP protocol.",
|
|
5
5
|
"mcpName": "io.github.bamchi/scrapi",
|
|
6
6
|
"type": "module",
|