MCP server

Introduction

The MCP server is https://swarmvia.com/mcp. How to add that URL in Cursor, Claude, or another client is on Agents. After you approve the grant, the assistant can list sources, query a PostgreSQL or MySQL source, and start an HTTP session on an API source. It never receives the database password.

MCP never admits traffic on the proxy, and access keys never call MCP tools. They are separate credentials with separate jobs.

Agent sessions

Every key an assistant gets belongs to an agent session: one task, with a purpose, across every source the task touches. Before a task, the assistant calls start_session with its purpose in one sentence and gets a session_id (ses_…). It passes session_id to start_source_session, the query tools and the MCP source tools for the rest of the task, and calls end_session when the task is done.

Without session_id, a call joins the assistant's current session, the newest one it used in the last 30 minutes. When there is none, start_source_session, the request tools, and the query and MCP source tools (source_read_request, source_request, source_schema, source_count_rows, source_query, source_list_tools, source_call_read_tool, source_call_tool) refuse the call and ask for a purpose, which starts a session. Passing the same purpose again stays in that session. You see each session's calls on every source under Sessions, and can revoke all of its keys at once.

Session keys

When an assistant needs to query a database source, it uses source_schema, source_count_rows, source_query, and get_query_result. It never receives the password.

When an assistant needs to call an HTTPS origin, it starts a session. start_source_session returns the source's endpoint, a session key, and its expires_at. The key is a short-lived access token signed by swarmvia (sv_at_…). The assistant sends requests to that endpoint with the key in X-Swarmvia-Key, keeping the path and query it would have used against the origin.

An assistant that cannot send HTTP itself, such as Claude or ChatGPT in a chat, uses source_read_request for reads and source_request for writes instead. swarmvia sends the request through the source with a key it holds for that agent and returns the origin's status, headers and body. The same policy, groups and limits apply.

Session keys are read-only by default. start_source_session returns allowed / allowed_text: the calls that key can make under the source's policy, one rule per line (GET HEAD OPTIONS /**). list_sources returns the same fields for a read-only key under the default source policy, so the assistant sees them even when the source description does not mention them. Anything else is refused with 403 before the request leaves our edge. If the work genuinely writes, set that source to Chosen calls or Everything I can do when you approve the grant, or later under Settings → Connected agents. get_source_policy returns can_call, what the assistant's keys can call on a source, so it can check before it plans a write. The assistant cannot grant itself more than you approved.

Keys default to a one-hour life. expires_in accepts 1h, 24h, or 7d; there is no key that never expires. The assistant reuses a key until it expires and does not need to end the session when the work finishes. It calls revoke_session with the key's session_key_id only if the key leaked, for example into a file or a log.

Scripts and CI that call a source without MCP do not use session keys. They mint their own keys with a Control API token; see Refresh access tokens before they expire.

When a key expires, requests return 401 with access token expired. The assistant starts a new session for a fresh key. It does not need to ask you again: the grant you approved still covers the source.

On a managed source, the assistant never receives your origin's credential. It goes to the source's endpoint with the session key, and the upstream credential is added at our edge.

On a pass-through source there is nothing to hide. The caller supplies the upstream credential itself, so assistants working with pass-through sources still need it.

Tools

This section lists every tool the swarmvia MCP server has, except the work board's, which are on Work: MCP tools and appear when you tick Track issues, memories and handoffs. An assistant sees only the tools its grant allows: the tables below say which tick or source each one needs.

