Skip to main content

langchain-mcp-trust-gate

PyPI License: MIT

Trust-gated MCP tool calls for LangChain. Automatically checks behavioral trust scores via Dominion Observatory before every MCP tool call.

Install

pip install langchain-mcp-trust-gate

Quick Start

from langchain_mcp_trust_gate import TrustGateInterceptor
from langchain_mcp_adapters.client import MultiServerMCPClient

trust_gate = TrustGateInterceptor(min_score=70)

async with MultiServerMCPClient(
    connections={"my-server": {"url": "https://example.com/mcp", "transport": "streamable_http"}},
    interceptors=[trust_gate],
) as client:
    tools = await client.get_tools()
    # All tool calls now trust-gated automatically

How It Works

  1. Before each MCP tool call, queries Dominion Observatory for the server trust score
  2. Blocks calls to servers below the threshold (default: 60)
  3. After each call, reports the outcome back to the Observatory
  4. Scores are cached (5-minute TTL) to minimize latency

Configuration

TrustGateInterceptor(
    min_score=70,           # Minimum trust score (0-100)
    cache_ttl=300.0,        # Cache TTL in seconds
    block_on_error=False,   # Fail-open if Observatory unreachable
    report_outcomes=True,   # Report call outcomes back
)

Architecture

Implements the ToolCallInterceptor protocol from langchain-mcp-adapters. Composes with other interceptors in an onion pattern.

License

MIT

Metadata

Release files for langchain-mcp-trust-gate 0.3.0

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

Source distribution (sdist)

Source distribution for langchain-mcp-trust-gate 0.3.0
File Size Uploaded Provenance Actions
langchain_mcp_trust_gate-0.3.0.tar.gz 5.5 kB Without provenance Details for langchain_mcp_trust_gate-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-mcp-trust-gate 0.3.0
File Interpreter ABI Platform Actions
langchain_mcp_trust_gate-0.3.0-py3-none-any.whl Python 3 none any Details for langchain_mcp_trust_gate-0.3.0-py3-none-any.whl

Total release size: 12.2 kB

Release files / langchain_mcp_trust_gate-0.3.0.tar.gz

Download URL langchain_mcp_trust_gate-0.3.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5727d858c85eb345bb3680dafaa9064093b34371e0e2e856f2dc73b3d8345e2a
BLAKE2b-256 checksum
How to use checksums
d0b68eb434e2a332620b03875c5189840cf6e930400d9b3e6ced4323e1ad7b3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / langchain_mcp_trust_gate-0.3.0-py3-none-any.whl

Download URL langchain_mcp_trust_gate-0.3.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba3e7263965733cb570740f244aa7957671d9633861498596d4b952128071b6d
BLAKE2b-256 checksum
How to use checksums
9b428f529d3f47bbbab2ebc8f1ad934773cafd9abe016d85be02d0033fca4c5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Security for langchain-mcp-trust-gate 0.3.0

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