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

mcpkit contexts <subcommand> [domain]

Subcommands

list
string
Show all saved authentication contexts
show <domain>
string
Display details for a specific domain’s context
create <domain>
string
Create a new authentication context for a domain
delete <domain>
string
Remove a saved context for a domain

Examples

List All Contexts

View all saved authentication contexts:
mcpkit contexts list
Output:
Saved Authentication Contexts
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📦 mcpkit.sh
   Created: 2024-01-15 14:30:00
   Size: 2.3 KB

📦 github.com
   Created: 2024-01-14 10:15:00
   Size: 4.1 KB

Total: 2 contexts

Show Context Details

View details for a specific domain:
mcpkit contexts show mcpkit.sh
Output:
Context: mcpkit.sh
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Domain: mcpkit.sh
Created: 2024-01-15 14:30:00
Last Used: 2024-01-15 16:45:00
Size: 2.3 KB
Cookies: 12
Local Storage Items: 5

Status: ✓ Valid

Create New Context

Create an authentication context for a domain:
mcpkit contexts create mcpkit.sh
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.)
🌐 Opening live browser session for mcpkit.sh...

Complete authentication in your browser.
Press Enter when done...

✓ Context saved successfully!
Complete all authentication steps including 2FA before pressing Enter.

Delete Context

Remove a saved authentication context:
mcpkit contexts delete mcpkit.sh
Output:
✓ Context for mcpkit.sh deleted successfully
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:
~/.mcpkit/contexts/
├── mcpkit.sh.json
├── github.com.json
└── notion.com.json
Each file contains the serialized browser context.
3

Context Reuse

When creating an MCP server for a domain with a saved context:
mcpkit create https://mcpkit.sh --skip-auth
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

  • macOS/Linux
  • Windows
~/.mcpkit/contexts/

File Format

Context files are JSON containing browser state:
{
  "domain": "mcpkit.sh",
  "created": "2024-01-15T14:30:00.000Z",
  "cookies": [
    {
      "name": "session_token",
      "value": "encrypted_value",
      "domain": ".mcpkit.sh",
      "path": "/",
      "expires": 1737820200
    }
  ],
  "localStorage": {
    "user_id": "user_123",
    "theme": "dark"
  }
}
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:
# Set up contexts once
mcpkit contexts create mcpkit.sh
mcpkit contexts create github.com
mcpkit contexts create notion.com

# Generate servers without re-authenticating
mcpkit create https://mcpkit.sh --skip-auth
mcpkit create https://github.com --skip-auth
mcpkit create https://notion.com --skip-auth

Context Refresh

If your session expires, refresh the context:
# Delete old context
mcpkit contexts delete mcpkit.sh

# Create new context
mcpkit contexts create mcpkit.sh

Team Sharing (Advanced)

For authorized internal tools, you can share contexts (use caution):
# Export context
cp ~/.mcpkit/contexts/internal-tool.com.json ~/shared/

# Team member imports
cp ~/shared/internal-tool.com.json ~/.mcpkit/contexts/
Only share contexts for authorized internal tools where you have permission. Never share personal account contexts.

Domain Matching

Contexts are matched by domain name:
URLMatched Context
https://mcpkit.shmcpkit.sh
https://www.mcpkit.shmcpkit.sh (or www.mcpkit.sh if exists)
https://app.mcpkit.shmcpkit.sh (or app.mcpkit.sh if exists)
https://mcpkit.sh/team/issue-123mcpkit.sh
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:
# Check permissions
ls -la ~/.mcpkit/contexts/

# Should be readable only by you (600)
chmod 600 ~/.mcpkit/contexts/*.json

Troubleshooting

If MCPKit can’t find a context:
  1. List all contexts:
    mcpkit contexts list
    
  2. Check domain spelling:
    mcpkit contexts show mcpkit.sh
    
  3. Create new context:
    mcpkit contexts create mcpkit.sh
    
If a saved context doesn’t work:
  1. Delete and recreate:
    mcpkit contexts delete mcpkit.sh
    mcpkit contexts create mcpkit.sh
    
  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:
    ls -la ~/.mcpkit/contexts/
    
  2. Manually delete:
    rm ~/.mcpkit/contexts/mcpkit.sh.json
    
  3. Verify deletion:
    mcpkit contexts list
    

Advanced Usage

Bulk Context Management

List and delete multiple contexts:
# List all contexts
mcpkit contexts list

# Delete old contexts
for domain in old-site1.com old-site2.com; do
  mcpkit contexts delete $domain
done

Context Backup

Back up your contexts:
# Create backup directory
mkdir ~/mcpkit-backup

# Copy all contexts
cp ~/.mcpkit/contexts/*.json ~/mcpkit-backup/

# Restore when needed
cp ~/mcpkit-backup/*.json ~/.mcpkit/contexts/

Context Migration

Move contexts to a new machine:
# On old machine
tar -czf mcpkit-contexts.tar.gz -C ~/.mcpkit contexts

# Transfer file to new machine
scp mcpkit-contexts.tar.gz newmachine:~/

# On new machine
mkdir -p ~/.mcpkit
tar -xzf mcpkit-contexts.tar.gz -C ~/.mcpkit

Next Steps