Metadata-Version: 2.4
Name: mastyf-ai
Version: 4.2.0
Summary: Mastyf AI — perimeter security proxy for MCP-based AI agents. Intercept, audit, and block dangerous tool calls.
Project-URL: Homepage, https://mastyf.ai
Project-URL: Repository, https://github.com/mastyf-ai/mastyf.ai
Project-URL: Documentation, https://docs.mastyf.ai
Author-email: Mastyf AI <dev@mastyf.ai>
License: AGPL-3.0
Keywords: ai,llm,mastyf,mcp,prompt-injection,proxy,security
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.3.0; extra == 'langchain'
Provides-Extra: openai-agents
Requires-Dist: openai>=1.0.0; extra == 'openai-agents'
Description-Content-Type: text/markdown

# Mastyf AI — Python SDK

Perimeter security proxy for MCP-based AI agents. Evaluates every tool call through the Mastyf policy engine before execution.

## Install

```bash
pip install mastyf-ai

# With framework integrations:
pip install mastyf-ai[openai-agents]  # OpenAI Agents SDK
pip install mastyf-ai[langchain]      # LangChain
```

## Quick Start

```python
from mastyf_ai import MastyfProxy

proxy = MastyfProxy("http://localhost:4000")

# Check health
print(proxy.health())  # {'status': 'ready'}

# Test a tool call against policy
decision = proxy.test_policy("read_file", {"path": "/etc/passwd"})
print(f"{decision.action}: {decision.reason}")
# Output: block: Path not in allowed list

# Scan a package
from mastyf_ai import TrustScanner
scanner = TrustScanner()
result = scanner.scan("@modelcontextprotocol/server-filesystem")
print(f"{result['trustGrade']} ({result['trustScore']}/100)")
```

## Framework Integration

### OpenAI Agents SDK

```python
from mastyf_ai import MastyfOpenAIGuard

guard = MastyfOpenAIGuard("http://localhost:4000")

@guard.wrap_tool
async def read_file(path: str) -> str:
    with open(path) as f:
        return f.read()
```

### LangChain

```python
from mastyf_ai import MastyfLangChainGuard

guard = MastyfLangChainGuard()
safe_tool = guard.wrap_tool(my_langchain_tool)
```

## CLI

```bash
mastyf health
mastyf test read_file --args '{"path":"/etc/passwd"}'
mastyf scan @modelcontextprotocol/server-filesystem
mastyf hooks
mastyf audit
```

## API Reference

See [docs.mastyf.ai](https://docs.mastyf.ai) for full API documentation.
