AI Agents

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:

bash
git clone https://github.com/mnardit/share2agent.git
cd share2agent/examples/receiver

Or download just the receiver:

bash
curl -O https://raw.githubusercontent.com/mnardit/share2agent/main/examples/receiver/receiver.py

Step 2: Install Dependencies

The receiver has one dependency:

bash
pip install pyyaml

Step 3: Run the Receiver

bash
python3 receiver.py

By 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

VariableDefaultDescription
PORT9876HTTP server port
PAGES_DIR./pagesDirectory where markdown files are saved
TMUX_TARGET(current session)tmux target for notifications (e.g., mysession:0)

Example with custom settings:

bash
PORT=8080 PAGES_DIR=/home/user/shared-pages TMUX_TARGET=claude:0 python3 receiver.py

Step 4: Configure Share2Agent

  1. Click the Share2Agent extension icon in Chrome.
  2. Open Settings.
  3. Set the Webhook URL to http://localhost:9876.
  4. 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

  1. Make sure the receiver is running and Claude Code is active in tmux.
  2. Navigate to any web page -- for example, a Python docs page or a GitHub issue.
  3. Click the Share2Agent icon and hit Share. Optionally add a comment like "explain this API".
  4. The receiver saves the page and sends a tmux notification to Claude Code.

What Happens Under the Hood

  1. Share2Agent extracts the page content and sends a POST request to the receiver.
  2. 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.

  1. The saved file contains:
markdown
---
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...
  1. 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:

ini
# /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.target

Enable and start:

bash
sudo systemctl enable share2agent-receiver
sudo systemctl start share2agent-receiver

Tips

  • 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 comment field.

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.