exposureguard avatar

Haldir

exposureguard/haldir

If you're shipping AI agents that touch real APIs, this is the governance layer you bolt on before production. Haldir wraps every MCP tool call with session-scoped permission checks, encrypted secrets the model never sees, a hash-chained audit trail for compliance, and optional human-in-the-loop approvals. The CLI gives you live dashboards, audit exports, and webhook delivery stats. Self-host with Docker Compose and Postgres, or point at their cloud. Integrates with LangChain, CrewAI, AutoGen, and Vercel AI SDK. Built for teams that need SOC2-ready evidence packs and can't afford to let an agent burn through rate limits or leak credentials in prompt context.

GitHub stars
3
tools
10
transport
STDIO
last updated
Apr 5, 2026

Tools

10 tools

Public tool metadata for what this MCP can expose to an agent.

createSessionCreate a new agent session with scoped permissions and an optional spend budget. Every AI agent must have an active session before it can access secrets, make payments, or perform auditable actions. You specify which scopes (e.g. read, write, admin) the agent is allowed, a TTL...4 params

Create a new agent session with scoped permissions and an optional spend budget. Every AI agent must have an active session before it can access secrets, make payments, or perform auditable actions. You specify which scopes (e.g. read, write, admin) the agent is allowed, a TTL...

Parameters* required
agent_idstring
Unique identifier for the AI agent requesting a session. Used to track all actions back to this agent.
scopesarray
List of permission scopes to grant (e.g. ['read', 'browse', 'write']). Defaults to ['read', 'browse'] if omitted.
spend_limitnumber
Maximum USD amount this session is allowed to spend. Once reached, all payment authorizations are denied. Omit for unlimited.
ttlinteger
Session time-to-live in seconds. The session automatically expires after this duration. Defaults to 3600 (1 hour).
getSessionRetrieve the current state of an agent session including its scopes, spend budget, remaining balance, and validity status. Use this to check whether a session is still active before performing privileged operations, or to inspect how much budget remains.1 params

Retrieve the current state of an agent session including its scopes, spend budget, remaining balance, and validity status. Use this to check whether a session is still active before performing privileged operations, or to inspect how much budget remains.

Parameters* required
session_idstring
The session ID returned by create_session. This is the unique identifier for the session to inspect.
revokeSessionImmediately revoke an agent session, permanently disabling all permissions and blocking further actions under that session. Use this when an agent misbehaves, exceeds its mandate, or when a task is complete and the session should be cleaned up for security hygiene.1 params

Immediately revoke an agent session, permanently disabling all permissions and blocking further actions under that session. Use this when an agent misbehaves, exceeds its mandate, or when a task is complete and the session should be cleaned up for security hygiene.

Parameters* required
session_idstring
The session ID to revoke. Once revoked, this session cannot be reactivated.
checkPermissionCheck whether a specific session has a given permission scope. Returns a boolean indicating if the action is allowed. Use this before performing any sensitive operation to enforce least-privilege access control without risking a 403 error on the actual call.2 params

Check whether a specific session has a given permission scope. Returns a boolean indicating if the action is allowed. Use this before performing any sensitive operation to enforce least-privilege access control without risking a 403 error on the actual call.

Parameters* required
scopestring
The permission scope to check (e.g. 'read', 'write', 'admin', 'execute').
session_idstring
The session ID to check permissions for.
storeSecretStore an encrypted secret in the Haldir Vault with an optional scope requirement. Secrets are encrypted at rest using AES and can only be retrieved by sessions that hold the required scope. Use this to safely store API keys, tokens, credentials, or any sensitive data that agen...3 params

Store an encrypted secret in the Haldir Vault with an optional scope requirement. Secrets are encrypted at rest using AES and can only be retrieved by sessions that hold the required scope. Use this to safely store API keys, tokens, credentials, or any sensitive data that agen...

Parameters* required
namestring
A unique name for the secret (e.g. 'openai_api_key', 'stripe_token'). Used to retrieve it later.
scope_requiredstring
The minimum permission scope a session must hold to read this secret. Defaults to 'read'.
valuestring
The secret value to encrypt and store. This is never logged or exposed in audit trails.
getSecretRetrieve a decrypted secret from the Vault. If a session_id is provided, the session's scopes are checked against the secret's required scope before returning the value. This is the primary way agents access credentials — through policy-controlled, auditable retrieval.2 params

