Python SDK for the MCP Trail management API (/api/v1).
Project description
mcptrail (Python SDK)
Python SDK for the MCP Trail management API (/api/v1) —
govern guardian servers and policies as code. Runtime-dependency-free (stdlib only).
Install
pip install mcptrail
Usage
from mcptrail import McpTrailClient, McpProxyClient
# Token resolution: explicit token=... -> MCPTRAIL_TOKEN env.
# base_url defaults to the cloud; set it when self-hosting.
client = McpTrailClient(token="mg_mgmt_...")
# Provision a server (bearer token is returned ONCE)
created = client.servers.create(
display_name="GitHub",
slug="github",
upstream_mcp_url="https://api.githubcopilot.com/mcp",
)
# Policy as code
client.servers.set_tool_policy("github", "delete_repository", "hitl")
client.servers.set_dlp_mode("github", "block")
# Read audit, resolve approvals
page = client.audit.list(scope="github", limit=100)
for pending in client.hitl.list():
client.hitl.resolve(pending.id, "approve")
Calling a guarded tool (data plane)
proxy = McpProxyClient(slug="github", token="mg_live_...") # per-server token
result = proxy.call_tool("get_issue", {"number": 42})
Tokens
- Servers / CI: mint a scoped management API key in the dashboard
(
/dashboard/api-keys); pass astoken=orMCPTRAIL_TOKEN. Data-plane calls use the per-server token (MCPTRAIL_PROXY_TOKEN). - Errors raise
McpTrailApiError(status/code) or, for the proxy,McpProxyError(JSON-RPC code).
Mirrors @mcptrail/sdk and is generated against
openapi/mcptrail.yaml.
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
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 mcptrail-0.1.0.tar.gz.
File metadata
- Download URL: mcptrail-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73bc53b6526906455b1241368a0fbd72542f806be4651ea1a33c9e8b6e515ac1
|
|
| MD5 |
5775799a3084f92ace4fe39526c588c2
|
|
| BLAKE2b-256 |
b96ae1a1ad0179bdf606080eb3f2958aad3dd7a131e48f48c2638170974a0017
|
Provenance
The following attestation bundles were made for mcptrail-0.1.0.tar.gz:
Publisher:
sdk-publish.yml on Blabigo/mcp-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcptrail-0.1.0.tar.gz -
Subject digest:
73bc53b6526906455b1241368a0fbd72542f806be4651ea1a33c9e8b6e515ac1 - Sigstore transparency entry: 1859605820
- Sigstore integration time:
-
Permalink:
Blabigo/mcp-guard@6c722bae82b7641e382fcf2807b9d064579ff455 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Blabigo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@6c722bae82b7641e382fcf2807b9d064579ff455 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcptrail-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcptrail-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8004e0576acf5e47f3679e85623302e657f1f4240230b39a597b07288be69a
|
|
| MD5 |
3a4ab1b39f11f9ca0076cedceaf8f948
|
|
| BLAKE2b-256 |
6c6a98136cc1c525794666d2475522d3cedd4286096af64528265c4cca457ca6
|
Provenance
The following attestation bundles were made for mcptrail-0.1.0-py3-none-any.whl:
Publisher:
sdk-publish.yml on Blabigo/mcp-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcptrail-0.1.0-py3-none-any.whl -
Subject digest:
3f8004e0576acf5e47f3679e85623302e657f1f4240230b39a597b07288be69a - Sigstore transparency entry: 1859605828
- Sigstore integration time:
-
Permalink:
Blabigo/mcp-guard@6c722bae82b7641e382fcf2807b9d064579ff455 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Blabigo
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
sdk-publish.yml@6c722bae82b7641e382fcf2807b9d064579ff455 -
Trigger Event:
push
-
Statement type: