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.3.0.tar.gz (5.5 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.3.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for langchain_mcp_trust_gate-0.3.0.tar.gz
Algorithm Hash digest
SHA256 5727d858c85eb345bb3680dafaa9064093b34371e0e2e856f2dc73b3d8345e2a
MD5 5759c184fbe2d949c297aedeed327db5
BLAKE2b-256 d0b68eb434e2a332620b03875c5189840cf6e930400d9b3e6ced4323e1ad7b3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_mcp_trust_gate-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ba3e7263965733cb570740f244aa7957671d9633861498596d4b952128071b6d
MD5 0783bcacaf416143da093641802d8a5d
BLAKE2b-256 9b428f529d3f47bbbab2ebc8f1ad934773cafd9abe016d85be02d0033fca4c5f

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