Metadata-Version: 2.4
Name: mcs-permission
Version: 0.1.0
Summary: Consent/permission decorator for the Model Context Standard.
Author-email: Danny Gerst <danny@dannygerst.de>
License-Expression: Apache-2.0
Project-URL: Homepage, https://www.modelcontextstandard.io
Project-URL: Source, https://github.com/modelcontextstandard/python-sdk
Keywords: mcs,modelcontextstandard,permission,consent,decorator
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: mcs-driver-core>=0.4.1
Dynamic: license-file

# mcs-permission

Consent / permission decorator for the **Model Context Standard (MCS)**.

Provides `PermissionDecorator` -- a `BaseDecorator` that gates tool execution
behind a consent callback. Before `execute_tool` runs, the decorator asks the
client whether the pending tool call (name + arguments) is allowed; on denial it
returns a structured `permission_denied` result instead of executing.

## Installation

```bash
pip install mcs-permission
```

## Usage

```python
from mcs.permission.decorator import PermissionDecorator

def ask_user(tool_name, arguments) -> bool:
    return input(f"Run {tool_name}? [y/N] ").strip().lower() == "y"

guarded = PermissionDecorator(MyToolDriver(...), consent=ask_user)
orchestrator.add_driver(guarded, label="mail")
```

It wraps the **ToolDriver** layer, so the surrounding orchestrator keeps its
`process_llm_response` loop and calls `execute_tool` -- the decorator -- beneath
it. Decorators stack: `PermissionDecorator(AuthDecorator(RealToolDriver))`
checks consent first and handles auth challenges deeper down.

Advertises the `"consent"` capability and is reachable via
`DriverMeta.resolve_capability(driver, SupportsConsent)`.

## License

Apache-2.0
