How to Send Web Pages to Claude Code with Share2Agent
Share documentation, error pages, and articles directly to your Claude Code session. Share2Agent extracts the page content, and a lightweight Python receiver saves it as markdown and notifies Claude Code via tmux.
This is the most powerful Share2Agent integration for developers. Instead of copy-pasting docs or Stack Overflow answers, share them with one click and reference them instantly in your coding session.
Prerequisites
- Claude Code running inside a tmux session
- Python 3.8+
- Share2Agent Chrome extension installed
Step 1: Download receiver.py
The receiver script is included in the Share2Agent repository:
git clone https://github.com/mnardit/share2agent.git
cd share2agent/examples/receiverOr download just the receiver:
curl -O https://raw.githubusercontent.com/mnardit/share2agent/main/examples/receiver/receiver.pyStep 2: Install Dependencies
The receiver has one dependency:
pip install pyyamlStep 3: Run the Receiver
python3 receiver.pyBy default, the receiver:
- Listens on port 9876
- Saves pages to
./pages/as markdown files - Sends tmux notifications to the current tmux session
Configuration via Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT | 9876 | HTTP server port |
PAGES_DIR | ./pages | Directory where markdown files are saved |
TMUX_TARGET | (current session) | tmux target for notifications (e.g., mysession:0) |
Example with custom settings:
PORT=8080 PAGES_DIR=/home/user/shared-pages TMUX_TARGET=claude:0 python3 receiver.pyStep 4: Configure Share2Agent
- Click the Share2Agent extension icon in Chrome.
- Open Settings.
- Set the Webhook URL to
http://localhost:9876. - Save.
If the receiver runs on a remote machine, use your server's address instead (e.g., https://myserver.com:9876).
Step 5: Test the Integration
- Make sure the receiver is running and Claude Code is active in tmux.
- Navigate to any web page -- for example, a Python docs page or a GitHub issue.
- Click the Share2Agent icon and hit Share. Optionally add a comment like "explain this API".
- The receiver saves the page and sends a tmux notification to Claude Code.
What Happens Under the Hood
- Share2Agent extracts the page content and sends a POST request to the receiver.
- The receiver saves the content as a markdown file with YAML frontmatter:
pages/2026-03-28-1430-python-asyncio-docs.md
The filename format is YYYY-MM-DD-HHMM-slug.md, where the slug is derived from the page title.
- The saved file contains:
---
title: "Python asyncio documentation"
url: "https://docs.python.org/3/library/asyncio.html"
author: ""
language: "en"
saved_at: "2026-03-28T14:30:00.000Z"
comment: "explain this API"
---
The asyncio module provides infrastructure for writing
single-threaded concurrent code using coroutines...- The receiver sends a tmux notification that Claude Code picks up, alerting it to the new file.
Step 6: Reference in Claude Code
Once the page is saved, you can reference it in your Claude Code session:
Read the file pages/2026-03-28-1430-python-asyncio-docs.md and explain the key concepts.
Or point Claude Code at the entire pages directory to use as context for your current task.
Persistent Deployment with systemd
For a receiver that starts automatically and survives reboots, create a systemd service:
# /etc/systemd/system/share2agent-receiver.service
[Unit]
Description=Share2Agent Receiver
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser/share2agent/examples/receiver
Environment=PORT=9876
Environment=PAGES_DIR=/home/youruser/shared-pages
Environment=TMUX_TARGET=claude:0
ExecStart=/usr/bin/python3 receiver.py
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.targetEnable and start:
sudo systemctl enable share2agent-receiver
sudo systemctl start share2agent-receiverTips
- HTTPS for remote access -- if accessing the receiver over the internet, put it behind a reverse proxy (Caddy, Nginx) with TLS.
- Multiple receivers -- run receivers on different ports for different projects, each saving to its own directory.
- Filter by comment -- modify receiver.py to route pages to different directories based on the
commentfield.
What's Next?
- Build a project knowledge base -- share all relevant docs at the start of a session so Claude Code has full context.
- Share error pages -- when you hit a confusing error, share the Stack Overflow or GitHub issue page directly to Claude Code with a comment like "I'm getting this error in my project".
- Automate with bookmarklets -- create a bookmarklet that triggers Share2Agent for even faster sharing.