Retrieve a decrypted secret from the Vault. If a session_id is provided, the session's scopes are checked against the secret's required scope before returning the value. This is the primary way agents access credentials — through policy-controlled, auditable retrieval.

Parameters* required
namestring
The name of the secret to retrieve, as specified when it was stored.
session_idstring
Optional session ID for scope-based access control. If provided, the session must hold the secret's required scope.
authorizePaymentAuthorize a payment against an agent session's spend budget. The amount is deducted from the session's remaining budget if sufficient funds exist. If the payment would exceed the budget, it is denied. Every authorization is logged to the audit trail for full financial accounta...4 params

Authorize a payment against an agent session's spend budget. The amount is deducted from the session's remaining budget if sufficient funds exist. If the payment would exceed the budget, it is denied. Every authorization is logged to the audit trail for full financial accounta...

Parameters* required
amountnumber
The amount in the specified currency to authorize (e.g. 0.50 for fifty cents).
currencystring
ISO 4217 currency code. Defaults to 'USD'.
descriptionstring
Human-readable description of what this payment is for (e.g. 'GPT-4 API call', 'search query').
session_idstring
The session ID whose budget to charge. The session must have a spend_limit set.
logActionLog an agent action to the tamper-evident audit trail with automatic anomaly detection. Every tool call, API request, or decision an agent makes should be logged here. The Watch module automatically flags suspicious patterns like rapid-fire actions, high-cost operations, or un...5 params

Log an agent action to the tamper-evident audit trail with automatic anomaly detection. Every tool call, API request, or decision an agent makes should be logged here. The Watch module automatically flags suspicious patterns like rapid-fire actions, high-cost operations, or un...

Parameters* required
actionstring
Description of the action taken (e.g. 'searched for competitor pricing', 'sent email to client').
cost_usdnumber
Optional cost in USD associated with this action (e.g. API call cost). Defaults to 0.
detailsstring
Optional additional context or metadata about the action in free-form text.
session_idstring
The session ID performing the action. Links this log entry to the agent and its permissions.
toolstring
Name of the tool or service being used (e.g. 'web_search', 'code_exec', 'email_send').
getAuditTrailQuery the audit trail to review all actions taken by agents. Filter by session ID, agent ID, tool name, or flagged-only entries. Returns a chronological list of logged actions with their costs, timestamps, and anomaly flags. Essential for compliance reviews and debugging agent...5 params

Query the audit trail to review all actions taken by agents. Filter by session ID, agent ID, tool name, or flagged-only entries. Returns a chronological list of logged actions with their costs, timestamps, and anomaly flags. Essential for compliance reviews and debugging agent...

Parameters* required
agent_idstring
Filter audit entries to a specific agent. Omit to see all agents.
flagged_onlyboolean
If true, only return entries that were flagged as anomalous. Defaults to false.
limitinteger
Maximum number of entries to return. Defaults to 100.
session_idstring
Filter audit entries to a specific session. Omit to see all sessions.
toolstring
Filter to entries from a specific tool (e.g. 'web_search'). Omit to see all tools.
getSpendGet a summary of total spend across agent sessions, broken down by session or agent. Returns total USD spent, number of transactions, and budget utilization. Use this to monitor cost control and detect runaway spending before budgets are exhausted.2 params

Get a summary of total spend across agent sessions, broken down by session or agent. Returns total USD spent, number of transactions, and budget utilization. Use this to monitor cost control and detect runaway spending before budgets are exhausted.

Parameters* required
agent_idstring
Get spend for a specific agent across all their sessions. Omit to see all agents.
session_idstring
Get spend for a specific session. Omit to see aggregate spend.

Sponsors

Readme

Haldir

Scoped permissions, spend caps, an encrypted vault, and an audit log that can prove it wasn't edited — for AI agents that call tools, move money, and read secrets.

tests PyPI License: MIT GitHub Stars

A live Haldir audit log being tampered with: a past entry is rewritten, the inclusion proof stops matching the live Merkle root, and the verdict flips to 'Tamper detected'


View the full README on GitHub

Details

Repository
github.com/exposureguard/haldir
Package
haldir
Transport
STDIO
Registry
MCP registry, active

More from exposureguard