Tool What it does
list_sources Call this when looking up an app, API, warehouse, or MCP server before adding another client for that app. Returns the sources this connector may use, each labeled with its backend (mcp, http, postgres, or mysql), plus purpose, groups, budget names, and concurrency. Optional group lists one group's sources; optional query keeps those whose name, purpose, aliases or upstream host match.
list_groups Groups that sort this connector's sources by purpose, with each group's description and sources. Each source is labeled with its backend. Sources in no group are listed too. Listed only when the organization has groups.
create_source Admit an https origin, or an MCP server by its URL (mcp_url). Reuses a source that already fronts that host or server. Listed only when you tick This agent may create sources. Never takes a secret.
adopt_connection Prepare managed auth and return a one-shot intake. Listed only when you tick This agent may move origin keys onto sources. Never takes a secret. The assistant POSTs the project's env key to intake_url, or gives you dashboard_url. Not for MCP sources, which own their credential: use connect_source.
start_session Start an agent session for a task, with its purpose and, with Track issues, memories and handoffs, the issue_id it is for. Returns session_id.
end_session End a session when its task is done. It takes no new keys; keys it holds work until they expire.
list_sessions Agent sessions, newest first: purpose, status, whether an open one is idle, the agent that held it, the member it acted for, its issue, and its calls on the sources this agent may use. scope is agent (the default, this agent's own), mine (every agent and API token of the member who connected it) or organization (every session, with This agent may oversee agent sessions). Optional status (open, idle, ended, revoked); pass cursor for older sessions.
show_session One session list_sessions can reach: its calls per source, the source keys minted in it (session_key_id, expires_at, whether each still works), and the lines its agent recorded with record_activity.
record_activity Add one line to the session's timeline for work done outside swarmvia (GitHub, a shell): system, action, and optionally outcome (done, failed, skipped), url and occurred_at. Shown marked as reported.
start_source_session The source's endpoint, a short-lived session key (sv_at_…), and its expires_at. expires_in is 1h (default), 24h, or 7d. session_id puts the key in that agent session; purpose starts one (or stays in the current one with the same purpose). One of them is required unless the assistant has a session active in the last 30 minutes.
source_read_request Send a read to an API source for an assistant that cannot send HTTP itself: method (GET, HEAD, OPTIONS, or a POST the source counts as a read), path, optional query, headers and body. Returns the origin's status, its useful headers, and the body (cut at 50,000 characters; binary bodies are not shown). Uses a read-only key, so anything else is refused. Listed on a session grant that reaches an API source.
source_request The same for a write (POST, PUT, PATCH, DELETE), with a json or text body. Uses the most this agent may hold on the source, so a write goes only where the source's policy and the agent's own limits allow.
revoke_session With session_id: stops a session now: it takes no new keys, every key it holds stops working on every source, and the issues it holds go back to ready. With session_key_id instead: revokes that one key, for a key that leaked, and the session keeps running. Keys expire on their own, so this is not routine cleanup. This agent's own sessions and keys, or any connected agent's with This agent may oversee agent sessions. Never a Control API token's session, or a key made on the dashboard or with an API token.
get_source_usage Requests, admitted share, and queue wait
get_source_policy An API source's policy: the calls it accepts, and can_call, what this agent's own keys can call
set_source_policy Replace an API source's default source policy. Listed only when an owner or admin ticks This agent may change source policies, and only while they stay an owner or admin
set_source_access_rules Replace the extra calls a group gets on an API source. Listed under the same tick. An agent cannot change its own limits
search_source_logs A granted source's access-log entries, newest first, the same as its Logs tab: status, outcome, timing, caller IP, key or member, and the statement of a database query. Filters by time (from, to), outcome, status, request_kind, cache, agent session (session_id), and text (q). Pass cursor for older entries. Listed only when an owner or admin ticks This agent may read access logs, and only while they stay an owner or admin.
list_webhooks Destinations in this organization. No signing secrets. Listed only when an owner or admin ticks This agent may manage webhooks, and only while they stay an owner or admin.
create_webhook Create an https destination. Returns the signing secret once (whsec_…). Optional source_id attaches it and turns async on if that source is still sync. Listed under the same tick.
rotate_webhook Issue a destination a new signing secret, returned once. expire_previous_in (seconds, up to 604800) keeps the old one signing that long; without it the old one stops at once. Listed under the same tick.
set_source_webhooks Replace the destinations attached to a granted source. Empty list detaches all. Turns async on when at least one destination is attached. Listed under the same tick.
connect_source Whether a source can reach its upstream for you, and the link to fix it when it cannot: connect an account, reconnect, or add a token. Listed on a session grant that reaches a managed source.

Database sources add these when the grant covers one:

Tool What it does
source_schema Tables and columns
source_count_rows How many rows a table (or filter) has
source_query Run a read-only query. Slow queries can return a handle instead of rows.
get_query_result Page a query that returned a handle

On an MCP source, the server's tools are not added to the assistant's tool list. They are found and run through three tools, so the list stays the same size however many servers your sources front:

Tool What it does
source_list_tools Find the server's tools this connector may use. With source_id, one source's tools; without it, a search of every MCP source the connector can use. query keeps tools whose name or description contains every word. Marks which are read-only, and gives input schemas on request (include_schemas, optionally for named tools).
source_call_read_tool Run a tool the server marks read-only. Uses a read-only key, so any other tool is refused. Takes a slot until the server answers.
source_call_tool Run any other tool the connector may use. Takes a slot until the server answers.

All of these appear only on a session grant that reaches an MCP source. Which tools a connector may call is the source’s tool list, grouped into read and write on the source page. Checking a tool lets the connector call it, read or write. A read-only access key still calls only the checked tools the server marks read-only. Groups still decide which sources the connector can see. Changing the list does not require reconnecting the connector.

The webhook tools are listed only when an owner or admin ticks This agent may manage webhooks on the grant screen, and stop working if that person is no longer an owner or admin. Access keys cannot call these tools.

Store the signing secret on the receiver when create_webhook returns it. It is shown once. Do not ask the user to paste an origin secret.

Connectors with Track issues, memories and handoffs also get the Work tools: issues, memories, handoffs and questions for you.

The source tools (start_source_session, the query tools, and an MCP source's tools) take an optional session_id. Without it, the call joins the assistant's current session.

Assistants only see the tools their grant allows.

There is also a use_source prompt, which writes the few lines to add to a repo's AGENTS.md or CLAUDE.md so later sessions skip discovery. Ask for it once per project and commit the result. The migrate_mcp prompt moves the MCP servers in a harness config into MCP sources, one at a time, following Migrating MCP servers into swarmvia.

Related