🚀 CompText MCP Server
Token-efficient DSL server for MCP, REST, and mobile agents
CompText compiles verbose instructions into a compact DSL to cut LLM token usage by up to 90–95%. This repository ships a production-ready MCP server, REST gateway, and a mobile automation agent.
Table of Contents
- Overview
- Features
- Architecture
- Prerequisites
- Quick Start
- Configuration
- Usage
- Testing & Linting
- Documentation
- Contributing
- Security
- License
Overview
CompText MCP Server exposes the CompText DSL through:
- MCP for native tool access (Claude Desktop, Cursor, etc.)
- REST for HTTP clients (Perplexity, ChatGPT API-style callers)
- Mobile agent for Android automation with minimal tokens
All services share the same validation, caching, metrics, and security hardening described in OPTIMIZATION_SUMMARY.md.
Features
- Token-efficient DSL with caching and input validation
- Dual interfaces: MCP server and REST wrapper
- Mobile agent with Ollama/Cloud modes and Prometheus metrics
- Rate limiting, sanitization, and structured logging
- Docker support plus Railway/render configs
Architecture
Client (MCP / REST / Mobile) -> CompText Server -> Notion codex (content store)
|-> Validation & rate limiting
|-> Metrics & logging
|-> Caching layer
Prerequisites
- Python 3.10+
- Notion API token with access to the CompText database
- Recommended: virtualenv
Quick Start
git clone https://github.com/ProfRandom92/comptext-mcp-server.git
cd comptext-mcp-server
python -m venv .venv
source .venv/bin/activate # Windows: .venv\\Scripts\\activate
pip install -e .[rest,mobile]
cp .env.example .env
# Fill in NOTION_API_TOKEN and COMPTEXT_DATABASE_ID
# Start MCP server
python -m comptext_mcp.server
# (Optional) Start REST API
python rest_api_wrapper.py
Configuration
All configuration uses environment variables (see .env.example):
NOTION_API_TOKEN– Notion API tokenCOMPTEXT_DATABASE_ID– Notion database IDHOST/PORT– REST server host/portLOG_LEVEL– Logging level
Usage
MCP Server
Add to your MCP client (example for Claude Desktop):
{
"mcpServers": {
"comptext-codex": {
"command": "python3",
"args": ["-m", "comptext_mcp.server"],
"cwd": "/path/to/comptext-mcp-server",
"env": {
"PYTHONPATH": "/path/to/comptext-mcp-server/src",
"NOTION_API_TOKEN": "your_token",
"COMPTEXT_DATABASE_ID": "0e038c9b52c5466694dbac288280dd93"
}
}
}
}
REST API
python rest_api_wrapper.py
curl http://localhost:8000/health
See docs/API.md for endpoints, rate limits, and examples.
Mobile Agent CLI
comptext-mobile run "Open Chrome and search for weather" --steps 10
comptext-mobile status
comptext-mobile screenshot --output screen.png
Configure via environment or a config file; details in docs/mobile-agent.md.
Testing & Linting
pip install -e .[dev]
pytest
black . && flake8 && mypy
Documentation
Contributing
We welcome issues and PRs. Please see CONTRIBUTING.md and follow the CODE_OF_CONDUCT.md.
Security
Report vulnerabilities via SECURITY.md. The project uses input validation, rate limiting, and CodeQL scanning (see CI).
License
MIT © ProfRandom92
