Barndoor SDK
A lightweight, framework-agnostic Python client for the Barndoor Platform REST APIs and Model Context Protocol (MCP) servers. The SDK removes boiler-plate around:- Secure, offline-friendly authentication to Barndoor (interactive PKCE flow + token caching).
- Server registry – list, inspect and connect third-party providers (Salesforce, Notion, Slack …).
- Managed Connector Proxy – build ready-to-use connection parameters for any LLM/agent framework (CrewAI, LangChain, custom code …) without importing Barndoor-specific adapters.
Download here: https://pypi.org/project/barndoor/
How it works
The SDK orchestrates a multi-step flow to connect your code to third-party services:- Authentication: You log in via Barndoor to get a JWT token
- Registry API: Using the JWT, query available MCP servers and manage OAuth connections
- MCP Proxy: Stream requests through Barndoor’s proxy with the JWT for authorization
- Third-party service: The proxy forwards your requests to Salesforce, Notion, etc.
Installation
Local development with uv
For the fastest install and reproducible builds you can use uv instead ofpip.
Using a custom OAuth callback port
If port52765 is blocked (or you prefer another), you can:
- Register the new callback URL in your Barndoor Agent application, e.g.
- Run the login helper with the matching port
.env file next to each script containing:
Authentication workflow
Barndoor APIs expect a user JWT issued by your Barndoor tenant. The SDK offers two ways to obtain & store such a token:| Option | Command | When to use |
|---|---|---|
| Interactive CLI | python -m barndoor.sdk.cli_login (alias: barndoor-login) | One-time setup on laptops / CI machines |
| In-code helper | await barndoor.sdk.login_interactive() | Notebooks or scripts where you do not want a separate login step |
- Spin up a tiny localhost callback server.
- Open the system browser to Barndoor.
- Exchange the returned code for a JWT.
- Persist the token to
~/.barndoor/token.json(0600 permissions).
.env file) must define the Agent OAuth application:
Quick-start in four lines
params is a plain dict with url, headers and (optionally) transport – ready to plug into any HTTP / SSE / WebSocket client. See the examples below for CrewAI & LangChain usage.
Using the Registry API
await sdk.initiate_connection(server_id)– returns an OAuth URL the user must visit.await bd.ensure_server_connected(sdk, "notion")– combines status polling + browser launch.
Model Context Protocol Connection
Once a server is connected you can stream requests through Barndoor’s proxy edge.API Documentation
The complete API specification is available inbarndoor/sdk/docs/openapi.yaml. This covers all endpoints currently used by the SDK including:
- Server listing and details
- OAuth connection initiation
- Connection status checking
