Skip to main content

Trust-gated MCP tool calls for LangChain via Dominion Observatory

Project description

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

Project details


Download files

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

Source Distribution

langchain_mcp_trust_gate-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

langchain_mcp_trust_gate-0.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file langchain_mcp_trust_gate-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_mcp_trust_gate-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for langchain_mcp_trust_gate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f6a5caf6259afb4634b8f2b20fb5c7b69da11e278b71218af1edb8454fe41b31
MD5 0cb231596e849520b992e7c21fa39acc
BLAKE2b-256 c06f3b6e4fdf74b6684b8acb129ef52fee9a50a064e09e505ef9d7987e5395a9

See more details on using hashes here.

File details

Details for the file langchain_mcp_trust_gate-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_mcp_trust_gate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19c227a4ddb247689272871acb78f59e3162c85e73c2c55d13a17e2cd32dbcfa
MD5 cc061df88653d5db7c8836294b53701a
BLAKE2b-256 7fdbf8dddebbc81c8cd68c96476435b99b89020d2bcb927dfb77364edd493886

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page