<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: olgay sezgin</title>
    <description>The latest articles on DEV Community by olgay sezgin (@olgay_sezgin_4cb2becaceb2).</description>
    <link>https://dev.to/olgay_sezgin_4cb2becaceb2</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2419451%2F3f2c75de-f8ca-49ee-aa6a-06abb20eb811.jpg</url>
      <title>DEV Community: olgay sezgin</title>
      <link>https://dev.to/olgay_sezgin_4cb2becaceb2</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/olgay_sezgin_4cb2becaceb2"/>
    <language>en</language>
    <item>
      <title>Stop Pasting Passwords Into Your AI Coding Agent</title>
      <dc:creator>olgay sezgin</dc:creator>
      <pubDate>Tue, 24 Nov 2026 12:09:12 +0000</pubDate>
      <link>https://dev.to/olgay_sezgin_4cb2becaceb2/stop-pasting-passwords-into-your-ai-coding-agent-2pk2</link>
      <guid>https://dev.to/olgay_sezgin_4cb2becaceb2/stop-pasting-passwords-into-your-ai-coding-agent-2pk2</guid>
      <description>&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgxequf0u636fmj4dwtvv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgxequf0u636fmj4dwtvv.gif" alt="Claude Code finds an expired session, calls the login tool, runs the one-time script and continues. The password never appears in the chat." width="760" height="578"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every workaround leaks the password
&lt;/h2&gt;

&lt;p&gt;The obvious fixes all put the password somewhere it does not belong.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Paste it into the chat.&lt;/strong&gt; Everything in the conversation is sent to the model provider. It stays in transcripts and logs, and it can resurface in context summaries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put it in a project &lt;code&gt;.env&lt;/code&gt; the agent can read.&lt;/strong&gt; Same problem: once the agent reads the file, the password is in the context. And a project &lt;code&gt;.env&lt;/code&gt; has a way of ending up in git.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type it in yourself.&lt;/strong&gt; That works, but you are now babysitting a run that was supposed to be autonomous. Long runs hit expired sessions more than once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  What autologin-mcp does
&lt;/h2&gt;

&lt;p&gt;autologin-mcp is a small &lt;a href="https://modelcontextprotocol.io" rel="noopener noreferrer"&gt;Model Context Protocol&lt;/a&gt; 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 &lt;code&gt;login&lt;/code&gt; tool. The tab gets signed in with credentials stored on your machine, and the agent only sees the outcome.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You:            "Test the checkout flow on staging"
Agent:          ...navigates... the session has expired, the app shows a login form
Agent:          calls autologin.login({ url })                 &amp;lt;- no password in the request
autologin-mcp:  returns a one-time script                      &amp;lt;- no password in the response
Agent:          runs it in the tab -&amp;gt; { "status": "success" }  &amp;lt;- the page got the password from your machine
Agent:          continues the checkout test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;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 &lt;code&gt;login&lt;/code&gt; when it meets a login form, then carries on with its task. Besides &lt;code&gt;login&lt;/code&gt;, the agent gets &lt;code&gt;list_profiles&lt;/code&gt; (names, URLs and usernames, never passwords), &lt;code&gt;login_status&lt;/code&gt; and &lt;code&gt;open_config&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the password stays out of the model
&lt;/h2&gt;

&lt;p&gt;There are two ways to fill the form. In neither does the password pass through the agent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bridge mode&lt;/strong&gt; is the default and needs no browser setup:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The agent calls &lt;code&gt;login({ url })&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;autologin-mcp returns a small loader script that contains only a one-time URL on &lt;code&gt;127.0.0.1&lt;/code&gt;, valid for 60 seconds.&lt;/li&gt;
&lt;li&gt;The agent runs it in the tab with the JavaScript tool it already has.&lt;/li&gt;
&lt;li&gt;The loader fetches the filler from the local bridge, and the filler looks for the login form.&lt;/li&gt;
&lt;li&gt;Only when it is about to type does the page ask the bridge for the credentials. The bridge releases them only if the request's &lt;code&gt;Origin&lt;/code&gt; header belongs to the profile's site. Browsers set that header themselves; a page's scripts cannot fake it.&lt;/li&gt;
&lt;li&gt;The filler fills the form, submits it, waits for the outcome and returns it: &lt;code&gt;success&lt;/code&gt;, &lt;code&gt;submitted&lt;/code&gt;, or &lt;code&gt;failed&lt;/code&gt; with the page's own error message.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CDP mode&lt;/strong&gt; kicks in when Chrome remote debugging is on (&lt;code&gt;chrome://inspect/#remote-debugging&lt;/code&gt;, Chrome 144+). autologin-mcp connects to Chrome over the DevTools Protocol, finds the tab and fills it itself. The agent runs nothing.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  It knows when to stop
&lt;/h2&gt;

