langchain-mcp-trust-gate
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
- Before each MCP tool call, queries Dominion Observatory for the server trust score
- Blocks calls to servers below the threshold (default: 60)
- After each call, reports the outcome back to the Observatory
- 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)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_mcp_trust_gate-0.3.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_mcp_trust_gate-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
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
|