How to Send Web Pages to Cursor with Share2Agent
Share documentation, API references, and code examples directly to Cursor. Share2Agent extracts the page content, and a lightweight receiver saves it as markdown that you can reference in Cursor's AI chat with @file.
Prerequisites
- Cursor IDE installed
- Python 3.8+ (for the receiver script)
- Share2Agent Chrome extension installed
How It Works
The approach is straightforward: a small Python receiver saves shared pages as markdown files in your project directory. Cursor can then read these files and use them as context in AI chat.
Chrome --> Share2Agent --> receiver.py --> .pages/article.md --> Cursor @file
Step 1: Set Up the Receiver
The receiver script from the Share2Agent repository works with any AI coding tool, not just Claude Code. Download it:
curl -O https://raw.githubusercontent.com/mnardit/share2agent/main/examples/receiver/receiver.py
pip install pyyamlStep 2: Configure the Save Directory
Run the receiver with PAGES_DIR pointing to a directory inside your Cursor project:
PAGES_DIR=/path/to/your/project/.pages python3 receiver.pyUsing .pages (with a leading dot) keeps shared content out of your source tree while remaining accessible to Cursor. Add it to .gitignore:
# .gitignore
.pages/
Step 3: Configure Share2Agent
- Click the Share2Agent extension icon in Chrome.
- Open Settings.
- Set the Webhook URL to
http://localhost:9876. - Save.
Step 4: Share a Page
- Navigate to a documentation page, API reference, or code example.
- Click the Share2Agent icon.
- Add an optional comment describing what you need (e.g., "how to use this hook").
- Click Share.
The receiver saves the page as a markdown file:
.pages/2026-03-28-1430-react-useeffect-docs.md
The file includes YAML frontmatter with the URL, title, author, and your comment, followed by the extracted content.
Step 5: Reference in Cursor
Open Cursor's AI chat (Cmd+L / Ctrl+L) and reference the saved file:
@.pages/2026-03-28-1430-react-useeffect-docs.md
How do I clean up effects in this pattern?
Cursor reads the full file content and uses it as context for the response.
Reference Multiple Files
If you have shared several pages for a research task, reference them all:
@.pages/2026-03-28-1430-react-useeffect-docs.md
@.pages/2026-03-28-1435-react-hooks-faq.md
Compare the approaches in these two docs.
Alternative: Use Cursor Rules
For pages you reference repeatedly, copy the content into a .cursor/rules file so it is automatically included as context:
cp .pages/2026-03-28-1430-react-useeffect-docs.md .cursor/rules/react-effects.mdThis way, Cursor always has that reference available without explicit @file mentions.
Alternative: MCP Integration
Cursor supports the Model Context Protocol (MCP). Instead of saving files, you could build a custom MCP server that:
- Receives webhooks from Share2Agent.
- Stores pages in memory.
- Exposes them as MCP resources that Cursor can query.
This is more advanced but avoids file clutter. See Cursor MCP docs for setup instructions.
Tips
- Organize by project -- run separate receivers for different projects, each saving to its own
.pages/directory. - Use comments as instructions -- your Share2Agent comment is saved in the file's frontmatter. When you reference the file in Cursor, the AI sees your note alongside the content.
- Clean up periodically -- delete old
.pages/files you no longer need to keep your project tidy.
What's Next?
- Build a docs library -- share key documentation pages at the start of each project and reference them throughout development.
- Share error pages -- when debugging, share the relevant Stack Overflow answer or GitHub issue directly and ask Cursor to apply the fix.
- Combine with Composer -- reference shared pages in Cursor's Composer mode to generate code based on real documentation rather than training data.