MACAW Secure AI Adapters
Drop-in replacements for OpenAI, Anthropic, LangChain, MCP, and MCP Proxy (inline gateway) for deterministic policy-based security controls for enterprise apps.
What This Is
Open source interfaces that add MACAW transparently to popular LLM and Agentic frameworks.
MACAW creates a distributed zero-trust mesh where tool endpoints serve as policy enforcement points, enabling preventative, deterministic security controls - even for non-deterministic LLMs and Agentic applications.
These adapters are thin wrappers that route requests through the MACAW security layer. Change one import line and get:
- Deterministic policy enforcement - Control models, tokens, operations, data access, and actions performed
- Identity propagation - User identity flows through every LLM call for per-user policies
- Cryptographic audit trail - Complete record of all AI operations with signatures
- Zero code changes - Your existing code works unchanged
Learn more about our research: Authenticated Workflows | Protecting Context and Prompts
Installation
From PyPI:
pip install macaw-adapters[all]
# Or install specific adapters only
pip install macaw-adapters[openai]
pip install macaw-adapters[claude] # Anthropic SDK
pip install macaw-adapters[langchain]
pip install macaw-adapters[pydantic-ai]
pip install macaw-adapters[litellm] # 100+ providers
pip install macaw-adapters[mcp]
pip install macaw-adapters[mcp-proxy] # For external MCP servers
From source:
git clone https://github.com/macawsecurity/secureAI.git
pip install "./secureAI[all]"
Quick Start
SecureOpenAI
# Before
from openai import OpenAI
client = OpenAI()
# After - just change the import
from macaw_adapters.openai import SecureOpenAI
client = SecureOpenAI(app_name="my-app")
# Same API, now with MACAW security
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)
SecureAnthropic
# Before
from anthropic import Anthropic
client = Anthropic()
# After
from macaw_adapters.anthropic import SecureAnthropic
client = SecureAnthropic(app_name="my-app")
# Same API
response = client.messages.create(
model="claude-3-haiku-20240307",
max_tokens=100,
messages=[{"role": "user", "content": "Hello!"}]
)
SecureMCP (Your MCP Servers)
from macaw_adapters.mcp import SecureMCP
mcp = SecureMCP("calculator")
@mcp.tool(description="Add two numbers")
def add(a: float, b: float) -> float:
return a + b
mcp.run()
SecureMCPProxy (External MCP Servers)
Inline gateway for third-party MCP servers (Salesforce, Google, Slack, etc.):
from macaw_adapters.mcp import SecureMCPProxy
# Connect to external MCP server - MACAW security applied automatically
proxy = SecureMCPProxy(
app_name="salesforce-mcp",
upstream_url="https://mcp.salesforce.com",
upstream_auth={"type": "bearer", "token": SF_TOKEN}
)
# Discover available tools
tools = proxy.list_tools()
# Call tools - policy enforced, signed, audited
result = proxy.call_tool("query_accounts", {"limit": 10})
# Multi-user: bind to user identity
user_proxy = proxy.bind_to_user(user_client)
result = user_proxy.call_tool("query_accounts", {"limit": 10})
Install with: pip install macaw-adapters[mcp-proxy]
LangChain
# Before
from langchain_openai import ChatOpenAI
# After
from macaw_adapters.langchain import ChatOpenAI
# Same API
llm = ChatOpenAI(model="gpt-4")
response = llm.invoke("Hello!")
SecurePydanticAI
Drop-in replacement for Pydantic AI's Agent. Model calls and tool calls both
become MACAW resources:
# Before
from pydantic_ai import Agent
agent = Agent(OpenAIChatModel("gpt-4o-mini"), tools=[query_catalog])
# After
from macaw_adapters.pydantic_ai import SecureAgent
agent = SecureAgent(
OpenAIChatModel("gpt-4o-mini"),
app_name="catalog-agent",
tools=[query_catalog],
)
result = agent.run_sync("Which tables contain PII?")
Every way Pydantic AI accepts tools is governed - tools=, @agent.tool,
FunctionToolset, and MCPToolset. Policy can also gate which model a router
such as FallbackModel may use, and refuse provider-side tools like web search
before the provider is called.
Install with: pip install macaw-adapters[pydantic-ai]
SecureLiteLLM
# Before
import litellm
# After
from macaw_adapters import litellm
response = litellm.completion(
model="groq/llama3-70b-8192",
messages=[{"role": "user", "content": "Hello!"}]
)
Install with: pip install macaw-adapters[litellm]
Multi-User Support
For SaaS applications with per-user policies:
from macaw_adapters.openai import SecureOpenAI
from macaw_client import MACAWClient, RemoteIdentityProvider
# Create shared service
service = SecureOpenAI(app_name="my-saas")
# Authenticate user
jwt_token, _ = RemoteIdentityProvider().login("alice", "password")
user = MACAWClient(user_name="alice", iam_token=jwt_token, agent_type="user")
user.register()
# Bind user to service - their identity flows through
user_openai = service.bind_to_user(user)
# Policies evaluated against alice's permissions
response = user_openai.chat.completions.create(...)
How It Works
┌─────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ Your App │────▶│ Secure Adapter │────▶│ LLM API │
│ │ │ (SecureOpenAI,etc) │ │ (OpenAI, Claude) │
└─────────────┘ └──────────┬──────────┘ └─────────────────────┘
│
▼
┌─────────────────────┐
│ MACAW Client │
│ Endpoint │
└──────────┬──────────┘
│
▼
┌─────────────────────┐
│ Trust Layer │
│ Control Plane │
│ ───────────────── │
│ • Policy Engine │
│ • Identity/Claims │
│ • Audit Trail │
└─────────────────────┘
Key Features
| Feature | Description |
|---|---|
| Drop-in Replacement | Change one import, keep all your code |
| Per-User Policies | Different users get different permissions |
| Model Restrictions | Control which models each user can access |
| Token Limits | Enforce max_tokens per user/role |
| Streaming Support | Full support for streaming responses |
| Audit Logging | Cryptographically signed audit trail |
Requirements
- Python 3.9+
- macaw_client v0.9.9+ - The MACAW client library (download from console)
Getting Started
- Sign up at console.macawsecurity.ai
- Download and install macaw_client
- Configure your workspace and policies
- Install macaw-adapters and start building
Adapters
| Adapter | Package | Wraps |
|---|---|---|
| SecureOpenAI | macaw_adapters.openai |
OpenAI Python SDK |
| SecureAnthropic | macaw_adapters.anthropic |
Anthropic Python SDK |
| SecureMCP | macaw_adapters.mcp |
Your MCP servers (FastMCP-compatible) |
| SecureMCPProxy | macaw_adapters.mcp |
External MCP servers (inline gateway) |
| LangChain | macaw_adapters.langchain |
LangChain (OpenAI, Anthropic, Agents) |
| SecurePydanticAI | macaw_adapters.pydantic_ai |
Pydantic AI agents (models + tools) |
| SecureLiteLLM | macaw_adapters.litellm |
LiteLLM (100+ providers) |
Examples
See the examples/ directory for complete working examples:
examples/openai/- OpenAI adapter examplesexamples/anthropic/- Anthropic adapter examplesexamples/langchain/- LangChain integration examplesexamples/pydantic_ai/- Pydantic AI agent examplesexamples/litellm/- LiteLLM multi-provider examplesexamples/mcp/- MCP server, client, and proxy examplesexamples/attestations/- Human-in-the-loop approval examplesexamples/phishing-resistance/- Login-strength gating (passkey/amr) examples
Console Dev Hub
Everything in this repository is also available in the MACAW Console's Dev Hub with interactive features:
Console > Dev Hub
├── Quick Start
│ └── Download Client SDK (macOS/Linux/Windows, Python 3.9-3.12) and Adapters
├── Tutorials
│ └── Role-Based Access Control
│ ├── Multi-User SaaS Patterns
│ ├── Agent Orchestration
│ └── Policy Hierarchies
├── Examples
│ ├── OpenAI (drop-in, multi-user, streaming, A2A)
│ ├── Anthropic (drop-in, multi-user, streaming, A2A)
│ ├── MCP
│ │ ├── Simple Invocation
│ │ ├── Discovery & Resources
│ │ ├── Logging
│ │ ├── Progress Tracking
│ │ ├── Sampling
│ │ ├── Elicitation
│ │ ├── Roots
│ │ └── MCP Proxy (Inline Gateway for External MCP)
│ ├── LangChain
│ │ ├── Drop-in Agents
│ │ ├── Multi-user Permissions
│ │ ├── Agent Orchestration
│ │ ├── LLM Wrappers (OpenAI, Anthropic)
│ │ └── Memory Integration
│ └── Pydantic AI
│ ├── Drop-in Simple
│ ├── Model Routing (policy-driven fallback)
│ ├── Provider-Side Tools
│ ├── Multi-User Bind
│ └── MCP Compose
└── Reference
├── MACAW Client SDK
├── Adapter APIs
├── MAPL Policy Language
└── Claims Mapping
Access at console.macawsecurity.ai → Dev Hub tab.
Research
Learn more about the technical foundations of MACAW:
- Authenticated Workflows: A Systems Approach to Protecting Agentic AI
- Protecting Context and Prompts: Deterministic Security for Non-Deterministic AI
Links
- GitHub: github.com/macawsecurity/secureAI
- Documentation: www.macawsecurity.ai/docs
- Console: console.macawsecurity.ai
- Support: help@macawsecurity.com
License
Apache 2.0 - See LICENSE for details.
Release files for macaw-adapters 0.9.10.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| macaw_adapters-0.9.10.1.tar.gz | 100.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| macaw_adapters-0.9.10.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 216.8 kB
Release files / macaw_adapters-0.9.10.1.tar.gz
| Download URL | macaw_adapters-0.9.10.1.tar.gz |
|---|---|
| Size | 100.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d02d3ea7a62b9f48f3e2a3fabf092827e4f7eb03c540afccbb9fdf2d9aed5118
|
|
BLAKE2b-256 checksum How to use checksums |
af154b441ca656b6da46be4bef5e87a52cb9a478fd0d31f7a6d5d4a1e3c4527c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / macaw_adapters-0.9.10.1-py3-none-any.whl
| Download URL | macaw_adapters-0.9.10.1-py3-none-any.whl |
|---|---|
| Size | 116.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
484b2b376bf1b9e89dac8ddb78d60206a469713fe95ba35e035ce307a54badc6
|
|
BLAKE2b-256 checksum How to use checksums |
5b79f838a2f9eb54132077999e259fcd8dd32646f9c62ce88fdfcaf277d308a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|