&lt;p&gt;Some logins need a person: single sign-on, passkeys, captchas, or a one-time code after the password. autologin-mcp recognises them and returns &lt;code&gt;needs_human&lt;/code&gt; with a reason (&lt;code&gt;sso&lt;/code&gt;, &lt;code&gt;passkey&lt;/code&gt;, &lt;code&gt;captcha&lt;/code&gt;, &lt;code&gt;mfa_required&lt;/code&gt;) instead of failing or retrying, and the agent hands the login to you. Those pages never receive the credentials.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  The security model, and its limits
&lt;/h2&gt;

&lt;p&gt;Several layers keep the password away from the model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One global file.&lt;/strong&gt; Credentials live in a single file in your home folder with permissions &lt;code&gt;600&lt;/code&gt;, outside every project, so they never end up in git.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A guard hook.&lt;/strong&gt; &lt;code&gt;install&lt;/code&gt; adds a Claude Code PreToolUse hook and deny rules that block the agent from reading the credentials folder, also in skip-permissions mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redacted results.&lt;/strong&gt; Every tool result and error is scrubbed of each configured password before the agent sees it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Origin lock.&lt;/strong&gt; Credentials go only to pages on the profile's own site. A prompt-injected page on another site that asks the agent to "log in here" gets nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One-time and loopback only.&lt;/strong&gt; The bridge listens on &lt;code&gt;127.0.0.1&lt;/code&gt;, and each script works once, for 60 seconds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started
&lt;/h2&gt;

&lt;p&gt;You need Node.js 22.12+, Claude Code, and a browser tool for the agent, for example Claude in Chrome.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Register the MCP server, the skill and the guard hook in Claude Code&lt;/span&gt;
npx autologin-mcp install

&lt;span class="c"&gt;# 2. Add a login profile. Run this in a normal terminal, not in the AI chat.&lt;/span&gt;
npx autologin-mcp add
&lt;span class="c"&gt;#   Profile name (e.g. staging): staging&lt;/span&gt;
&lt;span class="c"&gt;#   Root URL (e.g. example.com or localhost:3000): staging.example.com&lt;/span&gt;
&lt;span class="c"&gt;#   Username: qa@example.com&lt;/span&gt;
&lt;span class="c"&gt;#   Password (hidden):&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then restart Claude Code and test as usual. When the app asks for a login, the agent calls &lt;code&gt;login&lt;/code&gt; by itself.&lt;/p&gt;

&lt;p&gt;You can add as many profiles as you need, including several accounts for the same app (say &lt;code&gt;admin&lt;/code&gt; and &lt;code&gt;viewer&lt;/code&gt;). A profile only fills pages whose host matches its root URL, such as &lt;code&gt;example.com&lt;/code&gt;, &lt;code&gt;*.example.com&lt;/code&gt; or &lt;code&gt;localhost:3000&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  It works with the browser tool you already use
&lt;/h2&gt;

