server.py

Code Hygiene Score: 100

Keine Issues gefunden.

Dependencies 5

Code

#!/usr/bin/env python3
"""MCP-Contracts Server - Contract Management via Model Context Protocol"""
import sys
from pathlib import Path

# Ensure package is importable
sys.path.insert(0, str(Path(__file__).parent))

# Load environment variables BEFORE any other imports
from dotenv import load_dotenv
load_dotenv(Path(__file__).parent / ".env")

from mcp.server.fastmcp import FastMCP

from tools.contract_tools import register_contract_tools


# Initialize MCP Server
mcp = FastMCP(
    "mcp-contracts",
    instructions="""
    MCP-Contracts Server für Contract-Management.

    Verfügbare Tools:
    - contracts_list: Contracts auflisten mit Filtern
    - contracts_get: Contract nach ID oder Name abrufen
    - contracts_create: Neuen Contract erstellen
    - contracts_update: Contract aktualisieren (mit Versionierung)
    - contracts_deprecate: Contract als deprecated markieren
    - contracts_validate: Validierung gegen Scope ausführen
    - contracts_history: Änderungshistorie abrufen
    - contracts_violations: Letzte Validierungen abrufen
    - contracts_statistics: Statistiken abrufen

    Contracts sind in der ki_protokoll-Datenbank gespeichert.
    Alle Operationen werden in mcp_log protokolliert.
    """,
)

# Register all contract tools
register_contract_tools(mcp)


if __name__ == "__main__":
    mcp.run(transport="stdio")
← Übersicht