Repository avatar
Other Tools
v1.5.0
active

1claw-inject

io.github.1clawAI/1claw-inject

Sign in to websites from an agent. 1Claw types the password; the agent never sees it.

Documentation

1Claw Inject

Let an AI agent sign in to a website without ever holding the password.

The agent drives a real browser. When it needs to log in, it asks 1Claw Browser Bridge to do it. The bridge takes the password from your 1Claw vault and types it on a page the agent cannot see or script. The agent gets back {"status":"filled"} and a signed-in browser. Nothing else.

  agent  ──────CDP──────▶  Browser Bridge  ──────▶  browser
  (script or Claude)             │   ▲                (the page)
                                 │   └── types the password here
                                 ▼
                            1Claw vault
                        (holds the password)

It comes in two forms:

  • A Claude Desktop extension (an MCP server): Claude is the agent. It gets a "sign in" tool that returns a status, tools to open and read pages, and a "set up a site" tool that hands the typing of the password to you.
  • A terminal demo (npm run demo): a Puppeteer script plays the agent. It shows a page refusing it, signs in through the bridge, shows the same page now open, then browses around and saves screenshots.

It works with any site whose login is a username and password on one page. No sites ship with it: you add your own, as many as you like, by giving Claude a login page address. Each gets its own password in your vault; they all share one pairing of your machine.

A 1Claw project, built on @1claw/browser-bridge 0.3.0.

Contents

What you need

  • Node.js 20.10 or newer
  • A Chromium-family browser (Chrome, Brave, Edge, Chromium, Vivaldi, Opera)
  • A 1Claw account (a Human API key only for the older --with-key setup)
  • An account on the site you want to sign in to
  • macOS, Linux or Windows

Quick start

In Claude Desktop, with no terminal:

  1. Download 1claw-inject.mcpb and open it with Claude Desktop. There is nothing to fill in.
  2. Ask Claude: "Set up sign-in for https://example.com/login, my username is me@example.com."
  3. 1Claw's approval page opens in your browser. Check it shows the code Claude gave you, type the site's password there and approve. Claude does not see that page.
  4. Ask Claude: "Sign in to example and tell me what is on my account page."

Repeat steps 2 and 3 for each site. After the first one, you can ask for several at once and approve them in any order.

In a terminal, from a clone:

git clone https://github.com/1clawAI/1claw-inject.git && cd 1claw-inject
npm install
npm run add-site -- https://example.com/login   # work out the login form
npm run bootstrap     # set it up; you approve it on 1claw.co
npm run demo          # watch it sign in

In a terminal, without cloning:

npx github:1clawAI/1claw-inject setup https://example.com/login
npx github:1clawAI/1claw-inject demo --site example

In Claude Code or Cowork, as a plugin:

/plugin install 1claw-inject --marketplace 1clawAI/1claw-inject

The plugin (in plugin/) starts the same server from npm and adds a skill that tells Claude how to use it. A local server runs in Claude Code and in Cowork sessions on your own computer, not in ordinary chat; for Claude Desktop chat, use the .mcpb file above.

In any other MCP client (Cursor, Windsurf, VS Code and others), add a stdio server:

{
  "mcpServers": {
    "1claw-inject": { "command": "npx", "args": ["-y", "@1claw/inject", "mcp"] }
  }
}

All of these write to the same place, so a site set up one way works in the others.

Setup in detail

Setup is the same whether Claude Desktop starts it or you run npm run bootstrap. It goes through 1Claw's own approval page:

  1. The tool asks 1Claw for a setup request, naming the site, its login page and this machine. It gets back a short code and an approval link.
  2. You open the link, signed in to 1Claw. The page shows the code, the device, the site and where the request came from. You type the site's password there and approve with one passkey or authenticator confirmation.
  3. The tool collects a device credential and an agent key, once, and writes them to ~/.config/1claw-inject/setup.env, readable only by you.

That one approval stores the password in your vault, creates the browser binding (this secret may be typed into these hosts), pairs this machine as a bridge device, and gives a new agent read access to that one secret. A second site reuses the device and the agent. On a machine first set up with an API key, the pairing is kept but the first approval creates a new agent, because the old one cannot read from the vault approvals store into.

No Human API key is involved in setup, and the site password never passes through this project: you type it on 1claw.co. Running setup again for a site stores a new password. A request expires after 15 minutes.

Always check the code. The approval page is the only thing standing between a request and your vault. Approve only a request you started, showing the code you were given.

