Search docs.molo17.com
    Configuration guide Security

    Give each tool its own least-privilege API token

    A monitoring script, an AI assistant and a BI tool each need to talk to Gluesync, but none of them needs your full access. A Personal API Token lets a tool act as you without your password, and its permission scopes decide what it may do. This guide creates one token per tool with a single scope, proves with real requests what each token refuses, limits a token to one agent, and revokes a token that is no longer needed.

    In this guide

    You will learn how to create a token in Settings → Account → Personal API Tokens, which scope fits which tool, what Core Hub answers when a token goes beyond its scope over the REST API and over MCP, how to limit a token to some agents, and how to revoke and delete a token.

    The steps were run on Core Hub with a SQL Server to PostgreSQL pipeline. For calling the REST API and MCP with a token in an automation, see Automate Gluesync with the REST API, MCP and webhooks.

    Quick information

    Goal

    Give every client its own token that can do only what it needs, and take it away when it is no longer needed

    Audience

    Gluesync administrators and anyone who connects scripts, AI assistants or BI tools to Gluesync

    Level

    Beginner

    Time required

    About 20 minutes

    Area

    Control Plane → user menu → Settings → Account → Personal API Tokens

    Applies to

    Gluesync 2.3

    Before you begin

    Make sure that:

    1. You can sign in to the Control Plane. A token never has more access than your role: scopes can only narrow it. See User management and role-based access control;

    2. For the checks, you have curl and the address of Core Hub. Here it is https://localhost:18444, with a self-signed certificate, so the examples use curl -k.

    Which scope for which tool

    Tool Scope in the Control Plane What the token may do

    Monitoring script, report

    API read

    REST GET requests that change nothing

    Automation that starts, stops or changes pipelines

    Full API

    The whole REST API, with your role’s permissions

    AI assistant that only reads

    MCP server (read-only)

    The MCP server; tools that change something are refused

    AI assistant that also changes things

    MCP server

    The MCP server with every tool. It is not read-only

    BI tool, SQL client

    JDBC gateway

    The Query Forge JDBC gateway only, always read-only

    Caller of Courier inbound routes

    HTTPS agent

    Courier inbound routes only

    Every scope, with its exact rules, is in Personal API Tokens and scopes.

    Guide steps

    Create a token for each tool

    UI

    1. Open the user menu, select Settings, then Account and the tab Personal API Tokens;

    2. Select New token;

    3. Enter a Token name that says who uses it, here monitoring-script;

    4. Choose the Expiry: 7 days, 30 days, 90 days or Never. Here 30 days;

    5. Under Permission scopes, tick only API read, then select Create.

    The New Personal API Token dialog with the Token name field
    Figure 1. The New Personal API Token dialog: name, expiry and permission scopes.
    Expected result

    Your new API token shows the token, which starts with gsp_, and says Copy this token now. You will not be able to see it again. Core Hub keeps only a hash of it. Select Copy, store the token in your secret manager, then select I’ve copied it, close, which is available once you have copied the token.

    The Your new API token dialog with the warning Copy this token now
    Figure 2. The token is shown once. The value is hidden in this screenshot.

    Create the other tokens the same way, each with one scope: ai-assistant with MCP server (read-only) and bi-tool with JDBC gateway, both for 90 days.

    Selecting Create with no scope ticked shows Choose at least one permission scope.: every token needs at least one.

    Check what a read token refuses

    CLI

    Store the address and the token in your shell, from your secret manager, then send a few requests:

    GLUESYNC_URL=https://localhost:18444
    GLUESYNC_TOKEN=<the monitoring-script token>
    
    # what the token is allowed to do
    curl -sk -H "Authorization: Bearer $GLUESYNC_TOKEN" "$GLUESYNC_URL/api-tokens/current-scope"
    
    # a read: allowed
    curl -sk -o /dev/null -w '%{http_code}\n' -H "Authorization: Bearer $GLUESYNC_TOKEN" "$GLUESYNC_URL/pipelines"
    
    # a change: refused
    curl -sk -X POST -H "Authorization: Bearer $GLUESYNC_TOKEN" -H 'Content-Type: application/json' \
      -d '{"name":"x"}' "$GLUESYNC_URL/pipelines"
    
    # creating a token with a token: refused, whatever the scope
    curl -sk -X POST -H "Authorization: Bearer $GLUESYNC_TOKEN" -H 'Content-Type: application/json' \
      -d '{"name":"x","permissionScopes":["gluesync.api"]}' "$GLUESYNC_URL/api-tokens"
    Expected result
    {"scopes":[],"scoped":false,"permissionScopes":["gluesync.api_read"],"legacyFullAccess":false,"personalApiToken":true}
    200
    {"notificationId":-1,"message":"This token's permission scopes (gluesync.api_read) do not allow this request. It needs gluesync.api."}
    {"notificationId":-1,"message":"Personal API Tokens cannot create, revoke or delete tokens. Use the Gluesync UI."}

    The refused requests answer HTTP 403, and the message names the scope the request needs. A request without a token answers HTTP 401.

    The ai-assistant and bi-tool tokens cannot call the REST API at all. GET /pipelines with them answers HTTP 403 with This token’s permission scopes (gluesync.mcp_read) do not allow this request. It needs gluesync.api_read or gluesync.api., and the same with gluesync.jdbc_gateway.

    Check what the read-only MCP token refuses

    CLI

    Connect an MCP client to https://<core hub>/mcp/http with the ai-assistant token as Authorization: Bearer, then call a tool that reads and one that changes something. Here the calls were sent with curl: initialize, then tools/call for list_pipelines and for create_pipeline.

    Expected result

    list_pipelines answers with the pipelines. create_pipeline answers with an error, and nothing is created:

    Gluesync MCP: 'create_pipeline' changes data, and this token only has the read-only MCP scope (gluesync.mcp_read). Use a token with the gluesync.mcp scope to run it.

    The monitoring-script token cannot open an MCP session: initialize answers HTTP 403 with This token’s permission scopes (gluesync.api_read) do not allow this request. It needs gluesync.mcp or gluesync.mcp_read.

    The list of tools that the read-only token gets also names tools that change things. The scope is enforced when a tool is called, so the AI assistant sees them but cannot run them.

    To connect an AI client, see Core Hub MCP server.

    Limit a token to some agents

    CLI

    A token can also be limited to some (pipeline, agent) pairs. The New token dialog does not set them: create such a token with the REST API from a signed-in session, as described in Automate Gluesync with the REST API, MCP and webhooks, or with the connection wizard of Query Forge. Here a report token was limited to the SQL Server agent of the pipeline:

    {"name":"report-sqlserver-only","expiresInDays":30,"permissionScopes":["gluesync.api_read"],
     "scopes":[{"pipelineId":"4c8cb118","agentId":"e07a0141"}]}
    Expected result

    GET /api-tokens/current-scope answers "scoped":true with the pair. Reading the SQL Server agent answers HTTP 200; reading the PostgreSQL agent of the same pipeline answers HTTP 403 with This token is limited to specific agents and cannot reach this pipeline or agent.

    The token list shows the permission scope of such a token, not its agents: give the token a name that says what it is limited to.

    Revoke a token

    UI + CLI

    When a tool is retired, or a token may have leaked, revoke it:

    1. In Personal API Tokens, open the menu of the token in Actions and select Revoke;

    2. Read the confirmation and select Revoke.

    The Revoke token dialog: Are you sure you want to revoke monitoring-script? A revoked token can no longer be used but remains in the list for audit. You can permanently delete it afterwards.
    Figure 3. A revoked token stays in the list for audit.
    Expected result

    The token shows Revoked in Status, and Last used tells when it was used last. A request with it answers HTTP 401:

    {"notificationId":-1,"message":"Invalid authorization token, please retry or make a new login in order to obtain a fresh token"}
    The Personal API Tokens list with report-sqlserver-only (API read)
    Figure 4. One token per tool, each with its scope, expiry and last use.

    To remove a revoked token from the list for good, select Delete in the same menu.

    Keep tokens under control

    • One token per tool. Revoking one token then stops one tool, not all of them, and Last used tells you which tool is still active.

    • The narrowest scope. API read for monitoring, MCP server (read-only) for an assistant that reads, JDBC gateway for BI tools.

    • An expiry. Prefer 30 or 90 days to Never, and create a new token before the old one expires.

    • Tokens are managed from the Control Plane. No token can create, revoke or delete tokens, so a leaked token cannot make itself a broader one.

    • Replace legacy tokens. A token created before scopes existed shows Full access (legacy): create a scoped one, then revoke it. See Tokens without permission scopes.

    Troubleshooting

    Problem Possible cause What to do

    Choose at least one permission scope. in New Personal API Token

    No scope is ticked

    Tick the scope the tool needs

    HTTP 403: This token’s permission scopes (gluesync.api_read) do not allow this request. It needs gluesync.api.

    The token’s scope does not allow the request, for example a change with API read

    Use a token with the scope the message names, or keep the tool read-only

    HTTP 403: It needs gluesync.api_read or gluesync.api. with an MCP or JDBC token

    The token is for MCP or the JDBC gateway and cannot call the REST API

    Use a token with API read or Full API for REST calls

    'create_pipeline' changes data, and this token only has the read-only MCP scope (gluesync.mcp_read).

    An MCP client with a read-only token called a tool that changes something

    Use a token with MCP server if the assistant must change things

    HTTP 403: Personal API Tokens cannot create, revoke or delete tokens. Use the Gluesync UI.

    A token was used to manage tokens

    Manage tokens from the Control Plane, or from a signed-in session

    HTTP 403: This token is limited to specific agents and cannot reach this pipeline or agent.

    The token has agent scopes that do not include this agent

    Create a token whose agent scopes include it

    HTTP 401: Invalid authorization token, please retry or make a new login in order to obtain a fresh token

    The token was revoked, deleted, has expired, or is mistyped

    Check its Status in Personal API Tokens, and create a new token if needed

    I’ve copied it, close stays disabled

    The token has not been copied

    Select Copy first