How to Send Web Pages to Windsurf with Share2Agent
Send documentation, API references, and error pages directly to Windsurf's AI assistant. Share2Agent extracts clean text from any web page and saves it as a Markdown file that Windsurf can read.
Prerequisites
- Windsurf IDE by Codeium installed
- Share2Agent Chrome extension installed
- Python 3.10+ with PyYAML (
pip install pyyaml)
Step 1: Set Up the Receiver
Share2Agent uses a lightweight webhook receiver that saves pages as Markdown files. Windsurf reads those files as context.
git clone https://github.com/mnardit/share2agent.git
cd share2agent/examples/receiver
pip install pyyamlStep 2: Configure the Save Directory
Point PAGES_DIR to a location inside your project (or a shared directory Windsurf can access):
export PAGES_DIR=~/my-project/references
python3 -u receiver.pyThe receiver starts on port 9876 and saves every shared page as a .md file with YAML frontmatter containing the URL, title, timestamp, and any comment you added.
You can also set PORT and PAGES_DIR as environment variables to avoid editing the script.
Step 3: Configure Share2Agent
- Click the Share2Agent extension icon in Chrome.
- Open Settings.
- Set the Webhook URL to
http://localhost:9876. - Save.
If you run the receiver on a remote machine or use Tailscale, replace localhost with your machine's hostname.
Step 4: Share a Page
- Navigate to any documentation page, Stack Overflow answer, or API reference.
- Click the Share2Agent icon.
- Optionally add a comment like "use this API for authentication".
- Click Share.
The receiver saves the page to your configured directory, for example:
~/my-project/references/2026-03-28-1430-nextjs-middleware-docs.md
Step 5: Reference in Windsurf
Open Windsurf's AI chat (Cascade) and reference the saved file:
- Mention the file path directly in your prompt
- Or add the references directory to your workspace so Cascade indexes it automatically
Example prompt:
Look at references/2026-03-28-1430-nextjs-middleware-docs.md and help me
implement middleware-based auth using the pattern described there.
Windsurf picks up the Markdown content as context for its response.
Running as a Background Service
To keep the receiver running without a terminal window:
# systemd user service
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/share2agent-receiver.service << 'EOF'
[Unit]
Description=Share2Agent Webhook Receiver
[Service]
Environment=PAGES_DIR=%h/my-project/references
ExecStart=/usr/bin/python3 -u /path/to/receiver.py
Restart=on-failure
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable --now share2agent-receiverWhat's Next?
- Organize by project -- run multiple receivers with different
PAGES_DIRvalues for different workspaces. - Add a cleanup script -- delete reference files older than 7 days to keep your workspace tidy.
- Combine with Windsurf rules -- create a
.windsurfrulesfile that tells Cascade to always check thereferences/directory for relevant context before answering.