Skip to main content

agentbouncer-signer

Official Python request signer for signing AI agent and MCP HTTP requests protected by AgentBouncer.

Implements RFC 9421 (HTTP Message Signatures with the web-bot-auth profile) and RFC 9530 (Content-Digest), fully compatible with @agentbouncer/sdk on the server side.

Installation

pip install agentbouncer-signer

Optional HTTP client extras:

pip install "agentbouncer-signer[httpx]"
pip install "agentbouncer-signer[requests]"

Quick Start

1. With the Official Python MCP SDK (httpx)

import json
import os
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
from agentbouncer_signer import AgentBouncerSigner

signer = AgentBouncerSigner(
    private_jwk=json.loads(os.environ["AGENT_PRIVATE_JWK"]),
    signature_agent="https://agent.example.com",
)

async def main():
    async with streamablehttp_client(
        "https://mcp.example.com/mcp",
        auth=signer.httpx_auth(access_token=os.environ.get("USER_OAUTH_TOKEN")),
    ) as (read_stream, write_stream, _):
        async with ClientSession(read_stream, write_stream) as session:
            await session.initialize()
            tools = await session.list_tools()
            print(tools)

2. With httpx (Async or Sync)

import httpx
from agentbouncer_signer import AgentBouncerSigner

signer = AgentBouncerSigner(
    private_jwk=PRIVATE_JWK,
    signature_agent="https://agent.example.com",
)

async with httpx.AsyncClient(auth=signer.httpx_auth()) as client:
    res = await client.post("https://api.example.com/v1/orders", json={"sku": "pro-plan"})
    res.raise_for_status()

3. With requests

import requests
from agentbouncer_signer import AgentBouncerSigner

signer = AgentBouncerSigner(
    private_jwk=PRIVATE_JWK,
    signature_agent="https://agent.example.com",
)

res = requests.post(
    "https://api.example.com/v1/orders",
    json={"sku": "pro-plan"},
    auth=signer.requests_auth(),
)

4. Framework-agnostic (sign / sign_json)

from agentbouncer_signer import AgentBouncerSigner

signer = AgentBouncerSigner(
    private_jwk=PRIVATE_JWK,
    key_id="proj-key-1",  # optional if "kid" is inside private_jwk
    signature_agent="https://agent.example.com",
    expires_in_ms=60_000,
)

signed = signer.sign_json(
    url="https://mcp.example.com/mcp",
    method="POST",
    json_data={"jsonrpc": "2.0", "id": 1, "method": "tools/list"},
    access_token="optional-user-oauth-jwt",
)

# signed.headers -> dict with Signature, Signature-Input, Signature-Agent, Content-Digest, Content-Type
# signed.body    -> exact UTF-8 bytes matching Content-Digest

Generating an Ed25519 Keypair (for local testing)

from agentbouncer_signer import generate_ed25519_jwk_pair

private_jwk, public_jwk = generate_ed25519_jwk_pair(kid="my-agent-key-1")

License

MIT

Metadata

Release files for agentbouncer-signer 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentbouncer-signer 1.0.0
File Size Uploaded Provenance Actions
agentbouncer_signer-1.0.0.tar.gz 9.5 kB Without provenance Details for agentbouncer_signer-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentbouncer-signer 1.0.0
File Interpreter ABI Platform Actions
agentbouncer_signer-1.0.0-py3-none-any.whl Python 3 none any Details for agentbouncer_signer-1.0.0-py3-none-any.whl

Total release size: 20.4 kB

Release files / agentbouncer_signer-1.0.0.tar.gz

Download URL agentbouncer_signer-1.0.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
777e3e65cdbac1af6400380873abcfc95d085fcf5448831da0a02493b83b4664
BLAKE2b-256 checksum
How to use checksums
9ef3a49d0dd1a5cf3c4e734dcf7cd58dfe15003fa1c0a5f560191e4cae9160a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / agentbouncer_signer-1.0.0-py3-none-any.whl

Download URL agentbouncer_signer-1.0.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
55405a8d228e7aae5331c5cf7a7ed58707c1fd3890a0f021afa2e4c24215a7b9
BLAKE2b-256 checksum
How to use checksums
b5c9ddabf1743243dcbd24e4f67478c7665f237a4b2c819b7241df50d5e71ece
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for agentbouncer-signer 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page