Use the admin page of your NAS, router or UPS once, naming each step. har2mcp writes an MCP server that lets Claude do the same.
Many devices on your network already have an API: the one their web page calls. har2mcp records those calls in a throwaway browser while you work, turns them into a spec you can read and edit, and generates the Go source of a server that logs in, renews its session and streams files. One binary, offline by default, and your password never ends up in the code.
Free · Apache-2.0 · Works offline · No account · Generated code you can read
Terminal · from web page to MCP server
$har2mcp record http://192.168.1.10 -o nas.har
Recording. Use the har2mcp box (bottom-right) to name each step. Close the browser window when done.
warning: nas.har contains your password and session cookies; keep it private (use 'har2mcp redact' before sharing)
$har2mcp analyze nas.har --name nas # writes nas.spec.yaml
$har2mcp generate nas.spec.yaml --target go # writes nas-mcp/
1 binaryrecords, analyzes and generates. No installer, no runtime.
6 buildsWindows, macOS and Linux, each for amd64 and arm64
Offlineby default. Only enhance talks to Claude, and only when you run it.
Apache-2.0free and open source, on GitHub
How it works
From a web page to Claude in three commands.
A device's admin page is usually a JavaScript app that calls the device's own HTTP API. har2mcp watches those calls while you use the page, learns the login, the session and each operation, and writes a server that makes the same calls when Claude asks.
youthe web pageLog in and do each action once, naming the steps as you go.
recordnas.harEvery request and response, with your step names. Standard HAR 1.2.
analyzenas.spec.yamlThe login, the session and one tool per operation, in YAML you can edit.
generatenas-mcp/Go source on the official MCP Go SDK. go build it once.
claudeyour toolsClaude calls them; the server logs in and sends the requests.
Record
$har2mcp record <url> -o nas.har
Chrome, Edge or Chromium opens with a fresh, temporary profile, so you log in from scratch and har2mcp sees exactly how the login works. Name each action in the har2mcp box as you do it. Add --insecure for a self-signed certificate.
Analyze
$har2mcp analyze nas.har --name nas
Finds the login request, the session cookies and any CSRF token, groups requests into operations, works out which values are inputs, and names each tool after your step: list disks becomes list_disks.
Generate
$har2mcp generate nas.spec.yaml --target go
Writes a Go module that builds with no edits: an MCP server over stdio, an HTTP client that logs in and renews the session, and one tool per enabled operation. Build it with Go 1.26 or later.
Also in the box: har2mcp inspect prints a summary of a recording or spec with secrets left out, har2mcp redact makes a copy of a recording you can share, and har2mcp enhance optionally asks Claude for better tool names and descriptions.
Your devices
Anything with a web admin page.
har2mcp is for devices you own whose web page talks to a JSON or XML API: the boxes on your home network that never got an official API, let alone an MCP server. Below are the kinds of devices it is meant for, with ideas to try. They are ideas, not a list of tested models.
NAS
Disks and their health, shares, users, and files in and out. A TerraMaster NAS running TOS is the first target, and the test suite records against a simulated one.
try: list disks · add share · upload file
Routers
Connected clients, port forwards, guest Wi-Fi and firmware status. Router pages that are server-rendered HTML, rather than an app calling an API, won't work in v0.1.
try: list clients · enable guest wifi
IP cameras
The settings behind the camera's web page: motion detection, recording schedules, night mode. Video streams don't become tools.
try: get motion settings · set schedule
Smart plugs & hubs
On, off, schedules and power readings, for plugs and hubs that have a local web page of their own, not only a phone app.
try: turn plug off · get power usage
Printers
Supply levels, the job queue and network settings from the printer's built-in web page.
try: get supply levels · cancel job
UPS units
Battery charge, load, estimated runtime and self-tests from a UPS network card's page.
try: get battery status · run self test
Solar inverters
Today's yield, battery state and settings, for inverters with a local status page on your network.
try: get today yield · set charge limit
3D printers
Status, starting and pausing jobs, and uploading files through the printer's web interface. Live updates sent over WebSockets aren't turned into tools in v0.1.
try: upload gcode · pause print
Whether a device works depends on its web page, not its brand: how it logs in, and whether it calls an API or reloads whole HTML pages. What it fits lists both sides honestly. If you try har2mcp on your hardware, an issue with the output of har2mcp inspect helps everyone.
The recorder
Name each step as you go.
Your step names become tool names, so the recording is where a good server starts. Below is a mock-up of what you see while recording: the device's own page, with har2mcp's box in the corner.
A box in the corner
Type a name, press Start, do it, press Done.
The box stays in the bottom-right corner across page loads and counts the requests the page makes during each step. Make login your first step, then one step per thing you want Claude to do.
The window is a new browser profile in a temporary folder: no extensions, saved passwords or history, and it is deleted when you close the window. Your own profile is never read or changed.
throwaway profile
login captured
HAR 1.2
mode 0600
http://192.168.1.10/#/storage · recording with har2mcp
Disks
Refresh
Disk
Model
Size
Health
sda
4TB NAS HDD
4000 GB
Good
sdb
4TB NAS HDD
4000 GB
Good
har2mcp–
Step:list disks
Recording stepDone
2 requests this step
A mock-up, drawn in HTML. The NAS page is invented; the box matches the recorder's design.
What goes into the recording
Every request and response the page makes, with bodies up to 2 MiB each (--body-cap), cookies, redirects and timings.
Your steps: their names, start and end times, the button you clicked, and the values you typed, with each field's label.
The login form: what you typed and where, so analysis can tell whether the password is sent as typed or scrambled in the page.
Uploads and downloads: the form structure, file names, sizes and content types. WebSocket messages are recorded too, but not used in v0.1.
The spec
A file you can read, edit and keep.
Between the recording and the code sits a YAML spec. Rename tools, rewrite descriptions, switch tools off. Record more later and analyze again: new operations are merged in, and your edits stay.
nas.spec.yaml · excerpt
# har2mcp spec. Edit freely: rerunning 'har2mcp analyze' keeps your changes to
# tool names, descriptions, enabled, kind and inputs, and to the auth block.har2mcp:1service:name: nas
base_url: http://192.168.1.10
auth:mode: http
login:request:method: POST
path: /login
body_type: json
body:pwd:'{{password}}'user:'{{username}}'session:cookies:
- PHPSESSID
tokens:
- name: csrf
from:response_json: data.token
to:header: X-Csrf-Token
relogin_on:
- 401
- 403tools:
- name: add_share
description: Add share. Calls POST /module/api.php (act=addshare). Recorded from the 'Create' control.
enabled:truekind: change
request:method: POST
path: /module/api.php
body_type: json
body:act: addshare
discriminator: act
inputs:
- name: name
type: string
description: Share name
required:truein: body
field: name
example: media
# … response, source, generated
- name: delete_share
description: Delete share. Calls POST /module/api.php (act=delshare). Recorded from the 'Delete' control.
enabled:falsekind: destructive
# … request, inputs, response, source
What you can change, and what it does
nameThe tool name Claude sees. Yours to change.
descriptionWhat Claude reads to pick a tool. Write it by hand, or let enhance suggest one.
enabledfalse leaves the tool out of the server. Here delete_share was switched off by hand.
kindread, change or destructive: MCP hints for the client, never a block.
inputsWhat Claude fills in: values you typed, or values that changed between samples.
{{password}}Placeholders where your login went. The real values come from environment variables when the server runs.
This excerpt is from the example in docs/spec-format.md, which describes every field. The NAS and its API are made up for the example.
Merges, never wipes
Analyzing into an existing spec keeps your names, descriptions, enabled switches, kinds, inputs and auth edits. New operations are added and missing ones are kept.
Flags its guesses
When analysis isn't sure, say a value seen only once that matches nothing you typed, it marks the tool review: true and notes which field to check.
Optional: ask Claude
har2mcp enhance sends the tool list, never the login or the recording, and writes back better names and descriptions only. --dry-run prints exactly what would be sent.
Connect Claude
Talk to your NAS.
The generated server is a Model Context Protocol server over stdio. Register it with Claude Code or Claude Desktop and every enabled tool appears, with the device's address and login read from environment variables.
Claude Desktop and other clients: add a stdio server whose command is the built program, with the same environment variables. The generated README has a ready claude_desktop_config.json snippet, and docs/generated-servers.md has the details.
Tools from the example recording
list_disksDisks with model, size and healthread
add_shareCreate a share by namechange
delete_shareDelete a share by namedestructive
upload_fileStream a file from the files folder to the NASchange
download_fileStream a file from the NAS into the files folderread
Never: file contents in MCP messages. Uploads and downloads go through NAS_FILES_DIR and return only the path, size and content type, so big files never pass through Claude.
Tool names come from your step names. The server logs in on the first call, logs in again and retries once when the session expires, and caps each result at 100000 bytes.
NAS_BROWSERBrowser login only: Chrome, Chromium or Edge, if not found
The prefix is your service name in upper case: a spec named router gives ROUTER_URL, ROUTER_USER and so on.
What it fits
What it works on, and what it doesn't.
har2mcp learns from the calls you make while recording. It suits a web page that is a JavaScript app talking to its device over HTTP, and it can't get past things designed to stop automation.
Good fit
JSON or XML APIs behind a JavaScript web page: NAS boxes, routers, home-automation hubs, admin panels, most self-hosted apps.
RPC-style endpoints, one URL with an action field such as act or method, split into one tool per action. GraphQL fits the same way.
Username and password logins, including ones where the page scrambles the password before sending it: the generated server then logs in through headless Chrome. HTTP Basic auth works too, for cameras and printers that show the browser's own sign-in box.
Cookies, CSRF tokens and bearer tokens, copied from response to request by the server.
Self-signed certificates, common on home networks: --insecure to record, NAS_INSECURE=1 to run.
Uploads and downloads, streamed through a local folder on the machine that runs the server.
Poor fit, or no fit
Bot protection, such as Cloudflare challenges and CAPTCHAs.
Requests signed by secret JavaScript, common on large consumer sites.
A fresh MFA or 2FA code at every login.
HTTP Digest authentication, which some older cameras and printers use. Basic auth is fine.
Single sign-on redirects, such as "Sign in with Google".
WebSocket-only apps. WebSocket traffic is recorded, but not turned into tools in v0.1.
Server-rendered HTML, where each action loads a new page instead of calling an API.
Where v0.1 stands: the test suite runs the whole pipeline (record, analyze, generate, build, then MCP calls including an upload and a download) against a simulated TOS-style NAS, and CI runs it on Linux, macOS and Windows. It has not yet been checked against a real TerraMaster or any other real device. It only knows the calls you made while recording, and it doesn't scan the web app for others.
Your devices, your accounts. Large consumer sites often forbid automated access in their terms, and using har2mcp there can get an account banned. It is built for devices and services you own or run.
Security
Local first. Secrets stay out of the code.
A recording holds your password; the spec and the generated server never do. Here is what har2mcp protects, and what it leaves to you.
Offline by default. Nothing leaves your machine unless you run har2mcp enhance. It sends the tool list only, never the recording, the auth block, headers or credentials, and --dry-run prints the exact payload.
No secrets in the spec or the code. The login request uses {{username}} and {{password}} placeholders, tokens are redacted from examples, and the server reads the address and login from environment variables when it runs.
Recordings stay private. They are written owner-only (mode 0600) with a warning. har2mcp redact makes a copy without passwords, cookies and tokens, and har2mcp inspect prints a summary you can paste into an issue.
A throwaway browser. Every recording starts a new profile in a temporary folder and deletes it afterwards. Your real browser profile is never touched.
Files stay in one folder. Upload and download tools only use <P>_FILES_DIR. Paths that escape it through .., an absolute path or a symlink are refused, and nothing is read or written.
TLS checks stay on unless you ask: --insecure for the recorder, <P>_INSECURE=1 for the server.
Full control is the default. Every recorded operation becomes a tool and is switched on, including the ones that delete, format or reboot. The read-only and destructive hints inform the MCP client and block nothing. Set enabled: false in the spec on anything Claude shouldn't do, then generate again.
Your MCP client keeps the device password from those environment variables in its configuration file, as plain text. If the device lets you make a second account with only the rights Claude needs, use that. To report a vulnerability, see SECURITY.md.
Download
One binary. Unzip it and record.
Pick your system from the latest release. Each zip holds har2mcp, the README, HOW-TO-OPEN.txt, LICENSE and NOTICE. To record you need Chrome, Edge or Chromium; to build the server it generates you need Go 1.26 or later.
SmartScreen may say “Windows protected your PC” because har2mcp is not code-signed: click More info, then Run anyway, or tick Unblock in the zip's Properties before extracting. Run it from PowerShell or Command Prompt.
Gatekeeper blocks unsigned programs: in Terminal, run xattr -d com.apple.quarantine har2mcp in the unzipped folder, or allow it under System Settings > Privacy & Security.
Unzip and run ./har2mcp version (chmod +x har2mcp if needed). Recording opens a browser window, so run record on a machine with a desktop; the other commands work anywhere.