@latest, which follows published module versions rather than main. Use the
v0.4.3 docs
for its exact API. v0.3.3 is withdrawn, unsupported and retracted by v0.4.0 and later; its
public artifacts remain only for forensic or compatibility inspection and must not
be deployed.mqlite was shaped so a model can drive it without tripping: every operation is
one HTTP POST with a JSON body, there is exactly one settlement verb per outcome (no aliases
to confuse a model), GET / returns a machine-readable discovery card, and delivery
semantics are documented as testable invariants. Three ways in, strongest first.
mqlite-mcp ships in the same repo — a dependency-free stdio MCP server that turns each tool call into one HTTP POST to the broker.
Install the latest published broker and MCP server together in one command:
go install github.com/mqlitehq/mqlite/cmd/mqlite@latest github.com/mqlitehq/mqlite/cmd/mqlite-mcp@latest
Both packages are resolved from the same module version. Run mqlite version to check the broker binary; the MCP host reads serverInfo.version from initialize. An existing broker reports its version in GET /. Use matching versions and the documentation for that release; record an exact version when reproducibility matters. You can also download both binaries from one latest release archive. Register the installed MCP binary with your host:
{
"mcpServers": {
"mqlite": {
"command": "/path/to/mqlite-mcp",
"env": {
"MQLITE_ENDPOINT": "https://your-broker.example.com",
"MQLITE_TOKEN": "mqk_..."
}
}
}
}
The documented source exposes 22 tools, 29 routes and 26 commands. The table below follows that source; a released binary may differ from unreleased main changes. Install the broker and mqlite-mcp from the same release. The observe tool requires both the broker and MCP server at v0.3.2 or later. Key-management tools require v0.3.1 or later:
| Tool | Does |
|---|---|
list_queues | list plain and subscription backing queues, including deleting names |
create_queue | create or update a queue by name |
delete_queue | delete an empty plain queue, or use explicit force to discard retained work |
subscribe | create a subscription or update its filter; optional ttl_ms sets one fixed lifetime |
list_subscriptions | page subscriptions by topic with count, lifecycle state and optional deleting entries |
delete_subscription | delete one exact topic/name pair; optional force discards retained work |
send | send a message (queue, body, optional message_id / group_id) |
receive | peek-lock messages → returns seq_number + lock_token |
complete / abandon / reject | settle: done / retry below the limit (DLQ at the limit) / immediate dead-letter |
renew | extend the same live claim before expiry; delivery_count is unchanged |
defer / receive_deferred | set aside, then claim by seq; the claim increments delivery_count and currently has no max admission check |
peek | browse without locking (optionally by state) |
stats | queue depth by state |
observe | broker health and lifecycle clock, queue snapshots, message effects, storage and request measurements (since v0.3.2) |
redrive / purge | move dead letters back / delete them |
create_key | issue a key with id, name, permissions and optional expires_at_ms; token returned once |
list_keys | list public metadata with after_id / limit / sort, including revoked and expired keys |
revoke_key | revoke by public id; repeated revocation is safe |
Key tools require manage; both configured administrators and managed manage keys may issue new administrator keys. Give message producers send and consumers listen. In the documented source, listen also permits broker-wide subscription creation/filter updates and filter testing; subscription inventory and deletion still require manage, with or without force. A consumer may settle messages or consume them in receive-and-delete mode; listen is not an audit-only role.
For a monitoring-only MCP connection, put a configured MQLITE_MONITOR_TOKENS credential into the client's MQLITE_TOKEN. It can call observe, but cannot read message bodies, consume messages, change queues or issue keys. Use the returned collection status and availability fields; unavailable measurements are not healthy zeroes. v0.4.1 adds server_time_ms for comparing lifecycle deadlines; do not substitute the cached queue sampled_at_ms. See Observability. The observe tool works independently of the optional Prometheus switch; --metrics only enables authenticated /metrics on the API port. v0.4.0 removes the deprecated mqlite_queue_total and mqlite_queue_oldest_message_age_ms aliases; use mqlite_queue_retained_messages and mqlite_queue_oldest_message_age_seconds.
Choose and retain a unique 32-character lowercase hex public ID before calling the tool:
{
"name": "create_key",
"arguments": {
"id": "e734810a9f634d75bd8a029c1f7e5062",
"name": "orders-producer",
"permissions": ["send"]
}
}
Save the returned mqk_ + 64 lowercase hex token securely; it appears once in the tool result and may be retained by the MCP host. Keep the public ID for listing and revocation. After a lost creation response, reconcile that ID and revoke a possibly-created key before issuing another; retrying the same ID cannot recover its secret. Follow next_after_id through list_keys pages. See Access keys for expiry, rotation and recovery.
Lists default to sort: "id_asc". Use sort: "created_desc" for newest-created keys first, with descending public ID for timestamp ties; keep the same sort on each page. Creation-order cursors must identify an existing key. Default ID order also accepts absent predecessor IDs for lost-response reconciliation.
Details: docs/mcp.md.
For any agent that can run curl or make HTTP calls. This prompt follows the documented source API. Verify the deployed broker's version and discovery card; use the matching release documentation for a released binary, or that build's own source documentation for an unreleased binary. Fill in the two placeholders and paste the matching instructions into your agent's system prompt or task context:
You have access to a message queue (an mqlite broker).
Base URL: <MQLITE_ENDPOINT> the broker's origin, including the port.
Direct: http://127.0.0.1:6754 (example: broker configured on TCP 6754
and terminates no TLS of its own)
Proxied: https://mq.example.com (HTTPS :443 at a reverse proxy, which
forwards to the broker's internal :6754)
Endpoint paths below are relative to this origin.
Auth: every RPC call needs the header Authorization: Bearer <MQLITE_TOKEN>
Protocol: every operation is ONE HTTP POST with a JSON body to
/mqlite.v1.QueueService/<Method>, /mqlite.v1.AdminService/<Method>,
or /mqlite.v1.AuthService/<Method> (v0.3.1 and later).
GET / with Accept: application/json (no auth) returns a discovery card
listing the broker version and every endpoint.
Rules:
- Before changing data, GET / with Accept: application/json and read its version
and endpoints. Use only the
deployed broker's documented API. For a released broker, use documentation for
its exact release tag; an unreleased build needs its own source docs.
- Key rights: send produces/schedules/cancels; listen receives/settles/renews/peeks,
reads queue stats, creates or updates subscriptions, and tests filters; manage
includes both and administration/key issuance. Subscription inventory and every
DeleteSubscription request require manage, whether force is false or true.
Rights apply across the broker. Do not retry 401 or 403; obtain a valid key
with the required permission from an administrator.
- On v0.3.2+, AdminService/Observe {} reads broker measurements using a configured
monitor credential or manage key. Check collection/availability fields; missing
measurements are not zero. Monitor credentials cannot read message bodies.
- Message bodies are BASE64 strings in JSON. Encode before sending,
decode after receiving.
- Queues never auto-create. Create first:
AdminService/CreateQueue {"name":"jobs","config":{}}
Queue and subscription deletions are empty-only by default. force=true is explicit
authorization to discard every retained state, including locked work. A successful
state=deleted result means cleanup finished in the accepting commit; state=deleting
means bounded cleanup continues and reserves the name. The API has no Generation
field: one owner must reconcile inventory and serialize deletion with same-name
creation. After a redirect, transport failure, any 5xx or an invalid success body,
do not retry the delete. Reconcile with ListQueues or ListSubscriptionsPage using
include_deleting=true; an absent name confirms completion under the one-owner rule.
- Consume with Peek-Lock:
QueueService/Receive {"queue":"jobs","max_messages":1,"wait_time_ms":5000}
Each newly granted Peek-Lock claim increments delivery_count. Each returned
message has seq_number + lock_token. You MUST settle every message you receive,
using its lock_token:
QueueService/Complete {"queue":"jobs","seq_number":N,"lock_token":"..."} done
QueueService/Abandon {...,"delay_ms":60000} retry below limit; at limit -> DLQ
QueueService/Reject {...} give up -> dead-letter queue
On the documented source, Abandon delay_ms is nonnegative and a new visibility
deadline must fit the timestamp range. Go SDK delays are zero or at least 1ms;
invalid input leaves a live delivery unchanged.
If you settle nothing, the lock expires (default 30s). Recovery returns the
message to active, or sends a failed final attempt to the DLQ. Reaching the
limit does not interrupt that final claim: it may still be renewed or completed.
New settlements and Renew require locked_until_ms > now: the exact deadline
is already expired, even before the reaper runs. An unexpired receipt only lets
the exact request replay a previously committed settlement after expiry.
- Receive-and-Delete is explicit at-most-once broker removal and grants no lease:
lock_token is empty and locked_until_ms is zero (omitted in JSON), including
receive-attempt replays. Do not settle it.
- Default Peek-Lock delivery is AT-LEAST-ONCE: you may see a message twice.
Make business handling idempotent using your own durable state. message_id alone
does not deduplicate sends: duplicate detection is OFF by default. When the queue
has a positive dedup_window_ms, retry the same message_id and body within that
retention window; a different body conflicts. Broker deduplication does not make
external side effects exactly-once.
- Long-running work: call QueueService/Renew with the lock_token before expiry.
It extends the same claim without increasing delivery_count, does not stack
durations, and cannot revive an expired lease.
- Pub/sub: AdminService/Subscribe {"topic":"events","name":"my-sub",
"filter":{"expr":"subject == \"order\""},"ttl_ms":900000} — then Send to
"events" fans out; Receive from "my-sub". Filter may be omitted; omitted or zero
ttl_ms creates a permanent subscription or preserves an existing lifetime.
A positive TTL is a fixed lifetime from first creation: retries, filter updates
and traffic never extend it. At expiry it preauthorizes forced cleanup. Delete
explicitly after normal use; for high-rate request/reply, use one stable reply
subscription and dispatch by correlation_id instead of one subscription per request.
Subscribe and TestFilter require listen; listing and deleting subscriptions require
manage. Subscribe is a broker-wide upsert, not create-only ownership.
- Ordered work: send with "group_id" — messages sharing a group_id are
delivered strictly in order, one in flight per group. Abandon with delay_ms > 0
parks the message in scheduled and keeps blocking its ordered group until due
(strict_fifo: the whole queue). Cancel only removes never-delivered scheduled
messages, with delivery_count = 0.
- Message TTL: use top-level ttl_ms for a uniform Send batch or messages[].ttl_ms
when item lifetimes differ. A positive queue default is both the default and
ceiling. The fixed expires_at_ms is initial visible_at_ms + effective TTL, so a
scheduled message starts its TTL when first due. Renew, delayed Abandon and
scheduler activation never extend it. Expiry ends normal delivery and then
dead-letters or discards according to queue policy.
- Errors are JSON {"code","message"}: 400 invalid_argument · 401 unauthenticated ·
403 permission_denied · 404 not_found ·
409 name_conflict / already_exists / lock_lost / key_conflict /
queue_not_empty / subscription_not_empty ·
413 message_too_large · 429 resource_exhausted · 503 outcome_unknown.
On 409 lock_lost, re-Receive instead of retrying the settle. A 503
outcome_unknown may already have committed; reconcile instead of blindly retrying.
Exact settlement receipts last 30 minutes from recording; replay does not extend
them, and resource deletion or expiry can end replay earlier. Keep application
evidence when reconciliation must outlive that window.
Cheat sheet (request bodies abbreviated):
AdminService/CreateQueue {"name","config":{}}
AdminService/DeleteQueue {"name","force?"}
AdminService/ListQueues {}
AdminService/Subscribe {"topic","name","filter?","ttl_ms?"}
AdminService/TestFilter {"expr","message?"}
AdminService/ListSubscriptionsPage {"topic?","after?","limit?","include_deleting?"}
AdminService/DeleteSubscription {"topic","name","force?"}
QueueService/Send {"queue","messages":[{"body":"<base64>",
"message_id?","group_id?"}]}
QueueService/Receive {"queue","max_messages","wait_time_ms"}
QueueService/Complete {"queue","seq_number","lock_token"}
QueueService/Abandon {"queue","seq_number","lock_token","delay_ms?"}
QueueService/Reject {"queue","seq_number","lock_token"}
QueueService/Renew {"queue","seq_number","lock_token"}
QueueService/Stats {"queue"}
AuthService/CreateKey {"id","name","permissions":["send"],"expires_at_ms?"}
AuthService/ListKeys {"after_id?","limit?","sort?"}
AuthService/RevokeKey {"id"}
For CreateKey: retain a unique 32-lowercase-hex id BEFORE the call. Token is
returned once. On an uncertain result, list/revoke that id before replacing;
a repeated id returns key_conflict and never returns the secret again.
For ListKeys: sort defaults to id_asc. Use created_desc for newest first,
keep the same sort on every page, and pass next_after_id back as after_id.
API reference: https://mqlitehq.github.io/api.html
For a released broker, use the reference for its installed version rather than
assuming unreleased main behavior is already available.
lock_lost, never a success that quietly
kept the first call's effect. A live receipt can replay a committed settlement
after its original lease expires; it cannot authorize a new effect or revive
the lease. So a confused agent fails loud, not wrong.Machine-readable entry points on this documentation site; the full bundle is generated from source docs.
| File | Contents |
|---|---|
llms.txt | one-page summary: what mqlite is, the key facts, where everything lives |
llms-full.txt | the full docs bundle as plain markdown: concepts + internals + HTTP API + CLI + access keys + MCP + examples + operations + deployment + observability + cloud monitoring |
GET / on any broker | live discovery card: name, version, auth mode, every endpoint path |
For broker administration, start with Operations, use Deployment for configuration, and follow Observability for monitoring and alerts or Cloud monitoring to reuse an existing collector and Grafana.
message_id or your own
idempotency keys, and settle promptly. Everything else follows from
the concepts page.