streamable-httpApache-2.0updated 9d ago
An unauthenticated "dumb mailbox" FastMCP server that holds OAuth2 authorization codes for retrieval by the originating MCP server. A companion serverless function (Val Town) receives the browser redirect from the OAuth provider and hands the code to this collector's storecode MCP tool. This two-part design works around Horizon proxying only POST traffic on the /mcp/ path β browser GET redirects from OAuth providers cannot reach @mcp.customroute endpoints, so a serverless callback bridges the gap.
What can you do with tollbooth oauth2 collector?
Tollbooth OAuth2 Collector
An unauthenticated "dumb mailbox" FastMCP server that holds OAuth2 authorization codes for retrieval by the originating MCP server. A companion serverless function (Val Town) receives the browser redirect from the OAuth provider and hands the code to this collector's store_code MCP tool. This two-part design works around Horizon proxying only POST traffic on the /mcp/ path β browser GET redirects from OAuth providers cannot reach @mcp.custom_route endpoints, so a serverless callback bridges the gap.
How It Works
βββββββββββββββββ 1. redirect_uri β serverless ββββββββββββββββββββββββ
β OAuth Providerβ βββββββββββββββββββββββββββββββββββ Serverless callback β
β (e.g. Schwab) β GET ?code=AUTH_CODE&state=TOKEN β (Val Town) β
βββββββββββββββββ ββββββββββββββββββββββββ
β
2. POST store_code β
(JSON-RPC /mcp/) βΌ
ββββββββββββββββββββββββ
β OAuth2 Collector β
β store_code tool β
β β encrypts + Postgresβ
ββββββββββββββββββββββββ
β
β 3. code stored
βΌ
ββββββββββββββββ 4. retrieve_code(state=TOKEN) ββββββββββββββββββββββββ
β MCP Server β ββββββββββββββββββββββββββββββββββ β OAuth2 Collector β
β (e.g. β (JSON-RPC /mcp/) β retrieve_code tool β
β schwab-mcp) β ββββββββββββββββββββββββββββββββββ β β returns code once β
ββββββββββββββββ {"found": true, "code": ...} β β deletes from DB β
ββββββββββββββββββββββββ
- MCP server starts an OAuth flow, setting
redirect_urito the serverless callback function's URL - User authorizes in the browser; the OAuth provider redirects to the serverless callback with
?code=...&state=... - Serverless callback (Val Town) POSTs the code to the collector's
store_codeMCP tool over/mcp/ - Collector encrypts the code (AES-256-GCM keyed on SHA-256 of the state) and stores it in Postgres (600s TTL)
- MCP server calls the
retrieve_code(state=...)MCP tool to pick up the code (one-time read, auto-deleted) - MCP server decrypts and exchanges the code for a token using its own credentials
The collector also exposes collector_status (pending-code count and TTL) and service_status (deployed build, incl. git sha) as free MCP tools. The serverless callback source lives in val/oauth_callback.js.
Deployment
Deploy to Horizon:
fastmcp deploy server.py
Set the NEON_DATABASE_URL environment variable in Horizon to point to your Neon Postgres instance.
DPYC Advocate Identity
This collector is registered as an Advocate in the DPYC Social Contract. Consuming MCP servers discover its URL automatically via the DPYC registry:
from tollbooth.registry import resolve_service_by_name
svc = await resolve_service_by_name("tollbooth-oauth2-collector")
collector_url = svc["url"] # e.g., "https://tollbooth-oauth2-collector.fastmcp.app"
No OAUTH_COLLECTOR_URL env var needed β peer discovery is handled by the registry.
Register the serverless callback function's URL (not the collector's) in your OAuth provider's developer portal. It is registered separately in the DPYC registry under the name tollbooth-oauth2-callback:
callback = await resolve_service_by_name("tollbooth-oauth2-callback")
redirect_uri = callback["url"] # e.g., "https://tollbooth-dpyc-oauth.val.run"
Security Model
- Auth codes are useless alone β exchanging a code requires
client_id+client_secret, held only by the consuming MCP server - Encrypted at rest β codes are stored AES-256-GCM-encrypted (keyed on SHA-256 of the state) via the SDK's
encrypt_collector_code; the consuming MCP server decrypts with the same state - HMAC-signed state tokens β the originating MCP server generates tamper-proof state tokens
- One-time read β codes are deleted immediately after retrieval (prevents replay)
- Short TTL β expired codes are automatically cleaned up (600s)
- No secrets stored β the collector never sees client credentials or tokens
Related Repositories
| Repository | Description |
|---|---|
| tollbooth-dpyc | Python SDK for Tollbooth monetization |
| dpyc-community | DPYC Social Contract registry and governance |
| dpyc-oracle | Free community concierge β membership, governance, onboarding |
| tollbooth-authority | Certification Authority MCP service |
| tollbooth-sample | Reference Operator implementation / template |
| tollbooth-pricing-studio | iOS pricing editor for Operators |
| cypher-mcp | Monetized graph answers β named Cypher over Neo4j/AuraDB |
| schwab-mcp | Schwab brokerage MCP server |
| thebrain-mcp | Personal Brain knowledge-graph MCP server |
| excalibur-mcp | X (Twitter) posting MCP server |
| taxsort-mcp | Tax sorting and classification MCP server |
| optionality-mcp | Options analytics MCP server |
| tollbooth-oauth2-collector | OAuth2 callback collector (Advocate) |
| tollbooth-shortlinks | URL shortener utility Operator |
License
Copyright 2026 Lonnie VanZandt. Licensed under the Apache License, Version 2.0.
Install
Add tollbooth oauth2 collector to your client. Pick the one you use.
claude mcp add --transport http tollbooth-oauth2-collector https://tollbooth-oauth2-collector.fastmcp.app/mcpcodex mcp add tollbooth-oauth2-collector --url https://tollbooth-oauth2-collector.fastmcp.app/mcp{
"mcpServers": {
"tollbooth-oauth2-collector": {
"url": "https://tollbooth-oauth2-collector.fastmcp.app/mcp"
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
{
"servers": {
"tollbooth-oauth2-collector": {
"type": "http",
"url": "https://tollbooth-oauth2-collector.fastmcp.app/mcp"
}
}
}Add to `.vscode/mcp.json` in your workspace.
{
"mcpServers": {
"tollbooth-oauth2-collector": {
"url": "https://tollbooth-oauth2-collector.fastmcp.app/mcp"
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"tollbooth-oauth2-collector": {
"serverUrl": "https://tollbooth-oauth2-collector.fastmcp.app/mcp"
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
Score
39 / 100
Incomplete
- Documentation25/25
- Maintenance25/25
- Trust13/20
- Capability0/15
- Install experience12/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 1 days ago
- Has a release history
- Repository is not archived
- Licensed Apache-2.0
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 6 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint β no local install
Version history
| Versions | Published |
|---|---|
| 0.2.11Latest | Aug 24, 2026 |
| 0.2.10 | Aug 24, 2026 |
| 0.2.5 | Aug 10, 2026 |