What you’ll learn:
- Install the AIP Go proxy
- Write your first policy file
- Start the AIP proxy to protect an MCP server
- See AIP block a dangerous operation in real-time
Prerequisites
Before starting, ensure you have:- Go 1.21+ installed (download here)
- An MCP-compatible tool server (Docker MCP, Postgres MCP, or any custom MCP server)
- Basic familiarity with YAML and command-line tools
Installation
Install the AIP Go Implementation
The reference implementation is available as a Go package:You should see output like:
Create Your First Policy File
Create a file called
agent.yaml with a restrictive read-only policy:agent.yaml
See AIP in Action
Now let’s test the policy by attempting both allowed and blocked operations.Test an Allowed Operation
Try a safe read operation:Result: ✅ Request passes through to the MCP server.
Request
Response
Test a Blocked Operation
Now try a dangerous write operation:Result: 🔴 AIP blocks the request.
Request
Response
Example Policies
Here are real-world policy examples for common use cases:Prompt Injection Defense
Protect against the GeminiJack attack class:gemini-jack-defense.yaml
Database Read-Only Access
Restrict SQL operations to SELECT queries only:postgres-readonly.yaml
Human-in-the-Loop for Sensitive Operations
Require user approval for destructive actions:human-approval.yaml
DLP Scanning for Secrets
Prevent accidental exposure of sensitive data:dlp-scanning.yaml
Testing in Monitor Mode
Before enforcing a new policy in production, test it withmonitor mode:
test-policy.yaml
Monitor mode behavior:
- Policy violations are logged to
aip-audit.jsonl - Requests are allowed through even if they violate policy
- Use this to test new policies without breaking production workflows
mode: monitor to mode: enforce.
Next Steps
Policy Reference
Complete YAML schema, validation rules, and advanced examples
Architecture Deep Dive
Understand Layer 1 (Identity) and Layer 2 (Enforcement)
Core Concepts
Learn about AATs, registries, and the two-layer model
AIP Specification
Formal protocol definition for implementers
Troubleshooting
Policy validation fails at startup
Policy validation fails at startup
Common causes:
- Invalid
apiVersion(must beaip.io/v1alpha1) - Empty
allowed_toolswith notool_rules - Invalid regex in
allow_args
All requests are blocked
All requests are blocked
Check your policy:
- Ensure
mode: enforceis intentional (usemonitorfor testing) - Verify tool names exactly match what your MCP server reports
- Check audit log for the actual tool names being called
DLP patterns not matching
DLP patterns not matching
- Regex must use double-escaped backslashes in YAML:
\\dnot\d - Test regex patterns outside AIP first
- Check the audit log for
dlp_eventsto see what was scanned
Human-in-the-loop dialogs not appearing
Human-in-the-loop dialogs not appearing
- Ensure
action: askis set intool_rules - On Linux, requires a display server (X11/Wayland)
- On macOS, requires terminal to have accessibility permissions
- Check AIP logs for “approval prompt sent”
Get Help
GitHub Discussions
Ask questions and share your AIP setup
Report Issues
Found a bug? Let us know
FAQ
Common questions answered
Contributing
Help build AIP