Stop Pasting Passwords Into Your AI Coding Agent A developer built autologin-mcp, an open-source Model Context Protocol server that lets an AI coding agent log a browser tab into a test application without the password ever entering the model's context. When the agent hits a login form, session-expired message, 401/403 or login redirect, it calls the server's login tool and receives a one-time script or a CDP-driven form fill, with credentials stored locally in a 600-permission file outside the project. The server returns needs_human for SSO, passkeys, captchas and MFA, pauses a profile after three failed logins in five minutes, and the developer cautions it prevents accidental exposure rather than a deliberately hostile agent. autologin-mcp is an open-source MCP server that logs your AI agent's browser tab into the app it is testing. The password stays on your machine and never reaches the model. You ask Claude Code to test the checkout flow on staging. It opens Chrome, clicks through a few pages, and then the app shows a login form: the session has expired. From there, the run goes one of two ways. The agent stops and waits for you, or it asks you for the password. Neither is what you wanted from an autonomous test run. The obvious fixes all put the password somewhere it does not belong. .env the agent can read. I wanted the agent to get past the login screen on its own, without the password ever entering the conversation. So I built autologin-mcp. autologin-mcp is a small Model Context Protocol https://modelcontextprotocol.io server with one job. When the tab under test shows a login form, a "session expired" message, a 401/403 or a redirect to a login page, the agent calls its login tool. The tab gets signed in with credentials stored on your machine, and the agent only sees the outcome. You: "Test the checkout flow on staging" Agent: ...navigates... the session has expired, the app shows a login form Agent: calls autologin.login { url } <- no password in the request autologin-mcp: returns a one-time script <- no password in the response Agent: runs it in the tab - { "status": "success" } <- the page got the password from your machine Agent: continues the checkout test The agent decides when to log in by itself. The server ships its own instructions with the tools, so even a fresh agent with no memory of your project calls login when it meets a login form, then carries on with its task. Besides login , the agent gets list profiles names, URLs and usernames, never passwords , login status and open config . There are two ways to fill the form. In neither does the password pass through the agent. Bridge mode is the default and needs no browser setup: login { url } . 127.0.0.1 , valid for 60 seconds. Origin header belongs to the profile's site. Browsers set that header themselves; a page's scripts cannot fake it. success , submitted , or failed with the page's own error message. The only hop that carries the password is step 5, from your machine straight to the page, and only to the profile's own site. CDP mode kicks in when Chrome remote debugging is on chrome://inspect/ remote-debugging , Chrome 144+ . autologin-mcp connects to Chrome over the DevTools Protocol, finds the tab and fills it itself. The agent runs nothing. In both modes the filler handles React, Vue and Angular inputs, forms that render late, identifier-first pages that ask for the email and then swap in the password field, and submit buttons in many languages. Some logins need a person: single sign-on, passkeys, captchas, or a one-time code after the password. autologin-mcp recognises them and returns needs human with a reason sso , passkey , captcha , mfa required instead of failing or retrying, and the agent hands the login to you. Those pages never receive the credentials. Three failed logins in five minutes pause the profile until you check the credentials, so an agent stuck in a loop cannot lock your test account. Several layers keep the password away from the model: 600 , outside every project, so they never end up in git. install adds a Claude Code PreToolUse hook and deny rules that block the agent from reading the credentials folder, also in skip-permissions mode. The honest part: autologin-mcp prevents accidental exposure, not a deliberately hostile agent. The username and the logged-in session are visible to the agent; only the password is kept out. Use dedicated test accounts, never production credentials. You need Node.js 22.12+, Claude Code, and a browser tool for the agent, for example Claude in Chrome. 1. Register the MCP server, the skill and the guard hook in Claude Code npx autologin-mcp install 2. Add a login profile. Run this in a normal terminal, not in the AI chat. npx autologin-mcp add Profile name e.g. staging : staging Root URL e.g. example.com or localhost:3000 : staging.example.com Username: qa@example.com Password hidden : Then restart Claude Code and test as usual. When the app asks for a login, the agent calls login by itself. You can add as many profiles as you need, including several accounts for the same app say admin and viewer . A profile only fills pages whose host matches its root URL, such as example.com , .example.com or localhost:3000 . autologin-mcp does not replace your browser automation. The agent keeps its own browser tool; autologin-mcp only handles the login, then hands the tab back. The one-time loader comes in three forms, one per kind of tool: script field with javascript tool . This is the primary setup, tested end to end on real apps. function field with browser evaluate and evaluate script . expression field with page.evaluate . It also reaches beyond Claude Code: npx autologin-mcp print-config --client codex prints the configuration for Codex CLI. It also knows Gemini CLI, Cursor, VS Code, Claude Desktop and Hermes Agent. The server is in the official MCP Registry as io.github.olgaysezgin/autologin-mcp . The guard hook is a Claude Code feature, so with other agents, deny the credentials folder in their own permission settings. add --password-stdin creates a profile without any questions, reading the password from a pipe: printf '%s' "$STAGING PASSWORD" | npx autologin-mcp add staging \ --url staging.example.com --username qa@example.com --password-stdin -y There is deliberately no --password