If you set up with version 1.0.0, which wrote to the project's .env, npm run bootstrap moves that file's setup across before doing anything else.

Setting up with an API key instead

npm run bootstrap -- --with-key is the older way, done entirely from the terminal. It asks for:

InputEnv var (optional)Used for
1Claw Human API keyONECLAW_API_KEYcreating everything below
Site username or email<SITE>_EMAIL, e.g. EXAMPLE_EMAILtyped by the bridge at login
Site password<SITE>_PASSWORDstored in the vault

Secrets are prompted for with hidden input. You can instead put them in .env (see .env.example) or the environment. They are never accepted as command-line arguments, which would expose them in ps and shell history.

It then:

  1. finds or creates a vault called browser-use-demo
  2. stores the site password at <site>/password
  3. creates an agent, which may ask for a fill but can never collect a password
  4. grants that agent read access to that one secret path
  5. pairs this machine as a bridge device
  6. creates a browser binding: this secret may be typed into these hosts

Finished steps are skipped on a re-run. Use this way if your organisation requires approvals for creating policies, which the approval page cannot yet complete.

The step-up confirmation (with --with-key)

Steps 5 and 6 need more than the API key: 1Claw requires you to confirm them. Setup picks the method your account needs.

  • Passkey (detected automatically). On macOS a 1Claw tab opens in your own Chrome and you approve the passkey prompt, once per step. This needs a one-time Chrome setting, which the script asks for: View > Developer > Allow JavaScript from Apple Events. Bring the Chrome profile that holds the passkey to the front first, and switch the setting off again afterwards.
    • --passkey-window uses a separate blank-profile Chrome window instead. That suits a passkey in iCloud Keychain or on a security key.
    • --passkey-manual prints one line to paste into the browser console on 1claw.co, and you paste the result back.
  • Authenticator app: run npm run bootstrap -- --totp.
  • Password only: you are asked for your 1Claw account password.

Once a passkey or authenticator app is enrolled, 1Claw refuses the account password for these steps. Do not retry a wrong password repeatedly: failed attempts count toward an account lockout.

The terminal demo

npm run demo                      # visible browser, stays open until you press Enter
npm run demo -- --site <name>     # needed when you have more than one site
npm run demo:headless             # no window
npm run demo -- --close           # close the browser as soon as it finishes
npm run demo -- --save-cookies    # also save the session cookies (see below)

What it does:

  1. Signed out. The agent asks for a page the site only serves to a signed-in user, and is refused.
  2. Sign in. The agent opens the login page and calls request_fill. The demo prints the full reply, which is everything the agent learns.
  3. Signed in. The agent asks for the same page again, in the same tab, and now gets it. The demo reports the HTTP status, whether the page shows the account's username, and whether a logout link is present.
  4. Browse. It visits the pages in the site profile's tour, scrolling each. It only views pages; nothing is submitted.

Each run saves full-page screenshots of the agent's tab to screenshots/<site>/<date_time>/. There is no picture of the password being typed: that happens on a page the agent cannot see.

Showing it signed in

npm run demo -- --save-cookies    # writes cookies/<site>.json, owner-only
npm run show                      # opens a normal browser window, already signed in

The cookie file is in the format cookie-editor browser extensions import. Treat it like a password. Whoever has it is signed in as you until the session expires or you log out. Delete it when you are done.

Claude Desktop

The MCP server gives Claude six tools:

ToolWhat Claude suppliesWhat Claude gets back
inject_sitesnothingthe sites 1Claw lets this machine sign in to, and any setup in progress
inject_setupa login page URL or the name of an existing profile, and optionally your usernamea status, a short code and the link to 1Claw's approval page
inject_removea site nameconfirmation that the site is removed from 1Claw and forgotten here
inject_logina site namewhether the browser is now signed in, or code_wanted when the site sent a one-time code
inject_submit_codethe site, the code_wanted handle and the codewhether the browser is now signed in
inject_opena URL on a set-up sitethe page's title, text and links
inject_screenshotnothinga picture of the current page

Claude cannot choose the account or the password, cannot open sites that are not set up, and has no tool that returns cookies or runs script. The browser window opens on the first tool call.

Setting up a site from Claude

Ask Claude to set up a site and give it the login page. inject_setup builds the site profile from that page if there is none, asks 1Claw for a setup request, opens 1Claw's approval page in your own browser and returns straight away with a short code. On that page you:

  1. sign in to 1Claw if you are not already,
  2. check the code matches the one Claude told you, and that the site and login address are the ones you meant,
  3. type the site's password (and username, if Claude did not pass it),
  4. approve with your passkey or authenticator app.

