Skip to main content
Glama
infinall-computer-mcp

infinall-computer-mcp

by carlscodev
README.md
# infinall-computer-mcp

Servidor **MCP (HTTP / Streamable HTTP)** que le da a Infinall Chat acceso total a tu maquina:
leer/crear/editar archivos, listar directorios, buscar, ejecutar comandos, abrir URLs, ver imagenes
y sacar capturas de pantalla.

Sin tuneles: si tu VPS tiene IP publica, lo expones directo. Funciona en Linux, macOS y Windows.

## Herramientas (11)

`read_file`, `write_file`, `edit_file`, `list_dir`, `glob`, `grep`, `run_command`,
`open_url`, `read_image`, `screenshot`, `system_info`.

> Ojo: `run_command` ejecuta cualquier cosa sin restricciones. El token es la unica barrera.

## Instalacion rapida (VPS Linux)

```bash
git clone https://github.com/TU_USUARIO/infinall-computer-mcp.git
cd infinall-computer-mcp
cp .env.example .env
# edita .env y pon un token largo:
openssl rand -hex 32
# pegalo como MCP_TOKEN=... en .env
node server.mjs
```

Necesitas Node 18+. Prueba local:

```bash
curl http://127.0.0.1:8792/health
```

## Variables de entorno

| Variable | Default | Descripcion |
|---|---|---|
| `MCP_TOKEN` | autogenerado en `.env` | Bearer token obligatorio. |
| `MCP_HOST` | `0.0.0.0` | Interfaz de escucha. Usa `127.0.0.1` si vas a poner Caddy delante. |
| `MCP_PORT` | `8792` | Puerto. |

## Servicio systemd (arranque automatico)

```ini
[Unit]
Description=Infinall Computer MCP
After=network.target

[Service]
Type=simple
User=TU_USUARIO
WorkingDirectory=/opt/infinall-computer-mcp
ExecStart=/usr/bin/node /opt/infinall-computer-mcp/server.mjs
Restart=always
RestartSec=3
EnvironmentFile=/opt/infinall-computer-mcp/.env

[Install]
WantedBy=multi-user.target
```

```bash
sudo cp infinall-mcp.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now infinall-mcp
systemctl status infinall-mcp
journalctl -u infinall-mcp -f
```

## Conectarlo a Infinall Chat

En **Infinall Chat -> Add custom connector**:

**Opcion A - HTTP directo por IP publica** (si el formulario acepta http):

```
MCP server URL:  http://TU_IP_PUBLICA:8792/mcp
Access token:    el MCP_TOKEN de tu .env
```

Abrir el puerto en el firewall:

```bash
sudo ufw allow 8792/tcp
```

**Opcion B - HTTPS sin tunel** (recomendada, porque el formulario pide HTTPS):

Usa Caddy con un dominio `sslip.io` que resuelve solo a tu IP (no compras dominio):

```bash
sudo apt install caddy
sudo caddy reverse-proxy --from https://TU-IP-CON-GUIONES.sslip.io --to 127.0.0.1:8792
```

Ejemplo: si tu IP es `203.0.113.10` -> `https://203-0-113-10.sslip.io`.
Caddy saca el certificado Let's Encrypt solo. Pon `MCP_HOST=127.0.0.1` en `.env` y no abras el 8792 al mundo.

```
MCP server URL:  https://203-0-113-10.sslip.io/mcp
Access token:    el MCP_TOKEN de tu .env
```

## Windows

```powershell
git clone https://github.com/TU_USUARIO/infinall-computer-mcp.git
cd infinall-computer-mcp
copy .env.example .env   # edita MCP_TOKEN
node server.mjs
```

## Probar el endpoint a mano

```bash
curl -s http://127.0.0.1:8792/health

curl -s -X POST http://127.0.0.1:8792/mcp \
  -H "Authorization: Bearer TU_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

## Seguridad

- URL + token = ejecucion remota de comandos en la maquina. Trata el token como una llave maestra.
- Usa HTTPS (Caddy) o al menos un firewall que solo permita la IP de Infinall.
- Si se filtra, rota el token en `.env` y `sudo systemctl restart infinall-mcp`.
- Corre el servicio con un usuario sin privilegios si no necesitas root.