Skip to main content
The contexts command helps you manage saved browser authentication contexts. This allows you to reuse login sessions across multiple MCP server generations without having to authenticate every time.

Usage

Subcommands

string
Show all saved authentication contexts
string
Display details for a specific domain’s context
string
Create a new authentication context for a domain
string
Remove a saved context for a domain

Examples

List All Contexts

View all saved authentication contexts:
Output:

Show Context Details

View details for a specific domain:
Output:

Create New Context

Create an authentication context for a domain:
This will:
  1. Launch a live browser session
  2. Navigate to the domain
  3. Wait for you to complete authentication
  4. Save the browser state (cookies, local storage, etc.)
Complete all authentication steps including 2FA before pressing Enter.

Delete Context

Remove a saved authentication context:
Output:
This action cannot be undone. You’ll need to authenticate again to create a new context.

How Contexts Work

Authentication contexts store browser state to avoid repeated logins:
1

Context Creation

When you authenticate during mcpkit create or run mcpkit contexts create, the browser state is captured including:
  • Cookies
  • Local storage
  • Session storage
  • IndexedDB data
2

Context Storage

The context is saved to your local machine:
Each file contains the serialized browser context.
3

Context Reuse

When creating an MCP server for a domain with a saved context:
The saved context is loaded, so you don’t need to log in again.
4

Context Expiry

Contexts can expire based on the website’s session policies. If a context is invalid, you’ll be prompted to authenticate again.

Context Files

Location

File Format

Context files are JSON containing browser state:
Context files contain sensitive authentication data. Never share these files or commit them to version control.

Use Cases

Multi-Site Workflow

Save contexts for multiple sites you frequently use:

Context Refresh

If your session expires, refresh the context:

Team Sharing (Advanced)

For authorized internal tools, you can share contexts (use caution):
Only share contexts for authorized internal tools where you have permission. Never share personal account contexts.

Domain Matching

Contexts are matched by domain name:
MCPKit normalizes domains by removing www. and subdomains to find the base domain context.

Security Considerations

What’s Stored

Contexts contain:
  • ✅ Session cookies
  • ✅ Authentication tokens
  • ✅ Local storage data
  • ✅ Session storage data
  • ❌ Passwords (never stored)
  • ❌ Credit card information
  • ❌ Personal messages

Best Practices

Protect Your Contexts

Follow these practices to keep your authentication contexts secure:
  1. Use separate accounts - Create dedicated accounts for automation when possible
  2. Rotate contexts - Refresh contexts periodically
  3. Monitor usage - Check your account activity for unexpected sessions
  4. Delete unused contexts - Remove contexts you no longer need
  5. Secure your machine - Use disk encryption and strong passwords

Permissions

Ensure proper file permissions:

Troubleshooting

If MCPKit can’t find a context:
  1. List all contexts:
  2. Check domain spelling:
  3. Create new context:
If a saved context doesn’t work:
  1. Delete and recreate:
  2. Check website session policies - Some sites expire sessions quickly
  3. Verify you’re still logged in to the website manually
If context creation fails:
  1. Complete all auth steps - Including 2FA, email verification, etc.
  2. Wait for full page load - Don’t press Enter until fully logged in
  3. Check browser state - Make sure cookies are enabled
  4. Try manual authentication:
    • Open the site in a normal browser
    • Log in completely
    • Then run mcpkit contexts create
If deletion fails:
  1. Check file permissions:
  2. Manually delete:
  3. Verify deletion:

Advanced Usage

Bulk Context Management

List and delete multiple contexts:

Context Backup

Back up your contexts:

Context Migration

Move contexts to a new machine:

Next Steps

Create MCP Server

Use saved contexts to generate servers

Authentication Guide

Learn more about authentication handling

Examples

See example workflows using contexts

Secrets Management

Configure your API keys