A wallet & guardrail for AI agents: per-agent spending limits, allow-listed categories, 1-click human approval, and a full audit ledger, backed by Stripe Issuing.
Project description
๐งช Almega MCP โ the demonstrator
A wallet & guardrail for AI agents, exposed as a Model Context Protocol (MCP) server. Drop it into Claude Desktop, the Claude Agent SDK, or any MCP-compatible client, and your agent has a wallet with hard limits, a human approval step, and a full ledger โ instantly.
Ships with two backends out of the box:
memory(default): everything in-process. Zero setup.stripe: real Stripe Issuing test-mode Cardholders + virtual Cards. No real money. You watch the dashboard light up live.
Tools the server exposes
| Tool | What it does |
|---|---|
open_wallet(agent_id, monthly_limit, allow, approve_above) |
Give an agent a wallet (and a real Stripe card if backend=stripe) |
pay(agent_id, merchant, amount, category) |
Agent tries to spend โ gets APPROVED, BLOCKED, or AWAITING_YOU |
approve_pending(transaction_id) |
Human says yes to a held transaction |
reject_pending(transaction_id, reason) |
Human says no |
get_wallet(agent_id) |
Current balance & rules |
list_transactions(agent_id?, status?, limit) |
View the ledger |
reset() |
Wipe the local index (Stripe entities are kept) |
Plus two resources:
almega://walletsโ pretty-printed list of every walletalmega://ledgerโ pretty-printed full ledger
Install
pip install -r requirements.txt
(Installs mcp[cli] and stripe. Python 3.10+ recommended.)
Option A โ Memory backend (30-second demo)
No accounts, no env vars. Just run:
mcp dev almega_mcp.py
That opens the MCP Inspector in your browser. Call open_wallet, pay,
approve_pending by hand and watch the ledger update.
Or run the scripted scenario:
python demo.py
Option B โ Stripe Issuing test mode (5 minutes, still $0)
Now the wallet maps to a real Stripe Cardholder + virtual Card and every
pay() creates a real test-mode authorization. You can open the Stripe
dashboard and see Almega's ledger reflected on Stripe in real time.
Setup
- Create a free Stripe account: https://dashboard.stripe.com/register
- Activate Issuing in test mode: https://dashboard.stripe.com/test/issuing/overview (Stripe asks for some business info even in test โ fill it in. Nothing leaves test mode until you flip "Activate live".)
- Grab your TEST secret key: https://dashboard.stripe.com/test/apikeys
Run
export STRIPE_SECRET_KEY=sk_test_...
export ALMEGA_BACKEND=stripe
python stripe_demo.py
Almega refuses to start if your key isn't sk_test_... โ there's no path
to accidentally hit live cards from this code.
What you'll see in the dashboard
- https://dashboard.stripe.com/test/issuing/cards one virtual card per agent, with the agent name on it.
- https://dashboard.stripe.com/test/issuing/authorizations
every
pay()call as a real Stripe authorization, marked approved or declined exactly the way Almega decided.
The wiring is intentionally direct: Almega decides locally, then mirrors the decision onto Stripe. The next step (Phase 4) flips it: Stripe sends a webhook to your server and Almega decides during the authorization. The demo here is the synchronous half โ both halves expose the same MCP surface to the agent.
Wire it into Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json on
macOS (or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"almega": {
"command": "python",
"args": ["/absolute/path/to/almega_mcp.py"],
"env": {
"ALMEGA_BACKEND": "stripe",
"STRIPE_SECRET_KEY": "sk_test_..."
}
}
}
}
Restart Claude Desktop. Claude can now open wallets, attempt payments, and ask you to approve sensitive ones โ all reflected live in Stripe.
Demo script (copy-paste into Claude)
Open a wallet for an agent called
research-botwith a $50 monthly limit, allowingapiandsaascategories, and requiring approval above $25. Then have the agent try the following three payments:
- $12 to
openai.com(category:api)- $30 to
vercel.com(category:saas)- $800 to
luxury-store.io(category:retail)Show me the resulting ledger.
You'll see exactly what the landing's "Exhibit A" shows: the first one approved, the second held for your sign-off, the third blocked.
If you're on the Stripe backend, refresh https://dashboard.stripe.com/test/issuing/authorizations while you run the prompt โ they appear live.
What's deliberately missing (for now)
- Persistence โ wallets live in memory. Restart wipes the local index.
On the Stripe backend the Cardholders + Cards stay in Stripe, but the
link from
agent_idto them is forgotten. - Webhook flow โ for this demo Almega decides synchronously and tells Stripe the outcome. Production flips this: Stripe sends an authorization webhook and Almega decides on the wire.
- Multi-tenant โ single global ledger.
- Auth โ anyone with the MCP connection can do anything.
All of those are by design for this demo. The point is to make the human-in-the-loop UX and the per-agent budget model obvious in five minutes, not to ship a bank.
Where this fits
โโโโโโโโโโโโโโโโโโโ MCP tools โโโโโโโโโโโโโโโโ
โ Your AI agent โ โโโโโโโโโโโโโโโโโโโโโโบ โ Almega โ
โ (Claude, GPT, โ โ (this file) โ
โ LangChainโฆ) โ โโโโโ decision โโโโโโโ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโฌโโโโโโโโ
โ
ALMEGA_BACKEND=
โ
memory โโโโโโโโโโโโโฌโโโโโโโบโโโโโโโโโ stripe
(in-process) โ (test mode)
โ
โผ
โโโโโโโโโโโโโโโโ
โ Stripe โ
โ Issuing โ
โ test mode โ
โโโโโโโโโโโโโโโโ
License
MIT โ see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file almega_mcp-0.1.0.tar.gz.
File metadata
- Download URL: almega_mcp-0.1.0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de5072f67ddc6c198addcf29e9643fa55f40c7653f3bb20a3ff9136524eff015
|
|
| MD5 |
4f5adf6e529d734d2c0166bee5de17eb
|
|
| BLAKE2b-256 |
4813932985e7adf8a0adeb8264018042b677d8334a40ccf1909909783335068d
|
File details
Details for the file almega_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: almega_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2e84b8e4327b0c581bd9904e16aa55d3fdf06de981cf3542cac8ba70ad5cd40
|
|
| MD5 |
e4bf8b371ecf7a11c1a6b64b2d990ccb
|
|
| BLAKE2b-256 |
d0a08a18d3c175604d9c39be276df43e405590bf6f4bbe1e3b232e0f1ccdf39b
|