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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mastyf_ai-4.3.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mastyf_ai-4.3.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file mastyf_ai-4.3.0.tar.gz.

File metadata

  • Download URL: mastyf_ai-4.3.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for mastyf_ai-4.3.0.tar.gz
Algorithm Hash digest
SHA256 795f260e51f6aa8e94eb70ba64749f2643f3477bbd4fdb2565bd33c5eee94fb6
MD5 053148ae0b33d10bd3bc6a8eb7c7daae
BLAKE2b-256 e2f0a93c0a2b75a27b167691ba2edbaf9a015d49f4c18a974ebd282aaaab8063

See more details on using hashes here.

File details

Details for the file mastyf_ai-4.3.0-py3-none-any.whl.

File metadata

  • Download URL: mastyf_ai-4.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for mastyf_ai-4.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7477e370ac2fcb4bb00454f722822b1fb209edbeef991f3ba762a204e0af073e
MD5 c9c0232d05ae99fc2d197e9a38db6827
BLAKE2b-256 f692c310ae0ffbaf3759bb1eefcf2a9fac3295b3ed453fed5b42d7b25abed15e

See more details on using hashes here.

Release history Release notifications | RSS feed

4.3.1

2 files

This release

4.3.0 This release

2 files

4.2.1

2 files

4.2.0

2 files

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