@centia-io/mcp-server 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/centia-api.json
CHANGED
|
@@ -3013,6 +3013,41 @@
|
|
|
3013
3013
|
}
|
|
3014
3014
|
}
|
|
3015
3015
|
},
|
|
3016
|
+
"/api/v4/oauth/guest": {
|
|
3017
|
+
"post": {
|
|
3018
|
+
"tags": [
|
|
3019
|
+
"OAuth"
|
|
3020
|
+
],
|
|
3021
|
+
"description": "Get a guest token.",
|
|
3022
|
+
"operationId": "postGuest",
|
|
3023
|
+
"requestBody": {
|
|
3024
|
+
"description": "Get a guest token. A default user must be present.",
|
|
3025
|
+
"required": true,
|
|
3026
|
+
"content": {
|
|
3027
|
+
"application/json": {
|
|
3028
|
+
"schema": {
|
|
3029
|
+
"$ref": "#/components/schemas/OAuthGuest"
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
},
|
|
3034
|
+
"responses": {
|
|
3035
|
+
"201": {
|
|
3036
|
+
"description": "Created",
|
|
3037
|
+
"content": {
|
|
3038
|
+
"application/json": {
|
|
3039
|
+
"schema": {
|
|
3040
|
+
"$ref": "#/components/schemas/OAuthResponse"
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
},
|
|
3045
|
+
"400": {
|
|
3046
|
+
"description": "Bad request"
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
},
|
|
3016
3051
|
"/api/v4/ogc/database/{database}": {
|
|
3017
3052
|
"get": {
|
|
3018
3053
|
"tags": [
|
|
@@ -6894,6 +6929,34 @@
|
|
|
6894
6929
|
},
|
|
6895
6930
|
"type": "object"
|
|
6896
6931
|
},
|
|
6932
|
+
"OAuthGuest": {
|
|
6933
|
+
"description": "Guest token request payload.",
|
|
6934
|
+
"required": [
|
|
6935
|
+
"client_id",
|
|
6936
|
+
"database"
|
|
6937
|
+
],
|
|
6938
|
+
"properties": {
|
|
6939
|
+
"database": {
|
|
6940
|
+
"title": "Database",
|
|
6941
|
+
"description": "Database name the guest token will be created for.",
|
|
6942
|
+
"type": "string",
|
|
6943
|
+
"example": "my_database"
|
|
6944
|
+
},
|
|
6945
|
+
"client_id": {
|
|
6946
|
+
"title": "Client id",
|
|
6947
|
+
"description": "OAuth client id.",
|
|
6948
|
+
"type": "string",
|
|
6949
|
+
"example": "MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3"
|
|
6950
|
+
},
|
|
6951
|
+
"client_secret": {
|
|
6952
|
+
"title": "Client secret",
|
|
6953
|
+
"description": "OAuth client secret.",
|
|
6954
|
+
"type": "string",
|
|
6955
|
+
"example": "xxx"
|
|
6956
|
+
}
|
|
6957
|
+
},
|
|
6958
|
+
"type": "object"
|
|
6959
|
+
},
|
|
6897
6960
|
"Outbox": {
|
|
6898
6961
|
"description": "",
|
|
6899
6962
|
"required": [],
|
package/package.json
CHANGED
|
@@ -31,6 +31,25 @@ Forbidden:
|
|
|
31
31
|
- manual OAuth implementation
|
|
32
32
|
- provisioning API calls from browser runtime
|
|
33
33
|
|
|
34
|
+
## Public (anonymous) access without sign-in
|
|
35
|
+
|
|
36
|
+
When an app must call the API before any user has signed in, use the **guest token flow**: SDK class `GuestFlow` (`POST /api/v4/oauth/guest`; MCP tool `postGuest`).
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { GuestFlow } from '@centia-io/sdk'
|
|
40
|
+
const flow = new GuestFlow({ host, clientId, database, clientSecret? })
|
|
41
|
+
await flow.signIn() // stores access/refresh tokens; Sql/Rpc/Gql now run as the default user
|
|
42
|
+
flow.signOut() // clears tokens
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- Body: `database`, `client_id`, and `client_secret` only when the OAuth client is confidential (public clients omit it).
|
|
46
|
+
- No `Authorization` header. Returns the normal OAuth response (`access_token`, `refresh_token`, `token_type: bearer`, `expires_in`), refreshable with the standard refresh flow.
|
|
47
|
+
- The token is issued for the database's **default user** (`default_user=true`, see `centia-privileges`) and carries exactly that user's privileges — the same identity anonymous OGC/OWS requests get.
|
|
48
|
+
- Prerequisites: a default user must exist on the database (otherwise 404 `NO_DEFAULT_USER_FOUND`) and an OAuth client must be registered (`postClient`); unknown client → 401 `invalid_grant`, wrong secret → 401 `invalid_client`.
|
|
49
|
+
- Use it for read-only/public UIs and for token-only endpoints (Feature, SQL, GraphQL, RPC) that need a bearer even for public data. Never grant the default user write or admin privileges to make a guest app "work".
|
|
50
|
+
- In browsers use a **public** client so no secret ships in the bundle; switch to `CodeFlow` once the user signs in.
|
|
51
|
+
- Errors are thrown as plain `Error` with status and response body, like the other auth flows — not `CentiaApiError`. `GuestFlow` ships in `@centia-io/sdk` >= 0.2.14 (unreleased as of 2026-09-11; latest is 0.2.13).
|
|
52
|
+
|
|
34
53
|
## Server and CLI
|
|
35
54
|
|
|
36
55
|
Allowed methods:
|
|
@@ -63,6 +82,7 @@ Forbidden:
|
|
|
63
82
|
|
|
64
83
|
- Browser app: `CodeFlow`
|
|
65
84
|
- Browser signup: `SignUp`
|
|
85
|
+
- Browser/public access before sign-in: `GuestFlow`
|
|
66
86
|
- Backend app: `PasswordFlow`
|
|
67
87
|
- Provisioning: `PasswordFlow` or access token
|
|
68
88
|
- CLI: `PasswordFlow`
|
|
@@ -39,7 +39,7 @@ Query and API:
|
|
|
39
39
|
|
|
40
40
|
Auth and access:
|
|
41
41
|
|
|
42
|
-
- `postOauth`, `postDevice`
|
|
42
|
+
- `postOauth`, `postDevice`, `postGuest`
|
|
43
43
|
- `getUser`, `postUser`, `patchUser`, `deleteUsers`
|
|
44
44
|
- `getRule`, `postRule`, `patchRule`, `deleteRule`
|
|
45
45
|
- `getPrivileges`, `patchPrivileges`
|
|
@@ -52,6 +52,7 @@ Same per-layer model as WMS/WFS (`centia-privileges`): anonymous callers read la
|
|
|
52
52
|
| Existing `Read/write` collection, identity without privilege | 403 `INSUFFICIENT_PRIVILEGES` |
|
|
53
53
|
| Geofence deny | 403 `FORBIDDEN` |
|
|
54
54
|
| Bad/unknown parameter, bad CRS, interval datetime, items on a raster | 400 |
|
|
55
|
+
| Map backend (MapServer) failure, e.g. missing mapfile | 502 `MAP_BACKEND_ERROR` (JSON, never an HTML page with 200) |
|
|
55
56
|
|
|
56
57
|
`/collections` simply omits what the caller may not read. Errors use the v4 JSON shape `{"success":false,"message":…,"code":…,"errorCode":…}`.
|
|
57
58
|
|