Metadata-Version: 2.5
Name: ratchet-authz-mcp
Version: 0.1.0
Summary: MCP resource-server adapter for the Ratchet authorization broker.
Project-URL: Homepage, https://github.com/1manideep/ratchet
Project-URL: Repository, https://github.com/1manideep/ratchet
Project-URL: Issues, https://github.com/1manideep/ratchet/issues
Author: Manideep Pendyala
License-Expression: MIT
Keywords: agents,authorization,capability-tokens,llm,macaroons,mcp,oauth,security
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: ratchet-authz-core<0.2,>=0.1
Description-Content-Type: text/markdown

# ratchet-authz-mcp

MCP adapter for **[Ratchet](https://github.com/1manideep/ratchet)** — ASGI
middleware that validates an `Authorization: Bearer <token>` header against
the [Ratchet broker](https://github.com/1manideep/ratchet) before an MCP
tool handler runs, aligned with RFC 8693 (Token Exchange) and RFC 8707
(Resource Indicators). Pure stdlib, no MCP SDK dependency required.

## Install

```bash
pip install ratchet-authz-mcp
```

## Minimal usage

```python
from ratchet_core import Broker, Ed25519WorkloadIdentity, tool_name_caveat
from ratchet_mcp import RatchetASGIMiddleware

broker = Broker()
primary = Ed25519WorkloadIdentity("primary-agent")
token = broker.issue(
    human_identity="alice@example.com",
    primary_identity=primary,
    caveats=[tool_name_caveat("read_file")],
)

app = RatchetASGIMiddleware(mcp_app, broker=broker, identity_resolver=lambda scope: primary)
```

Full runnable example and architecture diagram:
https://github.com/1manideep/ratchet/blob/main/examples/mcp_example.py
