Skip to main content

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 wallet
  • almega://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

  1. Create a free Stripe account: https://dashboard.stripe.com/register
  2. 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".)
  3. 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

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-bot with a $50 monthly limit, allowing api and saas categories, and requiring approval above $25. Then have the agent try the following three payments:

  1. $12 to openai.com (category: api)
  2. $30 to vercel.com (category: saas)
  3. $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_id to 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

almega_mcp-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

almega_mcp-0.1.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

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

Hashes for almega_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de5072f67ddc6c198addcf29e9643fa55f40c7653f3bb20a3ff9136524eff015
MD5 4f5adf6e529d734d2c0166bee5de17eb
BLAKE2b-256 4813932985e7adf8a0adeb8264018042b677d8334a40ccf1909909783335068d

See more details on using hashes here.

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

Hashes for almega_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2e84b8e4327b0c581bd9904e16aa55d3fdf06de981cf3542cac8ba70ad5cd40
MD5 e4bf8b371ecf7a11c1a6b64b2d990ccb
BLAKE2b-256 d0a08a18d3c175604d9c39be276df43e405590bf6f4bbe1e3b232e0f1ccdf39b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page