&lt;p&gt;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:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude in Chrome&lt;/strong&gt; runs the &lt;code&gt;script&lt;/code&gt; field with &lt;code&gt;javascript_tool&lt;/code&gt;. This is the primary setup, tested end to end on real apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Playwright MCP&lt;/strong&gt; and &lt;strong&gt;chrome-devtools-mcp&lt;/strong&gt; take the &lt;code&gt;function&lt;/code&gt; field with &lt;code&gt;browser_evaluate&lt;/code&gt; and &lt;code&gt;evaluate_script&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Puppeteer&lt;/strong&gt; takes the &lt;code&gt;expression&lt;/code&gt; field with &lt;code&gt;page.evaluate&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It also reaches beyond Claude Code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Other agents.&lt;/strong&gt; &lt;code&gt;npx autologin-mcp print-config --client codex&lt;/code&gt; 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 &lt;code&gt;io.github.olgaysezgin/autologin-mcp&lt;/code&gt;. The guard hook is a Claude Code feature, so with other agents, deny the credentials folder in their own permission settings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scripts and CI.&lt;/strong&gt; &lt;code&gt;add --password-stdin&lt;/code&gt; creates a profile without any questions, reading the password from a pipe:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'%s'&lt;/span&gt; &lt;span class="s2"&gt;"$STAGING_PASSWORD"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; npx autologin-mcp add staging \
  --url staging.example.com --username qa@example.com --password-stdin -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is deliberately no &lt;code&gt;--password &amp;lt;value&amp;gt;&lt;/code&gt; option, because it would leave the password in your shell history and the process list.&lt;/p&gt;

&lt;h2&gt;
  
  
  What building it taught me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The agent's JavaScript call often never comes back.&lt;/strong&gt; In my Chrome profile, submitting any login form made another extension take over the tab, most likely a password manager offering to save the password. Claude in Chrome then failed with "Detached while handling command", although the login had worked. So the page also reports the outcome to the server, and a &lt;code&gt;login_status&lt;/code&gt; tool hands it to the agent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A memoryless agent has to find its own way.&lt;/strong&gt; I ran five fresh Claude Code sessions (Opus, Sonnet and Haiku) on tasks that never mentioned logging in. All five called &lt;code&gt;login&lt;/code&gt; on their own. The JavaScript call failed every time; four went straight to &lt;code&gt;login_status&lt;/code&gt;, and one re-ran the script and got the first run's outcome. That is why the server's instructions spell out the whole recovery path.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Run this script" means three different things.&lt;/strong&gt; Claude in Chrome's &lt;code&gt;javascript_tool&lt;/code&gt; supports top-level &lt;code&gt;await&lt;/code&gt; but does not wait for a returned Promise. Puppeteer's &lt;code&gt;page.evaluate&lt;/code&gt; waits for a Promise but has no top-level &lt;code&gt;await&lt;/code&gt;, so it fails with "await is not defined". Playwright MCP wants a function. A friend hit the Puppeteer case in a real test, and that report became a release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A good guard is annoying.&lt;/strong&gt; The hook blocks any shell command that so much as mentions the credentials folder, including my own test commands while I was building this. That is exactly the point.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;TOTP codes, generated on your machine so the secret never reaches the page or the agent&lt;/li&gt;
&lt;li&gt;Logins that move between documents, and login forms inside iframes&lt;/li&gt;
&lt;li&gt;Opt-in auto-login in CDP mode, which watches a profile's URL and logs in without the agent asking&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;doctor&lt;/code&gt; and &lt;code&gt;test &amp;lt;profile&amp;gt;&lt;/code&gt; commands&lt;/li&gt;
&lt;li&gt;Installers that write the configuration for Codex CLI, Gemini CLI and Cursor&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;autologin-mcp is free and MIT licensed. If it saves you a babysat test run, a star on GitHub helps other people find it. Issues and pull requests are welcome, especially reports from agents other than Claude Code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/olgaysezgin/autologin-mcp" rel="noopener noreferrer"&gt;github.com/olgaysezgin/autologin-mcp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Website and docs: &lt;a href="https://olgaysezgin.github.io/autologin-mcp/" rel="noopener noreferrer"&gt;olgaysezgin.github.io/autologin-mcp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;npm: &lt;a href="https://www.npmjs.com/package/autologin-mcp" rel="noopener noreferrer"&gt;npmjs.com/package/autologin-mcp&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>testing</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
