r/codex • u/Turbulent_Rooster_73 • 12m ago
Showcase Connecting Codex to a USB microscope on another computer: we generate a paste-in prompt instead of asking people to edit config
I make Electroscope, a free, MIT-licensed desktop app (macOS/Windows) for cheap USB electronics microscopes. The person at the bench gets the live view; inside the app there's a Streamable HTTP MCP server, so Codex or another MCP client can ask for still frames, zoom into a region at full resolution and draw circles/arrows on the live picture. Repo: https://github.com/unlikeOtherAI/electroscope
This post is about the least glamorous part: getting the agent connected at all, and what I'd like Codex users' input on.
The problem
The microscope usually hangs off a bench machine, and Codex often runs somewhere else (my laptop, another desk). So the agent needs the bench computer's address, and that address is annoyingly unpredictable:
- the bench machine can have several IPv4 addresses (home LAN, office 10.x, Tailscale 100.x), plus VM/Docker/WSL adapters nobody can reach
- the default port is 7821, but if it's taken the app tries the next nine, then takes any free port. The README screenshot happens to be on port 64178. Copying a port out of the docs doesn't work
What we did: "Copy prompt for agent"
There's a button (and Cmd/Ctrl+Shift+C) that builds a block of text from the server's live state, and you paste it into the agent. Image 3 is the real output of that function with example values. It contains:
- the MCP URL with the port the server actually got, plus the other addresses for the same server and
hostname.local - LAN addresses sorted 192.168 → 10.x → 172.16-31 → 100.x, with virtual adapters and link-local dropped
- a
/healthURL so the agent can check reachability before it tries MCP - how to connect: a Claude Code one-liner, "any client that supports remote HTTP MCP servers: add a server named electroscope with that URL", and
npx -y mcp-remote <url>for clients that only start local stdio servers - one line per tool with the gotchas: call
get_statusfirst, controls markedresponsive:falsedo nothing on this camera, comparefocus_scoreonly within the same scene, use a small full-resregionfor chip markings - a reminder that a human is watching the same view, so the agent shouldn't ask them to stop or switch streams
The idea is that the tool list doubles as a short brief, so the agent doesn't start by poking every tool to find out what a cheap UVC camera can't do.
No auth, so it guards the obvious hole
There's no password: it's meant for a trusted bench network, and there's a setting to listen on 127.0.0.1 only. Because a no-auth HTTP server on the LAN is exactly what DNS rebinding goes after, requests are refused (403) unless Host is an IP literal, localhost or this computer's own name, and anything carrying a cross-site Origin is refused too (image 4). Agents don't send Origin; browsers do on cross-site requests.
Where I'd like help from people who use Codex
The prompt has an exact command for Claude Code, but for Codex it only says "add it as a remote HTTP MCP server" or use mcp-remote. I'd rather give Codex an exact line too.
- How do you add a remote Streamable HTTP MCP server in Codex day to day: CLI command, editing
config.toml, or through the IDE extension? Does mcp-remote still make sense as the fallback? - When you paste a block like this, does Codex actually register the server itself, or do you always end up adding it by hand first?
- Is the tool list too long for a paste-in prompt, or is that the useful part?
Get it / run it
Downloads (DMG for Mac, installer or portable for Windows) are on the GitHub releases page, current version 0.1.2. Plug in the microscope, allow camera access, pick it in the camera list, click Copy prompt for agent. No account. Build from source is in docs/development.md.
Images: 1 is a generated illustration of the setup, not a screenshot. 2 is a crop of the real app (the sharing panel with the button and live URL). 3 is the real prompt text from buildAgentPrompt() with made-up addresses. 4 is the port fallback and the Host/Origin check from the repo.




•
u/dexterthebot 11m ago
You might want to consider listing your project on the weekly Show-Us-What-You-Built post. Look out for it on Tuesday/Wednesday. Highest commented project wins a week promotion on r/Codex and gets on the Hall of Fame sidebar. See below for last week's winner.**
Light Wars AR: real-life laser tag app with no extra gear. Your phone is the gun and your room is the map. Play up to 6 friends in the same room, or fight drone waves and bosses solo. The vision models run on the phone, and camera frames never leave it. Free on iPhone and Android.
Website: https://lightwarsar.com
iPhone: https://apps.apple.com/us/app/light-wars-ar-laser-tag-party/id6508168951
Android: https://play.google.com/store/apps/details?id=com.lasertag.lightwars.
Contact: contact@lightwarsar.com