CompText MCP Server

CompText MCP Server

Provides an interface to the CompText DSL Codex stored in Notion, enabling users to search, retrieve, and manage programming and documentation modules. It supports native MCP for Claude Desktop and includes a FastAPI wrapper for universal REST access.

Category
Visit Server

README

🚀 CompText MCP Server

Ein hochperformanter MCP (Model Context Protocol) Server für CompText DSL mit REST API Wrapper - deployed auf Render.com.

📋 Features

  • CompText DSL Support - Vollständiger Zugriff auf den CompText Codex
  • MCP Protocol - Native MCP-Server-Implementierung für Claude Desktop
  • REST API - FastAPI HTTP Wrapper für universellen Zugriff
  • Caching & Performance - LRU-Cache mit automatischem Retry-Mechanismus
  • Type Safety - Vollständige Type Hints und Validierung
  • Error Handling - Exponential Backoff und umfassende Fehlerbehandlung
  • Security - Input-Validierung und Sanitization
  • Production Ready - Docker, Health Checks, Monitoring

🏗️ Architektur

comptext-mcp-server/
├── src/comptext_mcp/         # Hauptpaket
│   ├── server.py              # MCP Server Implementierung
│   ├── notion_client.py       # Notion API Client mit Retry-Logik
│   ├── constants.py           # Zentrale Konstanten
│   └── utils.py               # Validierungs- und Hilfsfunktionen
├── rest_api_wrapper.py        # REST API Wrapper
├── mcp_server.py              # Einfacher Server für Render.com
└── tests/                     # Test Suite

🔧 Installation & Verwendung

Voraussetzungen

  • Python 3.10+
  • Notion API Token
  • CompText Database ID

Lokale Entwicklung

# 1. Repository klonen
git clone https://github.com/ProfRandom92/comptext-mcp-server.git
cd comptext-mcp-server

# 2. Abhängigkeiten installieren
pip install -r requirements.txt

# 3. Umgebungsvariablen setzen
cp .env.example .env
# Bearbeite .env und füge deine Notion Credentials ein

# 4. MCP Server starten
python -m comptext_mcp.server

# Oder REST API starten
python rest_api_wrapper.py

MCP Server (für Claude Desktop)

# Server im stdio-Modus starten
python -m comptext_mcp.server

Konfiguration in Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "comptext": {
      "command": "python",
      "args": ["-m", "comptext_mcp.server"],
      "env": {
        "NOTION_API_TOKEN": "your_token_here",
        "COMPTEXT_DATABASE_ID": "your_db_id"
      }
    }
  }
}

REST API Server

# Mit uvicorn
uvicorn rest_api_wrapper:app --reload

# Oder direkt
python rest_api_wrapper.py

Server läuft auf http://localhost:8000

📊 API Endpoints

REST API

Endpoint Methode Beschreibung
/ GET API Info
/health GET Health Check mit Notion-Status
/api/modules GET Alle Module mit Statistiken
/api/modules/{module} GET Spezifisches Modul (A-M)
/api/search?query=... GET Suche im Codex
/api/command/{page_id} GET Vollständiger Seiteninhalt
/api/tags/{tag} GET Filter nach Tag
/api/types/{type} GET Filter nach Typ
/api/statistics GET Codex Statistiken
/api/cache/clear POST Cache leeren
/docs GET Interaktive API Dokumentation

MCP Tools

Der MCP Server bietet folgende Tools:

  • list_modules - Liste aller Module (A-M)
  • get_module - Lade spezifisches Modul
  • get_command - Lade Seiteninhalt
  • search - Durchsuche Codex
  • get_by_tag - Filter nach Tag
  • get_by_type - Filter nach Typ
  • get_statistics - Codex Statistiken

🐳 Docker Deployment

# REST API Image bauen
docker build -f Dockerfile.rest -t comptext-api .

# Container starten
docker run -p 8000:8000 --env-file .env comptext-api

# Mit Docker Compose
docker-compose up -d

🚀 Deployment auf Render.com

Automatisches Deployment

  1. Push zu GitHub
  2. Gehe zu render.com/deploy
  3. Verbinde Repository
  4. Render erkennt automatisch render.yaml
  5. Setze Environment Variables:
    • NOTION_API_TOKEN
    • COMPTEXT_DATABASE_ID (optional)
  6. Click "Apply" → Fertig! ✅

Nach dem Deployment

Du erhältst eine URL wie: https://comptext-mcp.onrender.com

API Docs: https://comptext-mcp.onrender.com/docs

🔑 Umgebungsvariablen

# Erforderlich
NOTION_API_TOKEN=your_notion_token_here

# Optional
COMPTEXT_DATABASE_ID=0e038c9b52c5466694dbac288280dd93  # Standard-DB
LOG_LEVEL=INFO
HOST=0.0.0.0
PORT=8000

📖 Verwendungsbeispiele

Python Client

from comptext_mcp import get_all_modules, search_codex, get_module_by_name

# Alle Module laden
modules = get_all_modules()
print(f"Gefunden: {len(modules)} Einträge")

# Suche durchführen
results = search_codex("docker", max_results=5)
for result in results:
    print(f"- {result['titel']}")

# Spezifisches Modul laden
modul_b = get_module_by_name("Modul B: Programmierung")

REST API

# Alle Module
curl http://localhost:8000/api/modules

# Suche
curl "http://localhost:8000/api/search?query=docker&max_results=5"

# Modul B laden
curl http://localhost:8000/api/modules/B

# Statistiken
curl http://localhost:8000/api/statistics

JavaScript/TypeScript

// Suche durchführen
const response = await fetch(
  'https://comptext-mcp.onrender.com/api/search?query=docker'
);
const data = await response.json();
console.log(`Gefunden: ${data.count} Ergebnisse`);

🧪 Testing

# Tests ausführen
make test

# Mit Coverage
make test-cov

# Linting
make lint

# Code formatieren
make format

⚡ Performance-Hinweise

  • Caching: get_all_modules() ist gecached (LRU, 128 Einträge)
  • Retry-Logik: Automatische Wiederholung bei API-Fehlern (3x, exponential backoff)
  • Free Tier Sleep: Render.com schläft nach 15 Min Inaktivität
    • Erste Anfrage nach Pause: ~30 Sek (Cold Start)
    • Lösung: Verwende Render's Cron Jobs für Keep-Alive Pings

🛡️ Security Features

  • ✅ Input-Validierung für alle User-Eingaben
  • ✅ Page ID Format-Validierung
  • ✅ Query String Sanitization
  • ✅ Text Output Sanitization
  • ✅ CORS-Konfiguration
  • ✅ Error Message Sanitization

🔧 Entwicklung

# Dev-Dependencies installieren
make install-dev

# Pre-commit hooks einrichten
pre-commit install

# Code formatieren
black src/ tests/
isort src/ tests/

# Type checking
mypy src/

📚 Module Übersicht

Modul Beschreibung
A Allgemeine Befehle
B Programmierung
C Visualisierung
D KI-Steuerung
E Datenanalyse & ML
F Dokumentation
G Testing & QA
H Database & Data Modeling
I Security & Compliance
J DevOps & Deployment
K Frontend & UI
L Data Pipelines & ETL
M MCP Integration

🤝 Contributing

Siehe CONTRIBUTING.md für Richtlinien.

📄 Lizenz

MIT License - siehe LICENSE für Details.

🔗 Links

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured