
Mosta Net
io.github.apolocinePublished by GitHub account apolocinev2.0.42Updated Oct 24, 2026
1 MCP server, 13 databases, zero config. Multi-protocol transport with Auth + RBAC.
Overview
Exposes a schema-driven data API over MCP, giving an assistant auto-generated CRUD tools for entities across 13 database dialects.
- What you can do
- Octonet is a Node.js multi-transport server that re-exposes a single ORM schema over eleven protocols, including MCP, REST, GraphQL, WebSocket, SSE, JSON-RPC, gRPC, tRPC, OData, NATS and Arrow Flight. Over MCP it auto-generates roughly 15 tools per entity for CRUD, count, search, aggregate, bulk and relation operations. It adds multi-tenant API-key authentication with scopes, RBAC, multi-project routing and a sanitizer that strips password, hash, token and secret fields from responses.
- When to use it
- Use it when an assistant needs to read or write structured business data held in one of the supported databases, and you want that data reachable through MCP without writing per-entity tool code. It also suits teams already running the @mostajs stack who want the same schema exposed to AI agents alongside REST and GraphQL.
- Requirements
- Runs locally as an npm package (@mostajs/net) on Node.js, started with npx mostajs-net serve. Needs a database dialect and connection URI (DB_DIALECT, SGBD_URI), plus admin bootstrap credentials (OCTONET_ADMIN_EMAIL, OCTONET_ADMIN_PASSWORD) on first boot. Clients authenticate with an API key via the X-API-Key header, Bearer token or apikey query parameter. A hosted endpoint at octonet.amia.fr/mcp is also described.
Installation
In SourceWeft
- Open Mosta Net in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
@mostajs/net — Octonet
One schema, 11 transports, 13 databases, multi-tenant auth — out of the box. Schema-driven multi-protocol API server for the @mostajs ecosystem. Built with TypeScript on Fastify, designed for polyglot consumption (14 native NetClients).
Author : Dr Hamid MADANI <[email protected]> Homepage : octonet.amia.fr · mcp.amia.fr
The socket board.
@mostajs/ormconnects to 13 databases; Octonet (@mostajs/net) re-exposes the same entities over 11 transports (REST, WebSocket, gRPC, MQTT, AMQP…); NetClient then fans out to 18 language clients — so any external app plugs into your data, in any runtime.
Table of Contents
- What is Octonet
- Try in 2 clicks (T1 sandbox)
- 3-tier onboarding model
- 11 transports
- 13 databases
- Multi-tenant authentication
- Generic scope registry
- Multi-project support
- Quick start (self-host)
- Configuration (.env)
- API endpoints reference
- Architecture
- Boot sequence
- 14 polyglot NetClients
- Production deploy (amia.fr)
- License
What is Octonet
Octonet (@mostajs/net) is a Node.js multi-transport server that exposes a single @mostajs/orm schema as 11 different network protocols simultaneously : REST, GraphQL, WebSocket, SSE, JSON-RPC, MCP, gRPC, tRPC, OData, NATS, Arrow Flight.
The same User entity is reachable as :
Backed by @mostajs/orm (13 SGBD dialects). Backed by @mostajs/rbac + @mostajs/auth + @mostajs/api-keys for multi-tenant identity. Backed by @mostajs/mproject for multi-project routing.
Octonet is the second cerebral lobe of the @mostajs trilogy :
- #1 —
@mostajs/orm: data persistence (13 databases) - #2 — Octonet : multi-protocol transport (11 wire protocols)
- #3 — NetClients polyglottes : 14 native client libraries (Java, .NET, Python, Go, Swift, Kotlin, Dart, Rust, PHP, Ruby, Elixir, Lua, Delphi, Unity)
Try in 2 clicks (T1 sandbox)
The fastest way to test Octonet from any of the 14 runtimes :
- Open https://octonet.amia.fr/try
- Pick an alias (e.g.
alice-42) - Get an apikey scoped to your sandbox
Your sandbox is :
- A private SQLite file (isolated from other aliases)
- Pre-seeded with
User,Product,Orderentities - Read+write CRUD via REST and MCP
- 500 requests/day quota
- TTL 7 days (auto-deleted if idle)
- Free, no email required, anti-abuse rate-limited (10 sandboxes/h/IP)
Use the apikey in any of the 14 NetClients :
3-tier onboarding model
11 transports
Auto-generated from your registered schemas. Toggle each via env var (default : all enabled).
Le même schéma, 11 portes d'entrée différentes, 0 codegen.
13 databases
Persistence dialects fournis par @mostajs/orm :
Switch dialect = changer 1 ligne d'env :
Multi-tenant authentication
Octonet utilise un middleware d'authentification basé sur API keys avec scopes (orienté machine-to-machine) + RBAC pour la gestion humaine. L'orchestrateur agnostique vit dans @mostajs/auth/lib/check-request.ts.
Flux d'auth d'une requête
Scope-based permissions (generic, extensible)
Une apikey a la shape :
@mostajs/api-keys ne connaît PAS les noms projects/operations/transports — c'est volontaire. Chaque module enregistre ses scopes au boot via registerScope(dialect, {name, label, …}). Le check est générique : isScopeAuthorized(perms, scope, value).
HTTP status mapping
MCP fallback (compat mcp.so)
L'endpoint /mcp autorise un fallback automatique sur l'apikey labelée public-default quand aucune clé n'est présentée — préserve la compat avec mcp.so / Claude Desktop. La clé publique est read-only sur le projet default uniquement → écritures bloquées.
Sanitizer
Les champs password, hash, verifyToken, resetToken, apiKeyHash, secret, privateKey sont automatiquement strippés de toutes les réponses JSON par un middleware global. Aucun risque de leak à travers /api/v1/User?limit=1.
Generic scope registry
Le catalogue des scopes vit en base de données du projet accueillant (pas de fichier JSON, pas de constantes hardcodées) :
Chaque module enregistre ses scopes au boot :
L'admin UI charge le catalogue dynamique via GET /api/api-keys/scopes et rend une matrice (composant React ApiKeyScopeMatrix dans @mostajs/api-keys/components/).
Multi-project support
Via @mostajs/mproject — N bases de données isolées sur le même serveur.
Routes path-prefix
Ajouter un projet à l'exécution
Persisté dans projects-tree.json (chemin : MOSTA_PROJECTS env var).
Quick start (self-host)
Install
Run with SQLite (zero infra)
Console output :
Test
Configuration (.env)
Database (mandatory)
System dialect (recommandé prod, optionnel) — v2.7.5+
Sépare la base système (apikeys, RBAC users, audit, plans, payments, project-life metadata) du dialect métier mutable. Sans ces variables, alias transparent vers le singleton métier (rétro-compat mono-base).
Voir section System dialect ci-dessous pour la motivation et les how-to.
Server
Transports (toggle each)
RBAC bootstrap (lus via @mostajs/config — supports profile cascade MOSTA_ENV=DEV)
T1 sandbox (optional)
Cloud middleware (optional, futur — partage DB méta avec Octocloud)
API endpoints reference
Public
Project / entity CRUD (requires apikey)
Schema management (requires admin apikey)
Auth & API keys (requires admin)
Transports natifs
Multi-project management
Observability
Architecture
Modules de l'écosystème consommés
System dialect (séparé du singleton métier)
Disponible depuis v2.7.5 — résout le bug « apikeys introuvables après
/api/change-dialect» observé en prod.
Pourquoi deux dialects distincts ?
Octonet expose des routes admin qui mutent la connexion DB au runtime (/api/change-dialect, /api/reload-config, /api/reconnect) — légitime côté métier (les entités userland du projet courant peuvent migrer postgres → sqlite → mongodb selon les besoins de l'admin).
Mais les modules système (apikeys, RBAC users, audit, plans de souscription, payments, project-life metadata) doivent vivre dans une base stable qui ne suit pas ces mutations. Sinon : un changement de dialect métier rend les apikeys introuvables, l'admin se trouve verrouillé hors de l'IHM.
Configuration recommandée (prod multi-base)
Configuration mono-base (dev / déploiement simple)
Laisser MOSTA_SYSTEM_* vides → alias automatique vers le singleton métier (rétro-compat 100 %, comportement identique au pré-v2.7.5).
How-to
1. Migrer un déploiement existant vers le mode multi-base
2. Vérifier que le système est bien isolé du métier
Avant v2.7.5, le 2ᵉ curl retournait 503 metadata DB unavailable ou 401 PostgreSQL not connected. Call connect() first.
3. Lire le system dialect depuis du code applicatif
4. Inspecter le bootstrap au démarrage
Au boot d'octonet-mcp, deux logs apparaissent :
Sites système dans src/server.ts (pour référence)
18 callers tirent désormais leur dialect via getSystemDialect() au lieu du singleton métier :
Le dialect métier (dialect) reste utilisé légitimement pour :
- Bootstrap initial du singleton métier (
L98) +pm.setDefault('default', dialect, …)(L126,L240) - Routes admin
/api/reconnect,/api/change-dialect,/api/reload-config,/api/test-connection,/api/truncate-tables,/api/drop-tables— toutes opérations explicitement métier EntityServicequi sert les entités userland (opérations CRUD via les transports protégés)
Étapes du chantier (historique)
Boot sequence
- Load
.envvia@mostajs/config(profile cascadeMOSTA_ENV) - Connect main dialect (
SGBD_URI) - Load schemas (priority :
getAllSchemas()registry →schemas.json→SCHEMAS_PATHdirectory scan) dialect.initSchema(schemas)with strategyupdate/create- Bootstrap RBAC (
octonet-rbac-bootstrap.ts) :- register UserSchema/RoleSchema/PermissionSchema/PermissionCategorySchema/AccountSchema/ApiKeySchema
seedRBAC(OCTONET_RBAC_SEED)— 6 categories, 25 permissions, 4 roles (admin/subscriber/trial/public)createAdmin()fromOCTONET_ADMIN_EMAIL/PASSWORD- create Account
trial-playground(type='trial') - create User
public-demo(role=public) - create Account
public-system(type='system') - generate ApiKey
public-defaultscoped todefaultproject (read-only, REST + MCP) — emitted ONCE in clear
- Register canonical scopes :
projects(dynamic,Project.slug),operations(static : read/write/admin),transports(static : 11 values) - Push default project to
projects-tree.json(ownerId=admin, visibility=public) - Load additional projects from
projects-tree.json - Wrap ormHandler with
composeMiddleware([sanitizer, apikey], ormHandler)→protectedOrmHandler - Start each enabled transport :
transport.use(loggingMiddleware)transport.use(sanitizerMiddleware)transport.use(apiKeyMiddleware)transport.setHandler(ormHandler)transport.start(config)
- Register Fastify routes :
registerDynamicRestRoutes(app, protectedOrmHandler, pm)—/api/v1/...registerProjectRoutes(app, pm, protectedOrmHandler)—/:project/*registerTryRoutes(app, {dialect, pm})—/tryPOSTregisterTryPage(app)—/tryGET (HTML)startTrialCleanupJob({dialect, pm})— cron horaire TTL 7j
- Listen on port (
MOSTA_NET_PORT)
14 polyglot NetClients
Octonet est consommable depuis 14 runtimes natifs, avec la même apikey, la même URL :
Monorepo : github.com/apolocine/mosta-net-clients
Chaque NetClient suit le même contrat d'API :
Production deploy (amia.fr)
Le déploiement de référence tourne sur octonet.amia.fr + mcp.amia.fr (alias compat) en backend PostgreSQL :
Le kit de déploiement complet est dans Entreprise/octonet-mcp/ :
apache/mcp.amia.fr.conf— vhost Apache2 (proxy SSE, WS upgrade, certs Let's Encrypt SAN)ecosystem.config.cjs— config PM2deploy.sh/install.sh/update.sh— scripts d'orchestrationtests/smoke-all.sh— suite de smoke tests (DNS, TLS, /health, SSE MCP, REST, /try, NetClient Java)
CLI
License
AGPL-3.0-or-later — usage libre tant que le code dérivé reste open-source.
Licence commerciale disponible : [email protected]. Pricing par projet, pas par seat.
— (c) 2026 Dr Hamid MADANI <[email protected]>
Source: README.md at commit 2ba3569
Tools
0Version history
1- v2.0.42LatestSep 16, 2026
Score
40% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts
Declare a license in the repository or the registry entry.