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.
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 Modulget_command- Lade Seiteninhaltsearch- Durchsuche Codexget_by_tag- Filter nach Tagget_by_type- Filter nach Typget_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
- Push zu GitHub
- Gehe zu render.com/deploy
- Verbinde Repository
- Render erkennt automatisch
render.yaml - Setze Environment Variables:
NOTION_API_TOKENCOMPTEXT_DATABASE_ID(optional)
- 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。