Skip to content

Commit cd7f686

Browse files
Readme update
1 parent 7655eee commit cd7f686

File tree

1 file changed

+43
-26
lines changed

1 file changed

+43
-26
lines changed

README.md

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,34 @@ npm install
3838
npm start
3939
```
4040

41-
### Running on Cursor
42-
43-
Configuring Cursor
41+
### Configuring in Cursor
4442
Note: Requires Cursor version 0.45.6+
4543

46-
To configure WebScraping.AI MCP in Cursor:
44+
The WebScraping.AI MCP server can be configured in two ways in Cursor:
45+
46+
1. **Project-specific Configuration** (recommended for team projects):
47+
Create a `.cursor/mcp.json` file in your project directory:
48+
```json
49+
{
50+
"servers": {
51+
"webscraping-ai": {
52+
"type": "command",
53+
"command": "npx -y webscraping-ai-mcp",
54+
"env": {
55+
"WEBSCRAPING_AI_API_KEY": "your-api-key",
56+
"WEBSCRAPING_AI_CONCURRENCY_LIMIT": "5"
57+
}
58+
}
59+
}
60+
}
61+
```
4762

48-
1. Open Cursor Settings
49-
2. Go to Features > MCP Servers
50-
3. Click "+ Add New MCP Server"
51-
4. Enter the following:
52-
- Name: "webscraping-ai-mcp" (or your preferred name)
53-
- Type: "command"
54-
- Command: `env WEBSCRAPING_AI_API_KEY=your-api-key npx -y webscraping-ai-mcp`
63+
2. **Global Configuration** (for personal use across all projects):
64+
Create a `~/.cursor/mcp.json` file in your home directory with the same configuration format as above.
5565

56-
> If you are using Windows and are running into issues, try `cmd /c "set WEBSCRAPING_AI_API_KEY=your-api-key && npx -y webscraping-ai-mcp"`
66+
> If you are using Windows and are running into issues, try using `cmd /c "set WEBSCRAPING_AI_API_KEY=your-api-key && npx -y webscraping-ai-mcp"` as the command.
5767
58-
Replace `your-api-key` with your WebScraping.AI API key.
68+
This configuration will make the WebScraping.AI tools available to Cursor's AI agent automatically when relevant for web scraping tasks.
5969

6070
### Running on Claude Desktop
6171

@@ -381,27 +391,34 @@ This server implements the [Model Context Protocol](https://github.com/facebookr
381391
### Example: Configuring Claude with MCP
382392

383393
```javascript
384-
// Example code for connecting Claude with the WebScraping.AI MCP Server
385394
const { Claude } = require('@anthropic-ai/sdk');
386-
const { McpClient } = require('@modelcontextprotocol/sdk/client');
395+
const { Client } = require('@modelcontextprotocol/sdk/client/index.js');
396+
const { StdioClientTransport } = require('@modelcontextprotocol/sdk/client/stdio.js');
387397

388398
const claude = new Claude({
389-
apiKey: 'your_claude_api_key'
399+
apiKey: process.env.ANTHROPIC_API_KEY
390400
});
391401

392-
const mcpClient = new McpClient({
393-
baseUrl: 'http://localhost:3000/sse'
402+
const transport = new StdioClientTransport({
403+
command: 'npx',
404+
args: ['-y', 'webscraping-ai-mcp'],
405+
env: {
406+
WEBSCRAPING_AI_API_KEY: 'your-api-key'
407+
}
394408
});
395409

410+
const client = new Client({
411+
name: 'claude-client',
412+
version: '1.0.0'
413+
});
414+
415+
await client.connect(transport);
416+
396417
// Now you can use Claude with WebScraping.AI tools
397-
const response = await claude.messages.create({
398-
model: 'claude-3-opus-20240229',
399-
max_tokens: 1000,
400-
system: 'You have access to WebScraping.AI tools for web data extraction.',
401-
messages: [
402-
{ role: 'user', content: 'Extract the main heading from https://example.com' }
403-
],
404-
tools: await mcpClient.listTools()
418+
const tools = await client.listTools();
419+
const response = await claude.complete({
420+
prompt: 'What is the main topic of example.com?',
421+
tools: tools
405422
});
406423
```
407424

0 commit comments

Comments
 (0)