Skip to main content

Mastyf AI — Python SDK

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

Install

pip install mastyf-ai

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

Quick Start

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

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

from mastyf_ai import MastyfLangChainGuard

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

CLI

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 for full API documentation.

Metadata

Release files for mastyf-ai 4.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mastyf-ai 4.3.1
File Size Uploaded Provenance Actions
mastyf_ai-4.3.1.tar.gz 5.9 kB Without provenance Details for mastyf_ai-4.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mastyf-ai 4.3.1
File Interpreter ABI Platform Actions
mastyf_ai-4.3.1-py3-none-any.whl Python 3 none any Details for mastyf_ai-4.3.1-py3-none-any.whl

Total release size: 13.9 kB

Release files / mastyf_ai-4.3.1.tar.gz

Download URL mastyf_ai-4.3.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ca69eb6e586f0af04882b4685d982af6e85cc8efe14f045f9d3ab2f59eecf99d
BLAKE2b-256 checksum
How to use checksums
b3f7269d704247f47c275cf07dd6eaa721dbd22f0dc5c6de8291d457ec1f532b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / mastyf_ai-4.3.1-py3-none-any.whl

Download URL mastyf_ai-4.3.1-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a8f59b08e2636251b5321e886980e1e75a2625e20972418d73273cd138108ee
BLAKE2b-256 checksum
How to use checksums
88711a530b22f629f24dc2dc75a8d9489b962b690edbeda5a0d8ba2698e3209b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for mastyf-ai 4.3.1

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.

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