How Authentication Works
MCPKit uses Browserbase’s persistent context feature to save and reuse authentication sessions:1
Initial Authentication
When you first create an MCP server for an authenticated site, MCPKit opens a live browser session where you can log in normally.
2
Context Storage
The browser context ID is saved to
~/.mcpkit/contexts/<domain>.txt3
Context Reuse
Future MCP server executions load the saved context, so you don’t need to log in again.
Authentication Flow
For End Users
When using an MCPKit generated MCP server:For Developers
In generated servers (src/index.ts):
Managing Contexts
View Saved Contexts
Create New Context
Delete Context
Show Context Details
Security Best Practices
Authentication contexts contain sensitive session data. Follow these practices
to keep them secure.
1. Protect Context Files
2. Use Separate Accounts
For automation, create dedicated service accounts:3. Rotate Contexts Regularly
4. Never Commit Contexts
Add to.gitignore:
Common Authentication Types
OAuth / SSO
Many modern tools use OAuth or SSO:- Google OAuth
- GitHub OAuth
- Microsoft OAuth
- SAML SSO
- Custom OAuth providers
Username & Password
Traditional login forms:API Keys
Some tools use API key authentication:For API-first tools, you might not need browser automation at all. Consider
using the native API directly.
Multi-Factor Authentication (2FA)
MCPKit fully supports 2FA:Troubleshooting Authentication
Session Expired
Session Expired
If your saved context stops working:Why it happens:
- Session tokens have expiration dates
- Password changes invalidate sessions
- Security policies force re-authentication
Login Loop
Login Loop
If the browser keeps asking you to log in:
- Complete all authentication steps - Don’t press Enter until fully logged in
- Check for redirects - Wait for final landing page
- Verify cookies - Some sites use complex cookie setups
- Try incognito - Clear any conflicting sessions
2FA Not Working
2FA Not Working
If two-factor authentication fails:
- Use authenticator apps over SMS when possible
- Complete before pressing Enter - Don’t rush the process
- Check for “remember this device” - Enable if available
- Verify time sync - TOTP codes require accurate system time
Permission Denied
Permission Denied
If tools fail with permission errors:
- Check account permissions - Verify you have necessary access rights
- Try different account - Use an admin account if needed
- Review workspace settings - Some features may be restricted
- Contact admin - Request necessary permissions
Advanced Patterns
Context Sharing (Team Use)
For authorized internal tools only:Only share contexts for authorized service accounts on internal tools. Never
share personal account contexts.