This release is a pre-release and may not be stable for production use.
tba-capability-mcp-authorization
tba-capability-mcp-authorization
MCP grant resolution, current scope authorization, and owned connection revocation.
Overview · Installation · Quick Start · Usage · API · Contributing · Governance · License
Overview
Summary
Resolve current owner and bot permissions for an approved MCP connection.
Why This Package
A stored grant records consent. Each request still needs to check the account, acting identity, and resource at the time of use.
When to Use
Use it between OAuth validation and the product's MCP resource policy.
Features
- Check browser consent against requested and currently held scopes.
- Resolve a live principal from a grant bound to the client, resource, and tenant.
- Require a tool's scopes and the application's own resource check.
- Delegate owned connection revocation to the authoritative store.
Non-Goals
OAuth transport, token validation and issuance, transaction management, and application resource policy are provided by the host.
Getting Started
Prerequisites
Python 3.10 or later, an authenticated OAuth integration, and an application grant and identity store.
Installation
The package is pre-release. Build from the repository with its pinned dependency sources.
uv
tba-capability-mcp-authorization is not declared published. From the source checkout:
uv pip install .
pip
tba-capability-mcp-authorization is not declared published. From the source checkout:
python -m pip install .
Poetry
tba-capability-mcp-authorization is not declared published. From a separate Poetry project, replace the path with your checkout:
poetry add /path/to/tba-capability-mcp-authorization
Quick Start
Example
Source: docs/readme/quick_start.py.
from tba_capability_mcp_authorization import MCPGrantBinding
binding = MCPGrantBinding(
grant_id="g-123",
tenant_id="example-tenant",
client_id="example-client",
resource="https://example.com/mcp",
)
assert binding.tenant_id == "example-tenant"
Expected Result
The binding identifies one grant, client, tenant and MCP resource.
Usage
Common Workflows
Call approve after validating the browser principal and OAuth request. Persist consent and issue authorization codes through the product's transactional callback. Call resolve for live scope checks after OAuth validation, and authorize_tool to include the product's resource check.
Source: docs/readme/usage.py.
from collections.abc import Callable
from tba_capability_mcp_authorization import (
MCPAuthorizationCapability,
MCPGrantBinding,
MCPResourceCheck,
MCPPrincipal,
)
async def authorize_read(
capability: MCPAuthorizationCapability,
verified_binding: MCPGrantBinding,
verified_token_scopes: frozenset[str],
can_read_resource: MCPResourceCheck,
) -> MCPPrincipal | None:
return await capability.authorize_tool(
verified_binding,
verified_token_scopes,
required_scopes={"journal:read"},
check_resource=can_read_resource,
)
assert isinstance(authorize_read, Callable)
Configuration
Inject a scoped grant store, a current subject lookup, and an optional clock. Use an absolute Unix timestamp for grant expiry.
Error Handling
Invalid consent raises PermissionError or ValueError. An unavailable grant or failed tool check returns no principal. Infrastructure failures from injected operations propagate to the host.
Best Practices
Build the binding from verified OAuth metadata and the expected resource. Use live subject snapshots for each check. Require scoped, atomic revocation and authorization-code redemption at the storage boundary.
Package Boundary
What It Owns
Grant and subject binding comparison, current scope intersection, tool-scope enforcement, and orchestration of an owned revoke operation.
Public API and Import Surfaces
tba_capability_mcp_authorization exports MCPAuthorizationCapability, MCPGrantBinding, MCPGrant, MCPSubject, MCPPrincipal, and adapter types. Use resolve_mcp_grant if the host already loads the current grant within its own token transaction.
Entry Points
This package declares no command-line, GUI, or plugin entry points in its manifest.
Injected Dependencies
MCPGrantStore loads a bound grant and revokes it with owner and binding checks inside the write. The subject lookup returns the currently active account or the owner's bot.
Protocol Consumers
Use with a server-side MCP OAuth integration. Refresh adapters can use live scope resolution before calling the token rotation operation.
Extensions
Use tba-concrete-mcp-delegation for the browser consent permission matrix. Product adapters supply tool-specific resource checks and response projection.
Operations and Readiness
Operational Requirements
OAuth and storage adapters enforce token validity, transactional issuance, current grant state and any product-specific mutation invariants.
Health and Observability
The host owns adapter health, token lifecycles, audit events, and transport error responses.
Security and Resource Limits
Only trusted callers construct the grant binding. Keep the mutation and its resource check consistent with the host transaction. Validate OAuth before delegating to this package.
Compatibility
Scope and identifier strings are opaque to this package. Resource bindings are matched exactly. Adapters retain the product's existing credential and HTTP formats.
Verification
Tests
The package tests exercise journal and forum scope fixtures, live status changes, grant expiry and scoped revocation. The README examples are runnable.
Certification Status
Consumer integration and certification are pending.
Evidence
Unit tests verify the capability's decision boundary. Application tests cover routing, token storage and grant transaction guarantees.
FAQ
Why
Applications share the owner/bot scope intersection and enforce their own article, forum, or other resource rules.
How
Pass the verified OAuth grant binding and scopes into the capability and supply the product's resource check before invoking a tool.
When
Resolve current authorization at refresh, discovery, and tool invocation.
Documentation and Related Packages
More Documentation
The example files demonstrate grant binding and a tool authorization adapter.
Related Packages
tba-concrete-mcp-delegation, tba-durability-delegation, and tba-capability-token-issuance.
Project Links
Contributing
How to Contribute
Add fixtures for shared authorization semantics and verify the relevant application adapters.
Development Setup
Use the repository's uv environment and package test suite.
Notes for Maintainers
Keep the package free of product-specific roles and resource identifiers.
Governance
Ownership and Decision Making
Tigrbl Auth owns the shared decision boundary. Consumer maintainers own storage adapters and resource policy.
Standards and Policies
Use the existing OAuth and delegation contracts when composing an integration.
Lifecycle and Migration
Adopt behind the current application routes and storage contracts first.
License and Attribution
License
Licensed under Apache-2.0. See LICENSE.
Notices
See NOTICE for attribution.
Metadata
Release files for tba-capability-mcp-authorization 0.4.0.dev1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tba_capability_mcp_authorization-0.4.0.dev1.tar.gz | 11.1 kB | Without provenance | Details for tba_capability_mcp_authorization-0.4.0.dev1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tba_capability_mcp_authorization-0.4.0.dev1-py3-none-any.whl | Python 3 | none | any | Details for tba_capability_mcp_authorization-0.4.0.dev1-py3-none-any.whl |
Total release size: 23.6 kB
Security for tba-capability-mcp-authorization 0.4.0.dev1
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.