Skip to content

Conversation

@ed-lepedus-thenvoi
Copy link

Adds 7 new tools exposing the Chrome DevTools Protocol WebAuthn domain for virtual authenticator testing:

Tool Description
webauthn_enable Enable virtual authenticator environment
webauthn_add_authenticator Add CTAP2/U2F virtual authenticator
webauthn_remove_authenticator Remove virtual authenticator
webauthn_get_credentials List registered credentials
webauthn_add_credential Pre-seed a credential
webauthn_clear_credentials Clear all credentials
webauthn_set_user_verified Toggle user verification state

Use Case

Enables automated testing of WebAuthn/passkey flows without physical security keys or platform authenticators (Touch ID, Windows Hello). Useful for:

  • E2E testing of passkey registration and authentication
  • CI/CD pipelines that need to test WebAuthn flows
  • Development workflows where hardware authenticators aren't available

Implementation

  • Uses Puppeteer's internal _client() API to access CDP session (same pattern as performance tools)
  • Follows existing tool patterns with defineTool() and Zod schemas
  • Includes user-friendly error messages for common failure modes
  • All 295 tests passing, linting clean

Testing

Verified E2E on webauthn.io - successfully completed passkey registration and authentication flows using virtual authenticator.

🤖 Generated with Claude Code

ed-lepedus-thenvoi and others added 8 commits January 24, 2026 09:10
- Create src/tools/webauthn.ts with enableWebAuthn tool
- Export from src/tools/tools.ts
- Add basic test in tests/tools/webauthn.test.ts

The tool currently does nothing - just returns success message.
Next step: implement actual WebAuthn.enable CDP call.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The webauthn_enable tool now actually calls the CDP WebAuthn.enable
command, enabling the virtual authenticator environment.

Test verifies this by successfully adding a virtual authenticator
after calling the tool.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements the ability to add virtual authenticators with configurable:
- protocol (u2f, ctap2)
- transport (usb, nfc, ble, internal)
- hasResidentKey (passkey support)
- hasUserVerification
- isUserVerified

Returns the authenticatorId for use in subsequent operations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix ESLint import/order for type imports in tools.ts
- Apply Prettier formatting to webauthn files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added tools:
- webauthn_remove_authenticator: Remove a virtual authenticator
- webauthn_get_credentials: List credentials on an authenticator
- webauthn_add_credential: Add a pre-seeded credential
- webauthn_clear_credentials: Clear all credentials
- webauthn_set_user_verified: Toggle user verification state

All tools follow the established pattern using CDP WebAuthn domain.
Tests verify each tool works correctly (except add_credential which
requires complex key generation - verified schema only).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Run npm run docs to regenerate tool reference
- Update WEBAUTHN_IMPLEMENTATION.md with final status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add getCDPSession() helper to centralize CDP session access
- Add handleWebAuthnError() for user-friendly error messages
- Wrap all CDP calls in try/catch blocks
- Add specific error handling for addCredential (userHandle, privateKey)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@google-cla
Copy link

google-cla bot commented Jan 24, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! We prefer not to include too much low level CDP code directly into the MCP server. Please use the existing WebAuthN model in the chrome-devtools-frontend dependency (third_party/devtools-frontend/src/front_end/core/sdk/WebAuthnModel.ts) (similar to how source map models are integrated). Alternatively, if the DevTools models do not satisfy the use case for some reason, we should consider adding higher level API into Puppeteer so that it is beneficial beyond the MCP server alone.

It would be great to also file an issue first to allow us to prioritize the feature and understand the use case to perhaps define an API that requires fewer tools.

Comment on lines +24 to +30
- [`webauthn_add_authenticator`](#webauthn_add_authenticator)
- [`webauthn_add_credential`](#webauthn_add_credential)
- [`webauthn_clear_credentials`](#webauthn_clear_credentials)
- [`webauthn_enable`](#webauthn_enable)
- [`webauthn_get_credentials`](#webauthn_get_credentials)
- [`webauthn_remove_authenticator`](#webauthn_remove_authenticator)
- [`webauthn_set_user_verified`](#webauthn_set_user_verified)
Copy link
Collaborator

@OrKoN OrKoN Jan 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we could use a single tool configure_webauthn to configure all of the WebAuthN virtual authenticator state (getting rid of dedicated commands). If WebAuthN is enabled, its status should be returned for all calls (in McpResponse) eliminating a need for get. If any CDP events can be emitted via the user actions on the page, the McpContext should accumulate them automatically and include them in the McpResponse automatically.

- **[Emulation](#emulation)** (9 tools)
- [`emulate`](#emulate)
- [`resize_page`](#resize_page)
- [`webauthn_add_authenticator`](#webauthn_add_authenticator)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably want a dedicated category for WebAuthN with a separate CLI flag to control it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants