mcpyse
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcpyse
Turn any mixin-based Python API client into a governed set of AI tools. mcpyse adds
access tiers, approval gating, redaction and audit for AI tool access, then serves the
tools over MCP (Model Context Protocol) or exports them as
plain LLM tool definitions.
It is built for the small house-style MSP platform clients (one <Product>Client composed of
*Mixin classes, one per API domain, with Google-style docstrings), but works with any object
whose public methods live on *Mixin bases, or with methods you mark with @tool.
Features
Tool registration from existing clients. Public methods on
*Mixinclasses are discovered automatically. JSON schemas come from type hints and Google-styleArgs:docstrings. Override anything with@tool(...)or a config dict.Three tiers:
read,write,high_risk. A toolkit is created with amax_tier; tools above it are neither listed nor callable. Tiers not set explicitly are inferred from the method name (get_/list_→ read,create_/update_→ write,delete_/revoke_/isolate_and unknown verbs → high risk, so it fails closed).Approval gating.
high_risktools never execute. Calling one returns a proposed action that is handed to an approval backend for a named human to review. Ships with in-memory and file backends; implementApprovalBackendto send proposals to a ticketing system.Redaction and size caps. Passwords, secrets, tokens and API keys are redacted from results and from logged arguments by default; add per-tool fields.
SecretStringvalues are never serialised. Results over a size cap are truncated.Audit log. Every call records tool, tier, redacted arguments, caller, outcome, result size and duration, to a JSONL file, a logger or your own callback.
Serving. MCP over stdio or streamable HTTP via the official
mcpSDK, plus Anthropic- and OpenAI-style tool definitions for agents that don't speak MCP.Metadata. Owner, data location or any other key/values per instance, published as an MCP resource and via
Toolkit.describe()for a connector inventory.
Related MCP server: ToolBridge
Installation
pip install "mcpyse[mcp] @ git+https://github.com/Ruderali/mcpyse.git"The core (registry, gating, redaction, audit, export) has no dependencies and supports Python 3.9+. The MCP server extra needs Python 3.10+.
Wrapping a client
# my_tools.py
from mcpyse import Toolkit, AuditLog, JsonlFileSink, FileApprovalBackend
from examplepy import ExampleClient # any mixin-based client
def build() -> Toolkit:
client = ExampleClient.from_env(prefix="EXAMPLE_")
return Toolkit(
client,
name="example-tools",
max_tier="write", # read | write | high_risk
prefix="example_", # tool names: example_list_organizations, ...
config={
"get_password": False, # never expose this method
"rotate_api_key": "high_risk", # explicit tier (prepare-only)
"list_passwords": {"redact": ["notes", "otp_secret"]},
"search_documents": {"max_result_chars": 20_000},
},
approvals=FileApprovalBackend("approvals/"),
approver="service-desk-lead",
audit=AuditLog(JsonlFileSink("logs/example-tools.audit.jsonl")),
metadata={"owner": "service desk", "data_location": "vendor cloud (US)"},
)
if __name__ == "__main__":
from mcpyse.server import serve_stdio
serve_stdio(build())Run it as an MCP server:
mcpyse serve my_tools:build # stdio
mcpyse serve my_tools:build --transport http --port 8000
mcpyse serve my_tools:build --max-tier read # lower the tier for this instance
mcpyse tools my_tools:build --format anthropic # print tool definitionsOr use it from a plain LLM tool loop:
from mcpyse import to_anthropic_tools, handle_tool_call
tk = build()
tools = to_anthropic_tools(tk) # pass to the model
result_json = handle_tool_call(tk, name, arguments, caller="agent-42")Marking methods in the client itself
from mcpyse import tool, exclude
class DevicesMixin:
@tool("high_risk", redact=["recovery_key"])
def isolate_device(self, device_id: str) -> dict:
"""Isolate a device from the network.
Args:
device_id: Device UID.
"""
@exclude
def raw_device_dump(self) -> dict: ...What a high-risk call returns
{
"tool": "example_delete_organization",
"outcome": "proposed",
"proposed_action": {
"id": "7f3c...", "tool": "example_delete_organization",
"arguments": {"org_id": 12}, "reason": "duplicate record",
"approver": "service-desk-lead", "status": "pending", "server": "example-tools"
},
"message": "This action is high risk and was NOT executed. ..."
}High-risk tools get an extra optional reason argument so the agent can justify the request,
and their description is prefixed [PREPARE-ONLY ...].
Configuration reference
Toolkit argument | Default | Meaning |
|
| Highest tier listed and callable |
|
| Per-method tier / options / |
| all / none | Method-name allow / deny lists |
|
| Prefix for tool names |
|
| Field redaction policy ( |
| in-memory | Where proposed actions go |
| no sinks |
|
|
| Named human recorded on proposals |
|
| Default result-size cap |
|
| Owner, data location, etc. |
Credentials belong to the wrapped client (usually its from_env(prefix=...)); mcpyse
itself reads no environment variables.
Not in this version
Multi-user auth on the HTTP transport: run it behind the host's own auth.
An approval UI, or executing approved actions automatically.
Cost metering.
Docs
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Permission checks, human approval cards, and signed audit trails for AI agent tool calls.
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
Verified, pay-per-use API tools for AI agents through one authenticated connection.
Authorize AI agent tool calls before they run: policy-as-code, human approval, signed receipts.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables controlled AI-agent access to enterprise-shaped tools with a deny-by-default gated write path, human approval, dry-run execution, and append-only audit logging.1-
- AlicenseNot gradedqualityBmaintenanceEnables autonomous AI agents to securely access and execute external tools, such as GitHub REST API operations, with per-user authentication, authorization, audit logging, and observability.MIT
- AlicenseNot gradedqualityBmaintenanceEnables governed tool-calling agents with policy decisions, optional human approval, hash-chained audit logging, and deterministic evaluation.MIT
- AlicenseNot gradedqualityCmaintenanceEnables LLM agents to access third-party APIs through a least-privilege set of audited tools with allowlists, per-caller scopes, label gates, write confirmation, limits, and PII-masked logging. It restricts reads to labeled data, prevents sending or destructive actions, and records every allowed or denied call.MIT