Then tell Claude you are done. Running it again for the same site stores a new password.

What you type goes to 1Claw and nowhere else: not to this extension, and not to Claude. Claude does choose the login address it passes in, which is why the approval page shows it for you to check. Only https pages are accepted, and nothing is stored or bound until you approve.

Installing

As an extension (recommended).

Download 1claw-inject.mcpb from the latest release, or build it yourself:

npm run pack          # builds 1claw-inject.mcpb

Open 1claw-inject.mcpb with Claude Desktop. It asks for nothing: it finds the setup file and any site profiles you added by itself, and uses the first Chromium-family browser installed.

By hand. Add this to Claude Desktop's claude_desktop_config.json (Settings

Developer > Edit Config):

{
  "mcpServers": {
    "1claw-inject": {
      "command": "npx",
      "args": ["-y", "github:1clawAI/1claw-inject", "mcp"]
    }
  }
}

From a clone, use "command": "node" and "args": ["/absolute/path/to/1claw-inject/src/mcp-server.mjs"] instead. Restart Claude Desktop, then ask it something like "Sign in to example and tell me what is on my home page."

Server settings, all optional environment variables:

VariableMeaning
DEMO_ENV_FILEpath to the setup file, if not ~/.config/1claw-inject/setup.env
DEMO_SITES_DIRfolder of site profiles, if not ~/.config/1claw-inject/sites/
DEMO_BROWSERbrowser name, as in --browser, if not the first one installed
INJECT_HOMEfolder for the setup file and added site profiles, if not ~/.config/1claw-inject
DEMO_HEADLESS=1no visible window
DEMO_TRACE_DIRa folder to debug a failed sign-in: each step of the fill is logged and the bridge's pictures of the login page are saved there. They never show the password being typed, but may show your username, so keep the folder private

Packaging it for other people

The bundle contains code and site profiles only. .mcpbignore keeps .env, cookies and screenshots out, and npm run pack output can be checked with unzip -l 1claw-inject.mcpb. Each person needs their own 1Claw account and sets up their own sites from Claude as described above: pairing a device and creating a binding need their own approval.

The package also has a command-line entry point, 1claw-inject (setup, add-site, demo, show, mcp), which is what the npx lines in this README run.

Your sites

A site is a binding held by 1Claw: the login page, the hosts the password may be typed into, your username, where the form fields are, and which vault secret is the password. The list of sites comes from 1Claw each time, so:

  • a site set up once works on every machine you have paired, with nothing to copy across;
  • a site you add in the 1Claw dashboard shows up here, if this machine's agent has been given access to its password;
  • you can have as many as you like.

Sites found in 1Claw that were not set up on this machine are marked set_up_elsewhere in the list. If two bindings have the same name, the second is listed as <name>-2.

From Claude Desktop, just ask:

  • "Set up sign-in for https://example.com/login" adds a site. Its name comes from the address (example); say "call it work-mail" to choose one.
  • "What sites are set up?" lists them with their usernames.
  • "Set up example again" stores a new password or username for it.
  • "Remove example" removes it from 1Claw and from this machine.

Two accounts on the same site are two sites with different names, such as shop-personal and shop-work. They share the browser's cookies for that site, so signing in to one while the other is signed in may not switch accounts.

Removing a site deletes its binding in 1Claw, so no machine can sign in to it any more, and forgets it here. 1Claw only allows this for a site this machine's agent can read, and only from a paired machine. The stored password stays in your vault until you delete it in the 1Claw dashboard.

Setting a site up again makes a new binding and removes the one it replaces.

From a terminal:

npm run add-site -- https://example.com/login

This opens the login page (nothing is typed or submitted), finds the username field, password field and submit button, and writes ~/.config/1claw-inject/sites/<name>.json. It loads the page twice and ignores any id or name that changed, so sites that randomise their field names still work. The profile is what setup sends to 1Claw. Once the site is set up, the profile is only needed for the optional fields under Tuning a profile.

Then:

npm run bootstrap -- --site <name>
npm run demo -- --site <name>

With only one site, --site can be left out.

