SCI Gateway
by jose290594
README.md
# SCI Gateway
One REST API and one MCP server in front of the self-hosted apps of a business. Odoo, Chatwoot and the rest keep their own users and data; the gateway adds scoped API keys, a single vocabulary (contacts, products, sales, invoices, conversations) and an audit log.
- **REST** at `/v1`, with OpenAPI at `/docs` and `/openapi.json`.
- **MCP** (streamable HTTP) at `/mcp`, so an AI assistant can work on behalf of the account.
- Every action is defined once and exposed through both interfaces, with identical inputs, permissions and results.
- Keys are limited by scope, can expire and can be revoked. Only a hash is stored.
- Every call is recorded with the key, the action, the channel and the target id. Payloads are never stored.
## Actions
| Action | REST | MCP tool | Scope |
|---|---|---|---|
| Connected apps and scopes | `POST /v1/system/status` | `system_status` | none |
| Search contacts (Odoo and Chatwoot) | `POST /v1/contacts/search` | `contacts_search` | `contacts:read` |
| Get a contact | `POST /v1/contacts/get` | `contacts_get` | `contacts:read` |
| Search products with price and stock | `POST /v1/products/search` | `products_search` | `products:read` |
| Sales orders | `POST /v1/sales/orders` | `sales_orders` | `sales:read` |
| Customer invoices | `POST /v1/invoices/search` | `invoices_search` | `invoices:read` |
| Conversations | `POST /v1/conversations/list` | `conversations_list` | `conversations:read` |
| Messages of a conversation | `POST /v1/conversations/messages` | `conversations_messages` | `conversations:read` |
## Run
```yaml
services:
gateway:
image: ghcr.io/jose290594/seemlink-gateway:latest
restart: unless-stopped
network_mode: host
environment:
SCI_HOST: 127.0.0.1
SCI_PORT: "8091"
volumes:
- gateway_data:/data
volumes:
gateway_data:
```
Put a reverse proxy with TLS in front of port 8091. The gateway reads `/data/connectors.json` at startup:
```json
{
"odoo": { "url": "http://127.0.0.1:8069", "database": "main", "api_key": "..." },
"chatwoot": { "url": "http://127.0.0.1:8086", "account_id": 1, "token": "..." }
}
```
An app that is not listed is reported as not connected. Odoo is reached through its JSON-2 API (Odoo 19) with an API key; Chatwoot through its application API with an access token.
## Keys
```sh
docker compose exec gateway sci-gateway keys create "Zapier" --scope contacts:read --scope products:read
docker compose exec gateway sci-gateway keys list
docker compose exec gateway sci-gateway keys revoke <id>
docker compose exec gateway sci-gateway audit --limit 20
```
`keys create` prints the key once (`sci_<id>_<secret>`). Without `--scope` the key receives every read scope. Add `--expires-in-days N` for keys that should lapse.
Send the key as `Authorization: Bearer <key>`.
```sh
curl -X POST https://api.example.com/v1/contacts/search \
-H "Authorization: Bearer $SCI_KEY" -H "Content-Type: application/json" \
-d '{"query": "ana"}'
```
## Connect an AI assistant
Add the server to any MCP client that supports streamable HTTP:
```json
{
"mcpServers": {
"sci": {
"url": "https://api.example.com/mcp",
"headers": { "Authorization": "Bearer sci_..." }
}
}
}
```
## Configuration
| Variable | Default | Purpose |
|---|---|---|
| `SCI_DATA_DIR` | `/data` | SQLite database and connectors file |
| `SCI_CONNECTORS_FILE` | `$SCI_DATA_DIR/connectors.json` | Connected apps |
| `SCI_HOST` | `127.0.0.1` | Listen address |
| `SCI_PORT` | `8091` | Listen port |
| `SCI_UPSTREAM_TIMEOUT` | `20` | Seconds to wait for an app |
## Development
```sh
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest
SCI_DATA_DIR=./data sci-gateway serve
```
## License
Apache-2.0
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues