Mastyf AI — perimeter security proxy for MCP-based AI agents. Intercept, audit, and block dangerous tool calls.
Project description
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.
Project details
Release history Release notifications | RSS feed
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.2.1.tar.gz
(5.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mastyf_ai-4.2.1.tar.gz.
File metadata
- Download URL: mastyf_ai-4.2.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d806b45517a3c9696365a99a345d60c765757f281ea522b9a04f71278bf1a1d5
|
|
| MD5 |
cb91e8b5ca2aebcf4f7140b3dde099a5
|
|
| BLAKE2b-256 |
2fedddde5d6220195158234ac5993dfb4558c390aa7a6347ce325dc5be99b205
|
File details
Details for the file mastyf_ai-4.2.1-py3-none-any.whl.
File metadata
- Download URL: mastyf_ai-4.2.1-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.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05fd935863b3281534bdf252db89b1829a3654e5d05cea97e96cf738c54fe1cb
|
|
| MD5 |
c5b4c168686ca387d8a445e01d8412f4
|
|
| BLAKE2b-256 |
8ffd3c88fb6cc93b664725676a9f7816945674ec295a733254985213e1bc4cfd
|