Which sites work

  • Works: a login page with the username and password on the same page, served over https.
  • Does not work yet: sites that ask for the username first and the password on a second page, login forms inside an embedded frame, and logins that need a CAPTCHA or a second factor. Setup tells you when it meets one of the first two.
  • "Sign in with Google" and similar are not password logins and are not handled.

Tuning a profile

A generated profile is usually enough. Two optional fields cannot be discovered without an account and make the signed-in check much stronger:

{
  "name": "example",
  "loginUrl": "https://example.com/login",
  "allowedHosts": ["example.com", "www.example.com"],
  "usernameSelector": "#login-form input[name=\"email\"]",
  "passwordSelector": "#login-form #password",
  "submitSelector": "#login-form button[type=\"submit\"]",
  "signedInUrl": "https://example.com/account",
  "profileLinkSelector": "a.my-profile",
  "tour": [["inbox", "/messages"], ["settings", "/account/settings"]]
}
FieldRequiredMeaning
loginUrlyesthe page with the login form; must be https
allowedHostsyesbare hostnames the password may be typed into
passwordSelectoryesCSS selector for the password field
usernameSelectornothe username field; omit if the site remembers it
submitSelectornothe submit button; omit to press Enter
signedInUrlnoa page served only to a signed-in user. Without it the demo falls back to weaker signs (login form gone, logout link present)
profileLinkSelectornoa link to the user's own profile once signed in
tourno[label, path] pages to browse after signing in. Use view-only pages

Site profiles hold no secrets and are safe to share.

Choosing the browser

npm run demo -- --list-browsers     # what is installed here
npm run demo -- --browser brave     # chrome, chrome-canary, chrome-beta, chromium, brave, edge, vivaldi, opera
npm run demo -- --chrome /path/to/any/chromium-based/binary

npm run show and npm run add-site take the same options. Firefox and Safari cannot be used: the bridge starts the browser and talks to it over Chromium's debugging pipe, which they do not have.

What is stored where

