MCP, chat channels and API
Settings → MCP has two distinct parts. Connect to ZASTRA describes the deployment's own MCP endpoint for clients such as ChatGPT. External MCP servers are tools you connect for use inside your ZASTRA agents. Adding an external server does not publish it as part of the ZASTRA endpoint.
Connect an MCP client to ZASTRA
Copy the advertised HTTPS MCP URL from Connect to ZASTRA and add it in your client. Complete ZASTRA OAuth with your own account. The connection uses your current dataset access: inaccessible datasets are not listed, guessed IDs are denied, and chats referring to inaccessible datasets are hidden. Local-only datasets never appear via MCP. A prompt naming a corpus does not change these permissions. The core tools are ragflow_list_datasets, ragflow_list_chats, ragflow_retrieval and ragflow_get_document.
Retrieval returns passages with document links. ragflow_get_document can return metadata and an authenticated link or, with include_file=true, the original binary up to 10 MiB. Larger originals can be opened in the ZASTRA app when authorised. The browser link requires a separate ZASTRA browser sign-in; OAuth in the MCP client does not sign in the browser. If a client caches old tool descriptions, refresh its connection metadata and start a new conversation.
MCP retrieves evidence for the external client's own answering. It does not inherit the settings of a saved ZASTRA chat. Explicit dataset selection is the reliable way to scope retrieval; omitting IDs searches only the datasets your account can access. Compare equal scopes and ranking settings when investigating different results between clients.
If the installation operator runs ZASTRA's MCP server as a separate service, that service requires a client token, which only an administrator or the operator can set up. Clients without a valid token are refused.
Add an external MCP server
In Settings → MCP → External MCP servers, add its Streamable HTTP URL. Choose anonymous access, a bearer token or OAuth as supported by that server. For OAuth, save the connection, select Prepare OAuth connection, review the requested scopes, and open the provider's authorization page. ZASTRA stores the grant for your account and refreshes it where possible. Reconnect if the grant expires without a usable refresh token. Some providers require a pre-registered client; use that option in the connection form when necessary. Only select scopes you understand, especially write or workflow-execution permissions. Add the connected tools to an Agent node, then test a harmless call before allowing a consequential action. If authorization setup fails, check the server address and OAuth settings, then prepare a new connection. Open the authorization link once. If it has expired or was already used, check the connection status in ZASTRA and prepare a new link if needed.
Saved credential values are not displayed. To change a name or other ordinary setting, leave Credentials → Use saved credentials selected. To reconnect with different credentials, select Replace credentials, enter the complete new settings, test and save. Replacement removes previously saved custom variables, headers and OAuth authorization; enter any values you still need. If you change the server address, transport or authentication method, replace or clear the credentials rather than forwarding the old connection's access.
Use Custom variables (JSON) and Custom headers (JSON) only when the provider requires them. Enter JSON objects containing text values; a header can refer to a custom variable with ${variable_name}. Keep credentials in these connection fields, never in a conversation. For OAuth, save changed client settings and authorize again.
Clear credentials and pause connection → Save removes the saved credentials and stops the connection from being used by chats, agents and Raggy. To use it again, replace its credentials or complete OAuth authorization. Exported configurations omit credentials; an imported bearer connection without a token stays paused until you configure it. After a connection change, refresh its tools and review any pending tool action again.
After OAuth authorization completes, close the provider window and select Discover tools in the connection settings. Discovery loads all pages returned by the server before presenting the list. If discovery fails, repeat it from the saved connection. Reconnect if the authorization has expired or been revoked. If the catalogue is too large or keeps returning invalid pages, ask the server administrator to expose a smaller, stable set of tools for this connection. Tool execution still requires the applicable permissions.
Other interfaces
When listing dataset documents through the REST API, use create_time_from and create_time_to to filter by creation time. Both bounds are inclusive Unix timestamps in milliseconds. Omit a bound or pass 0 to leave that side open. Each page and total use the same filters.
For chat API streams, append ordinary answer deltas exactly, including repeated text. When the terminal event contains final_content, replace the accumulated answer with that string, even when it is empty; it contains the final citation processing. An empty terminal answer without final_content carries metadata only. The Python SDK exposes these as Message.content, Message.final and Message.final_content; the CLI applies the final replacement automatically. OpenAI-compatible streaming keeps its ordered delta.content tokens unchanged: reference-aware clients can use the terminal delta.final_content extension when references are requested. A standard client that only joins delta.content does not receive later citation repairs; use a nonstream request when the complete processed answer is required. Check cited passages before relying on a claim: a valid citation number does not establish that the passage supports it.
Run the OpenAI-compatible chat endpoint with an API key from the account that owns the chat. Treat an **ERROR** marker in the OpenAI-compatible chat response as a failed request, even if the stream ends normally. Check the saved chat’s model. If the conversation is long, start a new session or shorten the submitted history before retrying.
Dify knowledge retrieval uses up to 64 matching chunks when top_k is omitted. Set top_k to an integer from 1 to 64. If retrieval returns code 500, try the same search in the dataset. If it still fails, give the administrator the dataset name and the time of the failed request.
Streaming integrations can receive start_to_think and end_to_think events around a reasoning section; the Python SDK exposes these flags on Message. Keep that section separate from the visible answer. The CLI retains <think>…</think> boundaries in collected partial text and applies an authoritative terminal answer when present. If the CLI reports a stream read or event-size error, the answer is incomplete; check the connection or use a nonstream request before relying on it. Cancellation preserves any partial text already received and does not create a completed answer.
In Admin → API, open API Reference and select a chapter or endpoint to read its request, response and cautions. The reference starts closed; API key management is available immediately and independently. Close the reference when finished. Check the response body's code as well as the HTTP status: a nonzero application code reports a failed operation even when HTTP status is 200. Agent execution, including the OpenAI-compatible interface, requires access to the requested agent. Resume with a session belonging to that same agent; keep session identifiers private and inspect execution errors before retrying an action.
The reference's feature-help links open the corresponding ZASTRA user-guide articles for dataset controls, metadata and agent components. Use those articles for configuration and recovery steps alongside the endpoint examples.
For REST integrations, POST /api/v1/documents/ingest requires a non-empty doc_ids array of distinct document IDs and run: "1" or 1 to start ingestion, or run: "2" or 2 to cancel it. Every selected document requires edit permission. Unsupported values, malformed selections and duplicate IDs are rejected before document changes. Use apply_kb: true to adopt current dataset automatic metadata settings when starting ingestion. Remove the unsupported delete field from requests: reprocessing keeps the last successful indexed content available until its replacement succeeds. In metadata conditions, use comparison_operator: "=" for exact equality; "eq" is unsupported and can return no matches. See the API reference for the complete operator list.
Settings → Chat channels connects a chat to supported messaging platforms; channel availability and secrets depend on the deployment. Test that the channel can receive and send a message before sharing it widely. Admin → API contains API key management and the REST reference; it is not part of personal settings. Protect API keys as credentials and rotate them if exposed. API operations enforce the same user and resource boundaries; possession of a dataset ID is not an access grant. Memory stores context for an agent when configured and connected explicitly; inspect its messages and sharing scope before using it for personal data.
In Chat channels, Connect assistant or Agent loads all eligible choices. Assistants must be active and owned by the channel owner; a shared assistant is not eligible merely because you can use it in Chat. Agent choices follow the owner’s current access. Wait until loading finishes; while offline, reconnect before selecting or confirming. An unavailable existing binding remains visible: choose a replacement, or use Clear → Confirm to disconnect deliberately. Cancel keeps the existing binding. If connection fails, the dialog keeps your selection for retry. If the choices cannot load, close and reopen the dialog. Connecting a channel does not grant resource access.
A disabled channel or deleted, disabled or inaccessible target stops accepting new messages. New agent conversations use the current saved workflow; existing conversations retain their session. Test a new conversation after editing before opening the channel to users. Correct malformed configuration or credentials in the affected channel and save it; that channel is skipped while other valid channels continue. If completion fails, the sender receives a general failure message. Ask an administrator to check the channel configuration and agent availability before retrying; internal error details are not shown to the sender.
Access to an Agent through a personal team share requires accepted, active membership in an active team. If that access ends or is disabled, the channel stops using the Agent unless another valid permission remains. Provider failure details are excluded from later channel conversations; ask an administrator to check the channel configuration and agent availability.
WhatsApp channel status
When WhatsApp is available, open the intended channel in Chat channels and wait for its current QR and connection status. Pair it with the intended account using the provider’s flow, then confirm the connected status. If the code expires or the status fails to update, reopen that channel and check its error before retrying. Creating a channel does not grant it access to another user’s datasets.
The default gateway and pairing state belong to this installation. A separate installation has its own pairing; restarting the service normally retains the current pairing. If WhatsApp reports that the account has logged out, pair it again using the new QR code. If the gateway is unavailable, ask the administrator to verify that the installation includes WhatsApp support before retrying.
An administrator can instead provide an external gateway address, its access credential and a dedicated session name in the channel configuration. Use those three values together; this choice uses the external service's pairing state. Do not reuse another installation's private credential or session. The administrator must keep that external service available. After a connection change, wait for the channel's current status and verify a test message before relying on replies.
AI guidance for external MCP
In an external MCP connection form, choose Connect MCP with AI after entering the actual endpoint. The assistant explains transport, authentication and testing and can propose a valid connection name and transport. It cannot invent an endpoint, change authentication, enter credentials, approve OAuth scopes or invoke tools. Apply the reviewed draft, then use the normal save, OAuth and connection-test actions and inspect the server's actual tool list. A successful connection alone does not select tools inside an agent. If authorization or discovery fails, check the endpoint and provider setup before retrying. Existing access remains subject to the owner's permissions.
If the assistant asks a question, type in Your answer, directly below the question, and select Send answer. For a refinement, use What would you like to change? → Send reply. Earlier answers stay in Conversation so far. Start over clears the conversation and retains form edits. After Apply to form, the assistant closes so you can review the ordinary fields and use Save or Test. Undo applied changes is available beside the assistant button; it preserves unrelated manual edits. A failed or cancelled reply keeps the question and your typed answer for retry.
When the assistant asks for the connection address, enter the provider’s actual URL in Your answer → Send answer. It can then fill that exact address in the normal form. It does not invent addresses or authorize the provider. Verify the endpoint, complete ordinary sign-in if required, test the connection and inspect its advertised tools.
Memory permissions and removal
Use/view access permits reading and searching Memory. Adding messages, changing settings, forgetting messages, changing message status and deleting Memory require edit permission. These rules also apply to workflow steps and API requests. If processing is still running, wait before deleting the memory. If deletion reports pending message cleanup, refresh the list to see that the memory has already been removed. Ask an administrator to restore the search service if cleanup remains pending. ZASTRA retries it automatically.
When searching Memory through the API, enter numbers for similarity_threshold and keywords_similarity_weight. Use a decimal point in the request. Correct invalid values before retrying.
The Python SDK raises HTTP, malformed-event, execution and connection-read errors. Keep any text already received as an incomplete answer and inspect the error before retrying. If you stop reading session.ask(..., stream=True) before completion, call the returned iterator’s close() in a finally block to release the connection. A Message node finishing does not end an agent run; continue reading until the run ends or an error occurs.
Python SDK clients can reuse a connection with with client as sdk or call close() when finished. Set timeout=(connect, read) and stream_timeout=(connect, read) in seconds. Defaults are (10, 120) and (10, 300). The read limit measures inactivity between reads. After an interrupted write, check its status before retrying. An agent completion with no output has empty content and returns the session identity. For a temporary token-service error, retry the same authorization code or refresh token while valid. Reconnect if the grant has expired or been revoked.
When does a ZASTRA API key expire?
By default, a new workspace API key has no expiry date. This also applies when an administrator issues a key for another account. In Admin → API, open the key list. No expiry means the key has no time limit. If a date is shown, replace the key before that date to keep the integration running. The account’s permissions and API access rules still apply.
When upgrading to version 1.0.15 or later for the first time, an installation using the default policy also removes the expiry from existing keys that are still valid. Integrations keep using the same secret. Expired or revoked keys stay unusable. If the installation has a fixed lifetime, existing keys keep their dates.
Use a workspace API key for an unattended integration. A browser sign-in is tied to that browser’s session and cookies. Copying its authorization header into a script does not give the script a reusable API key.
The installation operator can set ZASTRA_API_KEY_DAYS to never or 0 for no expiry, or to a number from 1 to 365 for a fixed lifetime in days. If the ZASTRA setting is absent, DIGIRAG_API_KEY_DAYS is used. If neither is set, keys have no expiry. After changing the setting, restart the API and admin services. Changes after the initial upgrade apply only to newly issued keys.
For a planned replacement, create a new key, save it in the integration’s secret store, and test a request before revoking the old key. Revoke a suspected exposed key immediately. Revoke keys when their integrations are retired.