scrapeless-mcp-server 0.1.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/README.md +89 -0
- package/build/client.js +27 -0
- package/build/config.js +12 -0
- package/build/index.js +14 -0
- package/build/server.js +28 -0
- package/package.json +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://avatars.githubusercontent.com/u/189844671" width="120" height="120" alt="Scrapeless Logo" />
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
# Scrapeless Mcp Server
|
|
6
|
+
|
|
7
|
+
A Model Context Protocol (MCP) server implementation for Scrapeless, providing advanced search capabilities.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This project provides several MCP servers that enable AI assistants like Claude to perform various search operations and retrieve data from:
|
|
12
|
+
|
|
13
|
+
- Google Search
|
|
14
|
+
|
|
15
|
+
## Tools
|
|
16
|
+
|
|
17
|
+
### 1. Search Tool
|
|
18
|
+
- Name: `google-search`
|
|
19
|
+
- Description: Search the web using Scrapeless
|
|
20
|
+
- Parameters:
|
|
21
|
+
* `query` (required): Parameter defines the query you want to search. You can use anything that you would use in a regular Google search. e.g. inurl:, site:, intitle:.
|
|
22
|
+
* `gl` (optional, default: "us"): Parameter defines the country to use for the Google search. It's a two-letter country code. (e.g., us for the United States, uk for United Kingdom, or fr for France).
|
|
23
|
+
* `hl` (optional, default: "en"): Parameter defines the language to use for the Google search. It's a two-letter language code. (e.g., en for English, es for Spanish, or fr for French).
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Setup Guide
|
|
27
|
+
|
|
28
|
+
### 1. Get Scrapeless Key
|
|
29
|
+
1. Register at [Scrapeless](https://app.scrapeless.com/passport/register?utm_source=github&utm_medium=mcp)
|
|
30
|
+
2. [Get your free trial](https://app.scrapeless.com/landing/guide?utm_source=github&utm_medium=mcp)
|
|
31
|
+
3. [Generate API Key](https://app.scrapeless.com/dashboard/settings/api-key?utm_source=github&utm_medium=mcp)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### 2. Configure
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"scrapelessMcpServer": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ["-y", "scrapeless-mcp-server"],
|
|
42
|
+
"env": {
|
|
43
|
+
"SCRAPELESS_KEY": "YOUR_SCRAPELESS_KEY"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Example Queries
|
|
52
|
+
|
|
53
|
+
Here are some examples of how to use these servers with Claude Desktop:
|
|
54
|
+
|
|
55
|
+
### Google Search
|
|
56
|
+
```
|
|
57
|
+
Please search for "climate change solutions" and summarize the top results.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Installation
|
|
62
|
+
|
|
63
|
+
### Prerequisites
|
|
64
|
+
|
|
65
|
+
- Node.js 22 or higher
|
|
66
|
+
- NPM or Yarn
|
|
67
|
+
|
|
68
|
+
### Install from Source
|
|
69
|
+
|
|
70
|
+
1. Clone the repository:
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/scrapeless-ai/scrapeless-mcp-server.git
|
|
73
|
+
cd scrapeless-mcp-server
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. Install dependencies:
|
|
77
|
+
```bash
|
|
78
|
+
npm install
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
3. Build the server:
|
|
83
|
+
```bash
|
|
84
|
+
npm run build
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## Community
|
|
89
|
+
- [MCP Server Discord](https://backend.scrapeless.com/app/api/v1/public/links/discord)
|
package/build/client.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
export class ScrapelessClient {
|
|
3
|
+
api;
|
|
4
|
+
constructor(config) {
|
|
5
|
+
this.api = axios.create({
|
|
6
|
+
baseURL: config.baseURL,
|
|
7
|
+
headers: {
|
|
8
|
+
"Content-Type": "application/json",
|
|
9
|
+
"x-api-token": config.token,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async sendRequest(endpoint, actor, inputData) {
|
|
14
|
+
try {
|
|
15
|
+
const response = await this.api.post(endpoint, { actor, input: inputData });
|
|
16
|
+
return {
|
|
17
|
+
content: [{ type: "text", text: `Response:\n\n${JSON.stringify(response.data, null, 2)}` }],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error("Scrapeless API Error:", error);
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: "text", text: `Failed to fetch data. Error: ${error.message}` }],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
package/build/config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const API_KEY = process.env.SCRAPELESS_KEY?.trim();
|
|
2
|
+
const BASE_URL = process.env.SCRAPELESS_BASE_URL?.trim() || "https://api.scrapeless.com";
|
|
3
|
+
if (!API_KEY) {
|
|
4
|
+
throw new Error("❌ Missing environment variable: SCRAPELESS_KEY");
|
|
5
|
+
}
|
|
6
|
+
export const TOOL_ENDPOINTS = {
|
|
7
|
+
SCRAPER: "/api/v1/scraper/request",
|
|
8
|
+
};
|
|
9
|
+
export const SCRAPELESS_CONFIG = {
|
|
10
|
+
baseURL: BASE_URL,
|
|
11
|
+
token: API_KEY,
|
|
12
|
+
};
|
package/build/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { server } from "./server.js";
|
|
4
|
+
async function main() {
|
|
5
|
+
try {
|
|
6
|
+
const transport = new StdioServerTransport();
|
|
7
|
+
await server.connect(transport);
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
console.error("Fatal error in main():", error);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
main();
|
package/build/server.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ScrapelessClient } from "./client.js";
|
|
4
|
+
import { SCRAPELESS_CONFIG, TOOL_ENDPOINTS } from "./config.js";
|
|
5
|
+
const scrapelessClient = new ScrapelessClient(SCRAPELESS_CONFIG);
|
|
6
|
+
export const server = new McpServer({
|
|
7
|
+
name: "scrapeless-mcp-server",
|
|
8
|
+
version: "0.1.0",
|
|
9
|
+
capabilities: { resources: {}, tools: {} },
|
|
10
|
+
});
|
|
11
|
+
server.tool("google-search", "Fetch Google Search Results", {
|
|
12
|
+
query: z.string().describe("Parameter defines the query you want to search. You can use anything that you would use in a regular Google search. e.g. inurl:, site:, intitle:. We also support advanced search query parameters such as as_dt and as_eq."),
|
|
13
|
+
gl: z.string().optional().describe("Parameter defines the country to use for the Google search. It's a two-letter country code. (e.g., us for the United States, uk for United Kingdom, or fr for France)."),
|
|
14
|
+
hl: z.string().optional().describe("Parameter defines the language to use for the Google search. It's a two-letter language code. (e.g., en for English, es for Spanish, or fr for French)."),
|
|
15
|
+
}, async ({ query, gl = "us", hl = "en" }) => {
|
|
16
|
+
const response = await scrapelessClient.sendRequest(TOOL_ENDPOINTS.SCRAPER, "scraper.google.search", {
|
|
17
|
+
q: query,
|
|
18
|
+
gl,
|
|
19
|
+
hl,
|
|
20
|
+
location: ""
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
content: response.content.map((item) => ({
|
|
24
|
+
type: "text",
|
|
25
|
+
text: item.text,
|
|
26
|
+
})),
|
|
27
|
+
};
|
|
28
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "scrapeless-mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"scrapeless-mcp-server": "./build/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc && chmod 755 build/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"build"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"description": "",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@modelcontextprotocol/sdk": "^1.8.0",
|
|
21
|
+
"zod": "^3.24.2",
|
|
22
|
+
"axios": "^1.8.4"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^22.13.14",
|
|
26
|
+
"typescript": "^5.8.2"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://scrapeless.com",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/scrapeless-ai/scrapeless-mcp-server"
|
|
32
|
+
}
|
|
33
|
+
}
|