passport-mcp
by: JoshMayerr
Build MCP servers for any website with automatic browser auth syncing
πOverview
Purpose: To facilitate the creation of MCP servers for various websites by automatically synchronizing browser authentication credentials.
Overview: PassportMCP (ppmcp) is a robust framework that allows developers to build Managed Cloud Platforms (MCP) servers. It simplifies the authentication process by leveraging existing browser sessions to streamline the interaction with web APIs, avoiding the limitations often associated with developer APIs.
Key Features:
-
Automatic browser auth syncing: Seamlessly synchronizes authentication states from the browser to ensure up-to-date credentials for requests.
-
Normal MCP tool creation: Enables developers to build standard MCP tools easily, enhancing development efficiency.
-
Works with any website: Provides compatibility across multiple websites without being restricted to those with dedicated APIs.
-
Always uses latest auth state: Ensures that requests utilize the most current authentication data, promoting reliability.
-
Handles cookies and headers: Manages cookies and headers automatically, simplifying request configurations.
-
All credentials stay on your machine: Guarantees that sensitive authentication information remains local, enhancing security.
PassportMCP
PassportMCP (ppmcp) lets you build MCP servers for any website with automatic browser authentication syncing. It wraps FastMCP and automatically adds necessary auth headers and cookies from the browser to outbound requests. As long as you log in through the browser, it's ready to be used. It's often easier than paying for developer APIs (ex: Twitter/X), avoiding rate limits, waiting for approval, or for sites that don't have an API.
If you're not building an MCP server, you can use the ultra-lightweight BrowserPassport
HTTP client instead.
Features
- π Automatic browser auth syncing
- π οΈ Normal MCP tool creation
- π Works with any website
- π Always uses latest auth state
- πͺ Handles cookies and headers
- π All credentials stay on your machine
Quick Start
- Install the Package
pip install ppmcp
- Set Up Native Messaging and Auth Syncing
ppmcp setup # Sets up with Chrome Web Store extension
- Enable Request Monitoring
- Click the PassportMCP extension icon in Chrome
- Toggle "Monitor Requests" on
- Visit and log into your target website
- Create Your First MCP Tool
from passportmcp import PassportMCP
# Create an MCP instance
mcp = PassportMCP("example", "example.com")
# Define a tool
@mcp.tool()
async def get_data():
response = mcp.client.get("https://example.com/api/data")
return response.json()
Installation Options
Option 1: Chrome Web Store Extension (Recommended)
pip install ppmcp
ppmcp setup
Option 2: Local Development
- Build the Extension
git clone https://github.com/joshmayerr/passport-mcp.git
cd extension
npm install
npm run build # or npm run dev for watch mode
- Load in Chrome
- Open Chrome and go to
chrome://extensions
- Enable "Developer mode" in the top right
- Click "Load unpacked" and select the
extension/dist
directory - Note the extension ID from Chrome (shown under the extension name)
- Set Up Native Messaging
ppmcp setup --local --extension-id=your_extension_id
# OR
ppmcp setup --local # You'll be prompted for the ID
CLI Commands
ppmcp setup
- Set up native messagingppmcp doctor
- Check installation statusppmcp uninstall
- Remove PassportMCP
How It Works
PassportMCP consists of three main components:
- Chrome Extension
- Monitors web requests
- Captures authentication state
- Sends data to native host
- Native Host
- Receives data from extension
- Stores authentication state
- Provides data to SDK
- SDK
- PassportMCP: High-level MCP tool creation
- BrowserPassport: Low-level auth handling
Advanced Example: LinkedIn API
from passportmcp import PassportMCP
mcp = PassportMCP("linkedin", "linkedin.com")
@mcp.tool()
async def search_linkedin(query: str):
response = mcp.client.get(
"https://www.linkedin.com/voyager/api/graphql",
params={
"includeWebMetadata": "true",
"variables": "()",
"queryId": "voyagerDashMySettings.7ea6de345b41dfb57b660a9a4bebe1b8"
}
)
return response.json()
BrowserPassport HTTP Client
For simpler use cases where you don't need MCP tools, use the lightweight BrowserPassport
HTTP client directly:
from passportmcp import BrowserPassport
# Initialize the client
client = BrowserPassport()
# Make authenticated requests
response = client.get("https://api.example.com/data")
data = response.json()
Features
- π Automatic credential injection from browser
- π³ Path-based credential inheritance
- π οΈ Full HTTP method support (GET, POST, PUT, DELETE)
- π Local credential storage
- π Built on
httpx
for modern HTTP features
Advanced Usage
# Custom configuration
client = BrowserPassport(
storage_path="~/custom/path/creds.json",
timeout=60.0,
verify=True # SSL verification
)
# Custom headers/cookies (override stored ones)
response = client.post(
"https://api.example.com/data",
headers={"Custom-Header": "value"},
cookies={"custom_cookie": "value"},
json={"key": "value"}
)
Security
- β Credentials never leave your machine
- β No cloud storage or transmission
- β Limited to authorized domains
- β LLMs never see your credentials
Unlike services that automate accounts in the cloud, PassportMCP keeps everything local and secure.
Development
For SDK development:
cd sdks/python
pip install -e .
Project Structure
passport-mcp/
βββ extension/ # Chrome extension
βββ sdks/
β βββ python/ # Python SDK
β βββ typescript/ # TypeScript SDK (coming soon)
βββ shared/
βββ native-host/ # Native messaging host
Roadmap
- TypeScript SDK
- Firefox extension
- Safari extension
- Auth state sharing
- Enterprise features
- More language SDKs
License
MIT License - see LICENSE for details