Skip to main content

mcp-account-kit

Provider-neutral runtime kit for cookie-handover MCP account servers built on FastMCP, signin-window, and account-connections.

Installation

Base runtime (cryptography, fastmcp):

pip install mcp-account-kit

Optional extras:

  • mcp-account-kit[web] — OIDC-guarded personal Connections UI and BrowserRoutes ASGI middleware (signin-window[oidc], account-connections, starlette).
  • mcp-account-kit[login] — Managed-policy hosted browser sign-in app (signin-window, uvicorn).
  • mcp-account-kit[login-base] — Hosted browser sign-in runtime including pinned patchright (used to build mcp-login-base).

Modules

Module Purpose
mcp_account_kit.auth Comma-separated bearer token parsing, minimum length enforcement, and FastMCP StaticTokenVerifier construction.
mcp_account_kit.fsio Crash-safe 0600 atomic file writes, O_NOFOLLOW private reads, cross-process file locks, and stat keys.
mcp_account_kit.errors Closed public error taxonomy (ErrorCatalog, PublicErrorAction, ServiceError) that never leaks log_detail or raw exceptions.
mcp_account_kit.state Persistent per-account UTC daily request budgets, pushback pause breaker with Retry-After, and unresolved error tracking.
mcp_account_kit.session AES-256-GCM sealed per-person cookie storage bound to person_id via AAD, domain allowlists, monotonic generations, and disconnect barriers.
mcp_account_kit.build_identity Embedded build_identity.json loader, fork-safe log context, and CLI embedder (python -m mcp_account_kit.build_identity).
mcp_account_kit.logs Stderr JSONL formatter, person_tag, SafeParser, and FastMCP ToolCallLog middleware.
mcp_account_kit.connections ([web]) OIDC-guarded personal-only Connections UI (PersonalConnections) and BrowserRoutes ASGI middleware with Host validation.
mcp_account_kit.login ([login]) Managed Chrome policy check (chrome_policy_installed, PolicyMissing) and serve_login_app.
mcp_account_kit.testing Reusable pytest assertions for self-describing error catalogs, root JSON Schema combinators, and MCP tool annotations.

Quick Example

from pathlib import Path
from mcp_account_kit.errors import ErrorCatalog
from mcp_account_kit.session import LocalSession
from mcp_account_kit.state import StateStore

CATALOG = ErrorCatalog(
    next_step={
        "invalid_argument": "Fix the arguments and call again.",
        "rate_limited": "Wait until the pause reported by status ends.",
        "budget_exhausted": "Today's request budget is spent. It resets at 00:00 UTC.",
    },
    retryable=frozenset(),
    action={
        "invalid_argument": "none",
        "rate_limited": "retry_later",
        "budget_exhausted": "retry_later",
    },
)

store = StateStore(
    Path("/tmp/example-state"),
    budget=200,
    error_factory=CATALOG.error,
    valid_codes=CATALOG.codes,
    service_name="Example",
)

session = LocalSession(
    Path("/tmp/example-state/session.bin"),
    seal_magic=b"EXMP1",
    aad_prefix="example-mcp:session",
    allowed_domains=("example.com",),
    person_id="user-1",
    session_key=b"\x00" * 32,
)

Hosted Login Base Image (mcp-login-base)

Dockerfile.login-base publishes ghcr.io/benjamin-di/mcp-login-base with pinned Google Chrome, noVNC (/opt/novnc), Xvfb, x11vnc, dumb-init, patchright, signin-window (with managed Chrome policy pre-installed), and mcp-account-kit running as non-root USER 1000:1000.

Downstream login services can build a thin Dockerfile.login on top:

# syntax=docker/dockerfile:1.7
FROM ghcr.io/benjamin-di/mcp-login-base:<version>@sha256:<digest>

ENV EXAMPLE_LOGIN_NOVNC=/opt/novnc
USER root
WORKDIR /app
COPY pyproject.toml README.md LICENSE ./
COPY src ./src
RUN --mount=type=cache,target=/root/.cache/uv \
    UV_CACHE_DIR=/root/.cache/uv uv pip install --system --compile-bytecode --no-deps . && rm -rf /app/src
USER 1000:1000
CMD ["python", "-m", "example_login"]

Development

make bootstrap
make check

Metadata

Release files for mcp-account-kit 0.1.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 mcp-account-kit 0.1.0
File Size Uploaded Provenance Actions
mcp_account_kit-0.1.0.tar.gz 175.0 kB Without provenance Details for mcp_account_kit-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-account-kit 0.1.0
File Interpreter ABI Platform Actions
mcp_account_kit-0.1.0-py3-none-any.whl Python 3 none any Details for mcp_account_kit-0.1.0-py3-none-any.whl

Total release size: 201.2 kB

Release files / mcp_account_kit-0.1.0.tar.gz

Download URL mcp_account_kit-0.1.0.tar.gz
Size 175.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2c21933e759270430b3176439406296cb2d1cc1aa01b7fafb4d10a923f0a8e5a
BLAKE2b-256 checksum
How to use checksums
f5e350a31a597471a0a5d71c4536daad7548d9599d361e025c356b8c19c5805f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mcp_account_kit-0.1.0-py3-none-any.whl

Download URL mcp_account_kit-0.1.0-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a86fe21c6722fe8e059e2ba005153bef062b3be5d71281421c99b397a7fe3dcc
BLAKE2b-256 checksum
How to use checksums
0898d875a9c212086568fce42dcde96f774b5aaf6dd6cbbcab9ff08b4985ff93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.12 {"installer":{"name":"uv","version":"0.13.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mcp-account-kit 0.1.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

0.1.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