Trust-gated MCP tool calls for LangChain via Dominion Observatory
Project description
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
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 langchain_mcp_trust_gate-0.3.0.tar.gz.
File metadata
- Download URL: langchain_mcp_trust_gate-0.3.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5727d858c85eb345bb3680dafaa9064093b34371e0e2e856f2dc73b3d8345e2a
|
|
| MD5 |
5759c184fbe2d949c297aedeed327db5
|
|
| BLAKE2b-256 |
d0b68eb434e2a332620b03875c5189840cf6e930400d9b3e6ced4323e1ad7b3e
|
File details
Details for the file langchain_mcp_trust_gate-0.3.0-py3-none-any.whl.
File metadata
- Download URL: langchain_mcp_trust_gate-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba3e7263965733cb570740f244aa7957671d9633861498596d4b952128071b6d
|
|
| MD5 |
0783bcacaf416143da093641802d8a5d
|
|
| BLAKE2b-256 |
9b428f529d3f47bbbab2ebc8f1ad934773cafd9abe016d85be02d0033fca4c5f
|