Lunex Remote MCP
README.md
# Lunex Remote MCP
Self-hosted, open-source MCP gateway for diagnostics today and Windows/Linux management in future releases. No Termalin dependency in deployed code.
**Status (2026-11-29):** M0 and M1 accepted. M2 OAuth server and the fixed domain namespace implemented and tested over HTTPS; **actual ChatGPT account connection still awaiting manual verification**. Windows agent, terminal, mouse/keyboard, SFTP and APK transfer are not implemented. All tools remain **read-only**.
## Permanent public URLs
- **Owner consent and landing page:** `https://rikagro.ru/mcplunex/`
- **MCP server:** `https://rikagro.ru/mcplunex/mcp`
- **OAuth issuer:** `https://rikagro.ru/mcplunex`
- **OAuth discovery:** `https://rikagro.ru/.well-known/oauth-authorization-server/mcplunex`
- **Protected resource metadata:** `https://rikagro.ru/.well-known/oauth-protected-resource/mcplunex/mcp`
The domain is an operator setting, **not an IP address compiled into the software**. If the VPS changes, update the DNS A/AAAA record for `rikagro.ru`, provision HTTPS on the new VPS, and transfer the private OAuth database and credential files. The URLs above remain unchanged.
## One-command deployment on a clean VPS
Ubuntu is tested. Debian support is planned but has not yet been independently verified. Provide DNS pointing to the VPS, free TCP 80/443 (and UDP 443 for HTTP/3), and an email for certificate issuance:
```bash
curl -fsSL https://raw.githubusercontent.com/maillunex-lang/LunexRemoteMCP/main/scripts/install.sh | sudo bash -s -- --domain rikagro.ru --email you@example.com --auth oauth
```
Replace the email. Caddy handles HTTPS and routes `/mcplunex/`. Docker runs the MCP service as UID 10001, with a read-only filesystem and a loopback-only host port. No host SSH keys, Docker socket or Windows desktop are exposed.
**After the install**, set the owner's consent password in your interactive SSH terminal (not in ChatGPT and not as a CLI argument):
```bash
sudo python3 /opt/lunex-remote/scripts/set-owner-password.py
```
Enter a unique 14–128 character password twice. The server stores only a salted scrypt hash in a private file and recreates the container to activate it. Until this action, OAuth owner approval remains disabled. **Never send the password to ChatGPT.**
Review a shell script before running `curl | sudo bash`; it executes downloaded code with administrator privileges. For higher assurance, review and pin a release commit before deployment.
## Already running other sites on Nginx?
**Do not install Caddy on occupied ports 80/443.** Use local-only mode:
```bash
curl -fsSL https://raw.githubusercontent.com/maillunex-lang/LunexRemoteMCP/main/scripts/install.sh | sudo bash -s -- --auth oauth
```
This binds to `127.0.0.1:18799` and intentionally does not expose a public route. Configure `.env` with the public issuer and resource URLs shown above, and `LUNEX_REMOTE_ALLOWED_HOSTS=rikagro.ru,localhost:*,127.0.0.1:*`. Then recreate the MCP container and mount a reviewed version of `deploy/nginx-mcplunex.conf` inside the existing site's HTTPS server block, replacing `__MCP_LOCAL_PORT__` with the actual local port. Run `nginx -t` before reloading. Set your owner password afterwards.
The current VPS uses a separate isolated instance and its existing Nginx. Legacy `/remote/mcp` and game routes were kept unchanged.
## Confirm installation
```bash
cd /opt/lunex-remote
docker compose ps
bash scripts/smoke-test.sh
```
Expected: service healthy, public health endpoint on loopback HTTP 200, unauthenticated MCP HTTP 401, and valid OAuth metadata. Full integration tests are in `scripts/oauth-smoke.py`, with synthetic credentials only.
## Security model
- Owner approval requires a personal password on `/mcplunex/` during an OAuth flow; approval is **never automatic**.
- Supports OAuth authorization code + PKCE S256, dynamic client registration with a strict redirect allowlist, refresh token rotation, revocation and scopes.
- OAuth state is in a persistent SQLite database under `data/state/`; code and access token values are stored as SHA-256 digests, not plaintext.
- Five failed password checks per consent ticket; authorization codes expire after five minutes. Credentials are excluded from Git and Docker build context.
- Full desktop and command access will require additional device permissions, explicit approvals and audit logging in later stages.
## Roadmap Intelligence Engine (M17, offline)
The repository includes a deterministic, project-local hierarchical roadmap generator. It links master roadmap -> stages -> tasks -> references, provides a minimal AI context router, validates dependencies and links, and never invokes an external LLM.
```bash
python3 scripts/roadmap.py --root . plan # dry-run, no changes
python3 scripts/roadmap.py --root . organize --apply # explicit managed writes
python3 scripts/roadmap.py --root . validate # drift and broken links
python3 scripts/roadmap.py --root . context --task M17.3 --paths-only
python3 scripts/roadmap.py --root . context --task M17.3 --budget 6000
```
The public read-only MCP tools `roadmap_overview`, `roadmap_organize_preview` and `roadmap_task_context` expose the packaged project index. **They never write to the VPS or a Windows host.** Actual remote write access will be implemented only with scoped, authenticated agents and approval/audit protections in M3/M4.
The generator supports existing docs/ROADMAP.md or root ROADMAP.md, stages M17, WP-25, AL-02 and related task IDs. A user-editable docs/roadmap/catalog.json owns task dependencies and source references; an optional tasks.json can be imported for projects without a catalog. Unmanaged files are never overwritten. More: [docs/ROADMAP_ENGINE.md](docs/ROADMAP_ENGINE.md) and [docs/roadmap/INDEX.md](docs/roadmap/INDEX.md).
## Updating
```bash
sudo bash /opt/lunex-remote/scripts/update.sh
```
This fast-forwards the repository, rebuilds the container and runs smoke tests; local `.env`, the password hash, bearer token and OAuth state remain outside Git. There is **no automatic backup/restore yet**: follow the manual migration guidance in [docs/DOMAIN_AND_OAUTH.md](docs/DOMAIN_AND_OAUTH.md).
## Repository contents
- `server.py`, `oauth_provider.py`, `owner_auth.py`: full Python MCP and OAuth sources.
- `compose.yaml`, `Dockerfile`, `deploy/Caddyfile`: isolated deployment with optional HTTPS.
- `deploy/nginx-mcplunex.conf`: coexistence with a running Nginx instance.
- `scripts/`: installer, updater, password setup and integration tests.
- `tests/` and `.github/workflows/ci.yml`: repeatable unit and HTTP tests.
- `docs/ROADMAP.md` and `docs/PROJECT_STATUS.md`: progress updated after each accepted milestone.
- `docs/TERMALIN_PARITY.md`: all 36 confirmed Termalin hosted MCP methods, grouped by priority and target milestone.
- `docs/FEATURE_BACKLOG.md`: 232 supplementary requirements from the owner catalog, plus official desktop/local-MCP additions.
## License
MIT. This project is independent from Termalin. ChatGPT account access is governed by OpenAI's own plan and plugin settings.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues