MCP RifaExpress Backend
# MCP RifaExpress Backend
MCP Server para interactuar con el backend de RifaExpress (PostgreSQL + API REST).
## Variables de Entorno
Crea un archivo `.env` en la raíz del proyecto:
```env
# PostgreSQL Connection
DB_HOST=localhost
DB_PORT=5432
DB_NAME=rifaexpress
DB_USER=postgres
DB_PASSWORD=tu_password
# API REST (opcional)
API_URL=http://localhost:3000/api
API_TOKEN=tu_jwt_token
```
## Instalación
```bash
npm install
npm run build
```
## Uso
```bash
npm start
```
## Tools Disponibles
### Base de Datos
- `rifaexpress_query_db` - Ejecutar queries SELECT en PostgreSQL
- `rifaexpress_inspect_table` - Ver schema de una tabla
- `rifaexpress_list_tables` - Listar todas las tablas
### Entidades
- `rifaexpress_get_companies` - Obtener companies con filtros
- `rifaexpress_get_users` - Obtener users con filtros
- `rifaexpress_get_plans` - Obtener plans
- `rifaexpress_get_subscriptions` - Obtener subscriptions (cuando exista la tabla)
### Utilidades
- `rifaexpress_health_check` - Verificar conexión a BD y API
TDQS
Scored across 8 tools
Each tool has a clearly distinct purpose with no overlap: get_companies, get_plans, get_subscriptions, get_users retrieve specific entities, health_check tests connectivity, inspect_table examines schema, list_tables enumerates tables, and query_db executes custom queries. The descriptions reinforce these distinct roles, making misselection unlikely.
All tools follow a consistent 'rifaexpress_verb_noun' pattern using snake_case, with verbs like 'get', 'health_check', 'inspect', 'list', and 'query'. This predictability aids agent understanding and tool selection without confusion from mixed conventions.
With 8 tools, this server is well-scoped for a backend database interaction server. It covers essential operations like data retrieval, schema inspection, and health checks without being overly sparse or bloated, making each tool earn its place in the set.
The toolset provides strong read-only coverage for database interaction, including entity retrieval, schema exploration, and connectivity checks. However, it lacks write operations (e.g., create, update, delete), which could be a gap for full CRUD workflows, though this might be intentional for security as noted in query_db's description.