A Five-Year-Old Intranet App Gets an AI Sidecar via MCP and npm
Many organizations sit on legacy internal tools that are too costly to rewrite but still gate critical data behind browser logins. This pattern lets an AI agent operate those tools through their existing APIs and authentication, turning a dead-end maintenance burden into automatable infrastructure without opening security holes.
An old internal web app with near-zero daily users can be given an AI interface without touching its codebase. The approach wraps the app's existing login and file APIs behind an MCP server distributed as a private npm package. An agent launches the server via npx, opens the user's local Chrome to complete a real login, captures the session token into process memory, and then calls the same list and download endpoints the browser would hit. Credentials never touch disk or configuration files, and the server process restart clears them completely. The technique works across Cursor, Claude Desktop, VS Code, and Windsurf because MCP is client-agnostic. The npm package bundles Playwright to drive the local browser, zod for input validation, and the MCP SDK to expose three tools: login_with_browser, list_files, and download_file. A logout tool optionally calls the backend to invalidate the server-side session before clearing memory. The entire setup avoids intranet tunneling, public exposure, or unauthenticated backdoors, keeping the old system's security model intact while letting an agent do the repetitive clicking.
Treating the browser as a credential broker rather than building a separate auth flow preserves the existing security model and avoids the need for API keys or service accounts.
Publishing the MCP server as a private npm package turns a one-off script into a versioned, distributable tool that any team member's agent client can consume with a single config block.
The approach deliberately avoids headless Chromium downloads by relying on the user's local Chrome installation, which sidesteps CI/CD incompatibilities and keeps the setup lightweight for Windows desktops common in enterprise environments.
Clearing credentials on process restart means the agent's access is ephemeral by default; there is no persistent session to leak or rotate, which aligns with zero-trust patterns even inside a legacy system.