contract-risk-analyzer
contract-risk-analyzer
Contract Risk Analyzer ist ein FastMCP-Server + LangGraph-Workflow, der PDFs von Finanzverträgen einliest, wichtige Klauseln und Verpflichtungen extrahiert, bekannte Risikobegriffe mit Schweregrad kennzeichnet, Vertragsversionen vergleicht und alles in einem strukturierten Risikobericht für Anwälte, Risikoteams und Betreiber zusammenfasst, die eine schnelle und nachvollziehbare Vertragstriage benötigen.
Die MCP-Tools akzeptieren entweder einen lokalen file_path oder eine pdf_url. Verwenden Sie für gehostete Bereitstellungen wie Railway pdf_url, damit der Server das PDF vor der Analyse in einen temporären Speicher herunterladen kann.
Architektur (auf hoher Ebene)
PDF
|
v
FastMCP_Server
|
+--> extract_clauses
+--> flag_risk_terms
+--> summarize_obligations
+--> compare_contracts
|
v
LangGraph_Agent (orchestrates tools)
|
v
RiskBrief (Pydantic structured output)Einrichtung (lokal)
cd contract-risk-analyzer
cp .env.example .env
source .venv/bin/activate # if you already created the project virtualenv
pip install -e ".[dev]"
python -m contract_risk_analyzer.serverMCP-Endpunkt:
http://localhost:8000/mcpGesundheitsprüfung:
http://localhost:8000/healthDie
.env-Datei mussOPENAI_API_KEYenthalten.
Verbindung über Claude Desktop (MCP-Client)
Option A: Als lokaler STDIO-Server ausführen (Claude Desktop startet ihn)
Fügen Sie in Claude Desktop einen MCP-Server-Eintrag hinzu, der ähnlich aussieht wie:
{
"mcpServers": {
"contract-risk-analyzer": {
"command": "python",
"args": ["-m", "contract_risk_analyzer.server"],
"env": {
"OPENAI_API_KEY": "YOUR_KEY_HERE"
}
}
}
}Option B: Verbindung zum lokalen HTTP-Server herstellen
Wenn Sie den Server selbst ausführen (python -m contract_risk_analyzer.server), verbinden Sie Claude Desktop mit dem lokalen MCP-HTTP-Endpunkt über mcp-remote:
{
"mcpServers": {
"contract-risk-analyzer": {
"command": "npx",
"args": [
"mcp-remote",
"http://127.0.0.1:8000/mcp",
"--allow-http"
]
}
}
}Option C: Verbindung zum bereitgestellten Railway-Server herstellen
Der bereitgestellte Server ist verfügbar unter:
Gesundheitsprüfung:
https://contract-risk-analyzer-production-410a.up.railway.app/healthMCP-Endpunkt:
https://contract-risk-analyzer-production-410a.up.railway.app/mcp
Claude Desktop-Konfiguration:
{
"mcpServers": {
"contract-risk-analyzer": {
"command": "npx",
"args": [
"mcp-remote",
"https://contract-risk-analyzer-production-410a.up.railway.app/mcp"
]
}
}
}Beispiel-Tool-Aufrufe
Regeln für Eingabequellen
Für Tools, die sich auf einen einzelnen Vertrag beziehen, geben Sie genau eines der folgenden an:
{
"file_path": "/app/samples/contract.pdf"
}oder:
{
"pdf_url": "https://example.com/contracts/contract.pdf"
}Für compare_contracts geben Sie für jede Seite genau eine Quelle an:
{
"pdf_url_a": "https://example.com/contracts/v1.pdf",
"pdf_url_b": "https://example.com/contracts/v2.pdf"
}Remote-PDFs werden in einen temporären Speicher heruntergeladen, auf 50 MB pro PDF begrenzt und nach jedem Tool-Aufruf gelöscht.
extract_clauses
Eingabe:
{
"pdf_url": "https://example.com/contracts/isda.pdf",
"clause_type": "termination events"
}Beispielausgabe:
[
{
"section_name": "ARTICLE_VII TERMINATION",
"clause_type": "termination events",
"raw_text": "…",
"plain_english": "…",
"page_references": [12, 13]
}
]flag_risk_terms
Eingabe:
{ "pdf_url": "https://example.com/contracts/isda.pdf" }Beispielausgabe:
[
{
"term": "cross-default",
"context": "…",
"risk_explanation": "…",
"severity": "high",
"page_reference": 9
}
]summarize_obligations
Eingabe:
{ "pdf_url": "https://example.com/contracts/isda.pdf" }Beispielausgabe:
[
{
"party": "Borrower",
"obligations": ["Deliver monthly financial statements…"],
"key_deadlines": ["Within 30 days after month-end…"],
"conditions": ["So long as no Event of Default has occurred…"]
}
]compare_contracts
Eingabe:
{
"pdf_url_a": "https://example.com/contracts/v1.pdf",
"pdf_url_b": "https://example.com/contracts/v2.pdf"
}Beispielausgabe:
{
"added_clauses": ["New collateral top-up requirement…"],
"removed_clauses": ["Removed cure period for payment default…"],
"materially_changed_clauses": [
{
"section_name": "ARTICLE_IV EVENTS_OF_DEFAULT",
"change_summary": "Acceleration now triggers immediately…",
"risk_note": "Increases lender leverage; reduces borrower flexibility."
}
],
"risk_delta": "Overall risk increased for Borrower due to tighter default/acceleration terms."
}Bereitstellung (Railway)
Build: Railway erstellt den Container aus dem
Dockerfile.Ausführung: Der Container führt
python -m contract_risk_analyzer.serveraus und bindet an$PORT(Standard8000).Gesundheitsprüfung:
GET /healthgibt{"status":"ok"}zurück.Umgebung: Setzen Sie
OPENAI_API_KEYin den Railway-Dienstvariablen.Aktuelle Bereitstellung:
https://contract-risk-analyzer-production-410a.up.railway.app.
Tech-Stack
FastMCP
OpenAI GPT-4o (via
openaiSDK)PyMuPDF (
pymupdf)Pydantic
LangGraph
Docker
Railway
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/himnishpersonal/contract-risk-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server