WhatWhereCommitted?
Site password1Claw vault onlyno
1Claw account password, passkeynever storedno
Human API keynot used, except by --with-key setup: then wherever you put it (the prompt, your environment or .env)no
Device credential (bb_), agent key (ocv_), ids, site username~/.config/1claw-inject/setup.env, owner-onlyno (outside the project)
The list of sites: login page, hosts, username, selectors1Claw (the binding)no
Session cookiescookies/<site>.json, only with --save-cookiesno (git-ignored)
Screenshots of signed-in pagesscreenshots/no (git-ignored)
Site profiles (URLs and selectors)~/.config/1claw-inject/sites/*.jsonno (outside the project)

.gitignore, .mcpbignore and .claudeignore all list the same private files, and .claude/settings.json stops Claude Code from reading them.

How it works

  • The bridge owns the browser. It launches the browser over a pipe, with no debugging port, and is the only process attached to it. The agent connects to the bridge as if it were the browser, and every command it sends crosses an allowlist.
  • A fill happens somewhere the agent is not. The bridge opens a new page in the agent's browser context, navigates to the binding's own login URL, types the username and password, submits, and closes the page. The session cookie belongs to the browser context, so the agent's own tab is now signed in.
  • Two credentials, two roles. The device credential says which machine and the agent token says which agent. The agent may ask whether a fill is allowed; only the paired device, inside the bridge, may collect the secret. You granted both when you approved setup.
  • One addition of this project. The bridge takes the username and form selectors from the binding. A binding made by the older --with-key setup has none, so src/session.mjs wraps the hosted driver and fills only those gaps from the local profile. The vault still decides whether a fill happens.

Source map:

FileRole
bin/cli.mjsthe 1claw-inject command
scripts/bootstrap.mjssetup for a site, from a terminal
scripts/add-site.mjsbuilds a site profile from a login page, from a terminal
scripts/show-logged-in.mjsopens a browser signed in from saved cookies
src/demo.mjsthe terminal demo
src/mcp-server.mjsthe Claude Desktop / MCP server
src/session.mjsbridge + browser + agent tab, shared by both
src/setup.mjsthe key-based setup steps behind --with-key
src/hosted-setup.mjssetup through 1Claw's approval page
src/bindings.mjsthe list of sites, read from 1Claw, and removing one
src/profile.mjsworks out a login form's selectors
src/passkey.mjspasskey confirmation during key-based setup
src/browsers.mjswhich browser to drive
src/lib.mjssite profiles, .env, prompts, API client
manifest.jsonClaude Desktop extension manifest
test/selftest.mjsoffline end-to-end test

Limits

  • Single-page logins only. Username and password must be on the same page. Sites that ask for the username first and the password on a second page are not supported by the bridge's fill.
  • No CAPTCHA, no two-factor. If the site adds either at login, the fill will type and submit but the site will not sign in.
  • "Filled" is not "signed in". The bridge reports filled once it has typed and submitted, even if the site rejects the login. The demo and the inject_login tool both check the result themselves.
  • The agent can read what a signed-in user can read. Keeping the password from the agent does not limit what it does with the session. Page text returned to Claude is website content and may contain text written by others.
  • Setup trusts what you check. Claude passes the login address to inject_setup. If it were misled into passing a look-alike address, the approval page would show that address, and a password you typed would be bound to it. Likewise, anyone can ask 1Claw for a setup request, so approve only one showing the code you were just given.
  • Organisations that require approvals for new policies. The approval page cannot finish setup there; it stays waiting for sign-off. Use --with-key.
  • A device credential opens sessions by itself. Filling a password still needs the agent's key and its read access. If a machine is lost, revoke its device in 1Claw.
  • One browser for every site. All your sites are signed in to in the same browser window, and Claude can open pages on any of them once they are set up. Set up only sites you are content for Claude to browse as you.
  • Sites follow the agent's access. Any binding this machine's agent can read is a site Claude can sign in to, including ones set up on another machine or in the dashboard. Giving that agent access to another password in 1Claw adds a site here.
  • Removal is for every machine. Asking Claude to remove a site removes the binding in 1Claw, not just a local entry. The extension marks that tool as destructive so Claude Desktop asks first.
  • What has been run where. The self-test runs on macOS, Linux and Windows with Google Chrome on every change. Against the real 1Claw service, only Chrome on macOS has been run by hand. Other Chromium browsers should work but have not been tried.
  • Windows. The setup file cannot be given owner-only permissions there; it relies on your user folder being private to your account. The --with-key setup's passkey step is macOS-only.

Troubleshooting

SymptomLikely cause and fix
Claude says no site is set upAsk it to set one up, or run npm run bootstrap. If you set up with version 1.0.0, the setup is still in the project's .env: run npm run bootstrap once to move it.
The approval page did not openClaude's reply, or the terminal, shows the link; open it. A request expires after 15 minutes: start setup again.
Setup says the request was denied or expiredNothing was set up. Start again and approve the request showing your code.
... is missing from .../setup.env. Run: npm run bootstrapSetup has not been run, or not finished. Run it; finished steps are skipped.
Site "x" has not been set upRun npm run bootstrap -- --site x, or ask Claude to set it up.
--with-key: requires re-authentication (403)The confirmation was refused. With a passkey or authenticator app enrolled, the account password is not accepted. Re-run and use the passkey flow, or --totp.
Passkey prompt never appearsThe Chrome profile holding the passkey is not the front window, or Allow JavaScript from Apple Events is off. Try --passkey-manual.
Demo: browser bridge vault call failed (4xx)1Claw rejected the request. The message names the reason. A 403 on a fill usually means the page's host is not in the binding's allowedHosts.
request_fill -> {"status":"aborted"}The login page navigated between the request and the typing. Run it again.
Fill reports filled but signed in: noWrong stored username or password (run setup again for that site), or the site wants a CAPTCHA or second factor. Run once with DEMO_TRACE_DIR=/some/folder and look at the settle picture to see what the site answered.
Fill reports errorA selector in the site profile did not match. Check them against the live page, or regenerate with npm run add-site -- <url> --force.
Claude Desktop shows no toolsCheck the path in the config, that npm install was run, and Claude Desktop's MCP log for the server's error output.

Development

npm test

runs the offline self-test: the real bootstrap, demo, cookie export, add-site, MCP server, hosted setup and command-line entry point against a local stand-in for the 1Claw API and a local copy of a login form, in a real headless browser. It needs no account and touches neither real service. It proves the wiring, not that the real API or a real site agree with the stand-ins.

Releasing

npm releases (@1claw/inject) and the MCP Registry entry are published from the 1clawAI/1claw repository, where this repo is the packages/1claw-inject submodule. Bump version in package.json, manifest.json and server.json here, merge, then move the submodule there; its publish-inject.yml publishes with npm Trusted Publishing. There is no token in this repo. The .mcpb bundle is still attached to GitHub releases here.

License

Apache-2.0.

NPM
@1claw/inject
Install Command
npm install @1claw/inject