Cursor में web scraping
Cursor में Spicrawl MCP server जोड़ें। फिर इसका agent web pages को साफ़ Markdown में पढ़ सकता है।
Set up करें
तीन steps Cursor के agent को tools, Spicrawl code लिखने की जानकारी, और दोनों के इस्तेमाल के नियम देते हैं। या तीनों spicrawl init --client cursor से एक साथ कर लें।
अपनी API key उस environment में सेट करें जिससे Cursor शुरू होता है:
bashexport SPICRAWL_API_KEY=spicrawl_live_... # add to your shell profile, then restart CursormacOS पर, Dock से शुरू किए गए apps आपका shell profile नहीं देखते। Cursor को terminal से
cursor .के साथ शुरू करें।Server को
.cursor/mcp.jsonमें जोड़ें (या हर project के लिए~/.cursor/mcp.jsonमें)। Cursor key भर देता है, इसलिए file को commit करना सुरक्षित है:.cursor/mcp.json{ "mcpServers": { "spicrawl": { "url": "https://mcp.spicrawl.com/mcp", "headers": { "Authorization": "Bearer ${env:SPICRAWL_API_KEY}" } } } }Skill install करें:
bashspicrawl skill install --client cursor # Without the CLI: mkdir -p .cursor/skills/spicrawl curl -fsSL https://app.spicrawl.com/skill.md -o .cursor/skills/spicrawl/SKILL.mdइस rule को
.cursor/rules/spicrawl.mdcके रूप में save करें। जब किसी task में web data शामिल हो, तब agent इसे पढ़ता है। इसे हर chat में शामिल करने के लिएalwaysApply: trueset करें।.cursor/rules/spicrawl.mdc--- description: Fetching, scraping or extracting data from web pages with Spicrawl alwaysApply: false --- # Web data (Spicrawl) Use Spicrawl to read web pages: the spicrawl_* MCP tools in chat, or POST https://api.spicrawl.com/v1/scrape with `Authorization: Bearer $SPICRAWL_API_KEY` in code. Docs: https://docs.spicrawl.com/llms.txt (append .md to any page URL for Markdown). - Ask for markdown: `response_format: "markdown"` (API default is html); on spicrawl_scrape, `format: "markdown"`. - Check the site's status, not only the HTTP status: `X-Target-Status` header, or `status` in the JSON envelope (spicrawl_scrape with `format: "json"`). 200 is the page; 404/410 mean it does not exist; 403/429/503 mean the site refused, so escalate. - On an error, switch on `code`. Retry only when `retryable` is true, after `retry_after_seconds`. Read `diagnostics.hint` and change what it names first. Never retry ERR::REQUEST::*, ERR::AUTH::* or ERR::LIMIT::QUOTA_EXCEEDED. - Escalate one step at a time and stop at the first that works: plain fetch (1 credit) -> `js_render: true` (3) -> add the user's own `proxy` if they have one. Empty or skeleton content means render; ERR::UPSTREAM::CHALLENGE or a 403 target status means retry once, then the user's own proxy. - Set `max_cost` on every request to the price of the step you intend. - Keep the cache on (default). Set `cache: false` only for prices, stock or other live data. - Trim tokens with `main_content_only` (on by default for markdown), `include_tags`, `exclude_tags`. - For more than 20 URLs, use a batch job (spicrawl_batch_submit / POST /v1/batch). Batch items return html, markdown or text (spicrawl_batch_submit defaults to markdown, POST /v1/batch to html). Extraction, screenshots, actions and sessions are refused with a 400 before anything is charged: scrape those URLs one by one. - Never print or commit SPICRAWL_API_KEY. Log `X-Request-Id` for failures.Cursor Settings → MCP खोलें। जाँचें कि
spicrawlचालू है और 25spicrawl_*tools list करता है।
आज़माने के लिए पहला task
Agent को Agent mode में खोलें और पूछें:
Use Spicrawl to read https://example.com/pricing as markdown. List each plan with its monthly price.
If the page comes back empty, retry with rendering.Agent को format: "markdown" के साथ spicrawl_scrape call करना चाहिए। उसे render: true तभी जोड़ना चाहिए जब पहला result खाली हो।
Cloud agents
Cursor के cloud agents remote VM में चलते हैं, इसलिए वे आपके shell की key नहीं देख सकते। Cursor dashboard में URL https://mcp.spicrawl.com/mcp और header Authorization: Bearer तथा अपनी key के साथ server जोड़ें। Key को commit न करें। Skill और rule repository से आते हैं।
यह क्या कर सकता है
Server agent को 25 spicrawl_* tools देता है। हर call आपकी API key के तहत चलती है, उन्हीं limits और credits के साथ जो सीधी API call में होते हैं।
- एक page पढ़ें:
spicrawl_scrapeMarkdown (default), text, HTML, JSON या PDF लौटाता है। - कई pages पढ़ें:
spicrawl_batch_submitएक बार में 10,000 URLs तक queue करता है। इसके बादspicrawl_batch_statusऔरspicrawl_batch_resultsचलाएँ। - Login के पीछे के pages:
spicrawl_session_createcalls के बीच cookies और storage बनाए रखता है। - Failure debug करें:
spicrawl_requests_listऔरspicrawl_request_get। - Usage जाँचें:
spicrawl_usage_summaryऔर बाकी usage tools। इनके लिएreadscope वाली key चाहिए। - चीज़ें खोजें:
spicrawl_docs_searchऔरspicrawl_docs_readSpicrawl docs खोजते और पढ़ते हैं।
एक tool, spicrawl_browser_connect_url, listed है लेकिन जल्द आ रहा है। spicrawl_scrape पर rendering argument render है, न कि API का js_render।
जानने लायक बातें
- Crawling नहीं। Spicrawl links follow नहीं करता और pages नहीं ढूँढता। Agent को URLs दें।
- प्रति request credits। Plain fetch 1 credit का है। JavaScript rendering 3 का। Full-browser rendering 8 का।
- Failures free हैं। Fail हुई request की कीमत 0 credits है।
- Cache समय बचाता है, credits नहीं। Cache हिट की कीमत उसी fetch जितनी है जिसने उसे store किया था।
- हर call की सीमा तय करें।
max_costset करें, और जो request ज़्यादा खर्च कर सकती है उसे चलने से पहले ही refuse कर दिया जाता है। - जल्द आ रहा है: managed proxies, stealth mode, एक remote browser और एक plain-language prompt से AI extraction। आज आप अपना proxy ला सकते हैं।
अक्सर पूछे जाने वाले सवाल
क्या .cursor/mcp.json को commit करना सुरक्षित है?
Yes, if you use ${env:SPICRAWL_API_KEY} in the header. Cursor replaces it with the value from your environment, so the file holds no key.
Server 401 error क्यों दिखाता है?
Cursor शुरू होते समय SPICRAWL_API_KEY सेट नहीं थी। macOS पर, Dock से शुरू किए गए apps आपका shell profile नहीं देखते। इसकी जगह Cursor को terminal से cursor . के साथ शुरू करें।
क्या यह Cursor cloud agents के साथ काम करता है?
हाँ। Cursor dashboard में server को URL और अपने Authorization header के साथ जोड़ें। Key को commit न करें। Skill और rule repository से पढ़े जाते हैं।
Server listed है लेकिन उसमें कोई tools नहीं हैं। अब क्या करें?
Cursor Settings → MCP में इसे off और on करें, फिर नई chat खोलें।
हर page की कीमत कितनी है?
Plain fetch की कीमत 1 credit है, JavaScript rendering की 3 और full-browser rendering की 8। Failed requests की कीमत 0। Cache hit की कीमत उतनी ही है जितनी उस fetch की जिसने इसे store किया। Agent से हर request पर max_cost सेट करने को कहें ताकि वह आपकी उम्मीद से ज़्यादा खर्च न करे।