SpaceMIX v0.1.0 (latest)

MCP connections

experimentalfor bothsince protocol 1

Remote MCP servers a whole SpaceMIX server connects to in Settings → MCP connections: who may add and use them (server:settings, mcp:*, mcp:<id>), sign-in with headers or OAuth 2.1, how their tools are named, gated and offered to the assistant, the server-side assistant and /api/v1/tools, the address checks on hosted servers, what clients never see, and the limits.

An MCP connection is a remote MCP server (Streamable HTTP transport) that a SpaceMIX server is connected to for everyone on it. Someone with the server:settings permission adds it in Settings → MCP connections, once; every person allowed to use it then gets its tools in their chats, with no extension involved. Use it for a service that already speaks MCP (a CRM, a ticket tracker, your own service) when you want its tools without building an extension around it.

It is server surface, not part of the extension contract: extensions can't add, list or call connections. The code is in apps/desktop/src-tauri/src/mcp.rs (connections, the MCP client, the tools) and mcp_oauth.rs (OAuth); the app side is apps/desktop/src/lib/mcpConnections.ts and apps/desktop/src/shell/McpSettings.tsx.

Connections and extension MCP servers

MCP connection An extension's MCP servers (MCP)
Set up by A person with server:settings, in Settings → MCP connections The extension's mcp(host), from its own settings
Requests made by The SpaceMIX server (Rust), so no CORS is needed The app's webview (apps/desktop/src/lib/mcp.ts), so the MCP server must allow CORS
Credentials Kept on the server, never sent to a client Wherever the extension keeps them (host.storage)
Tool names <connection id>_<tool> <ns>_<tool>
Who gets the tools People with mcp:<id> or mcp:* People who may use the extension (extension:<id> or extension:*)
Read-only Only the tools an admin ticked (readOnlyTools) Tools annotated readOnlyHint: true (mcpToolNeedsApproval)
In GET /api/v1/tools Listed and run on the server Not listed; run by name, relayed to an open client
In host.tools and widgets No Yes

Who may do what

Permission Lets the person
server:settings Add, edit, turn on and off, test and delete connections, connect and disconnect their OAuth sign-in, and see each connection's whole address. Change which connections run without asking (Settings → Extensions → Approvals).
mcp:* Use the tools of every connection, including ones added later.
mcp:<id> Use the tools of the connection with that id.

The permissions are granted like extension:* and extension:<id>, directly or through groups in Settings → Permissions (see Who can use an extension; the checks are in apps/desktop/src-tauri/src/auth.rs). The owner has mcp:*. The seeded Members group has mcp:*; on a server whose Members group existed before MCP connections, mcp:* is added to it once at startup, so members can use connections the way they use extensions until someone narrows it.

Someone without server:settings sees, in Settings → MCP connections, only the connections they may use, read-only, and only each one's origin (https://mcp.example.com, not the path or query, which may hold a key). Someone who may use none sees none.

Adding a connection

In Settings → MCP connections, Add:

Field What it does
Name 1 to 80 characters, one line. Shown in Settings, approval prompts and notices.
ID [a-z][a-z0-9_]{0,23}: lowercase letters, digits and _, starting with a letter, at most 24. The prefix of every tool name and the <id> in mcp:<id>. Made from the name when left empty (GitHub Issues → github_issues; a taken one gets _2, _3). Can't be changed later.
URL The Streamable HTTP endpoint, http:// or https://, at most 2048 characters, without a user name or password in it (add those as headers). A #fragment is dropped.
Sign-in None, Headers or OAuth (below).

An ID is refused when an installed extension's tools could be named like the connection's: when the ID is an extension's namespace (An installed extension's tools start with <id>_ already; pick another id.), when an extension's namespace starts with <id>_, or when the ID starts with an extension's namespace and _. An id made from the name skips those. A member's build reserves nothing: a connection may take its namespace, and the build loses the clash.

A new connection is on. The switch on its row turns it off: a connection that is off offers no tools and runs none (The <name> MCP connection is turned off.).

Test and pick tools (in the row's menu) lists the server's tools afresh and records the result on the row (the tool count, or the error). In that list:

  • Use: untick a tool to keep it from the assistant. Unticked tools are saved as the connection's exclude list.
  • Read-only: tick the tools that only read. Only these count as read-only (see Approval and read-only). Until the list has been saved once, the tools the MCP server annotates readOnlyHint: true are pre-ticked as a suggestion; nothing counts until it is saved.

Delete removes the connection, its saved header values and its sign-in at once, and takes it off the auto-approved list, so a connection made later with the same id asks again.

Sign-in

None and Headers

Headers sends fixed headers with every request, for example Authorization: Bearer <key> or X-Api-Key. At most 20 headers; a name of at most 100 characters that is an HTTP token, a value of at most 8192 characters without control characters. SpaceMIX sets these headers itself and refuses them: Accept, Connection, Content-Length, Content-Type, Host, Keep-Alive, MCP-Protocol-Version, Mcp-Session-Id, Proxy-Authorization, Proxy-Connection, TE, Trailer, Transfer-Encoding, Upgrade (SpaceMIX sets the <name> header itself.).

Values are kept on the server and never shown again; the app only gets the header names. Editing a connection keeps a saved value unless you type a new one or remove the header.

OAuth

OAuth signs the connection in on the provider's own page, as the MCP authorization spec describes (mcp_oauth.rs). Save the connection first, then press Connect in its sign-in section.

  1. SpaceMIX calls the MCP server; its 401 names the protected resource metadata (WWW-Authenticate: Bearer resource_metadata="…", RFC 9728), else the well-known addresses are tried. That names the authorization server, whose metadata (RFC 8414, else OpenID discovery) gives the endpoints. A server with neither is taken to be its own authorization server at /authorize, /token and /register.
  2. When the authorization server has a registration endpoint, SpaceMIX registers itself as a client (RFC 7591), once per connection and redirect address. Otherwise it uses the client entered under Advanced: Client ID and an optional Client secret, for servers whose admin made a client for SpaceMIX.
  3. The browser goes to the provider with PKCE (S256) and the resource parameter (RFC 8707). An authorization server that doesn't offer S256 is refused: The sign-in server doesn't support PKCE with S256, which SpaceMIX needs.
  4. The provider sends the browser back to <server address>/api/mcp/oauth/callback. In the desktop window that is http://127.0.0.1:<port>/api/mcp/oauth/callback (port 1421 unless SPACEMIX_API_PORT says otherwise); in a browser it is the address that window reaches the server at. Register that address as the redirect URI of a manual client.
  5. The server exchanges the code and keeps the tokens with the connection's secrets. The sign-in must come back within 10 minutes, once, and the person who started it must still have server:settings; else This sign-in has expired or was already used. Start it again from Settings → MCP connections.

Scope (optional, space-separated) is what to ask for; left empty, SpaceMIX asks for what the server suggests.

The tokens are the connection's, used for everyone allowed to use it, not per person. The connection shows who connected it, plus the provider's account when its id_token names one. A token about to run out (within 60 seconds) is refreshed before a request, and once more when the MCP server answers 401. A refresh the provider refuses disconnects the connection: The sign-in for the <name> MCP connection has run out; connect it again in Settings → MCP connections. Disconnect forgets the tokens.

Changing the address

  • Another path on the same origin drops the sign-in and the registered client; header values and a manual client secret stay.
  • Another origin also drops the header values and the manual client secret (the client ID stays), so credentials meant for one server never go to another. Enter them again in the same save.
  • Changing Sign-in away from OAuth drops the tokens.

Tools

Each tool is offered as <connection id>_<tool>, with anything outside A-Z a-z 0-9 _ - replaced by _ and the name cut to 64 characters (github + create_issue → github_create_issue).

They are offered, for the connections that are on and that the person may use:

  • to the assistant in the app's chats, CLI agent chats included (connectionTools in apps/desktop/src/lib/tools.ts, called from apps/desktop/src/lib/chats.ts). Each connection is one tool group, listed in the chat's catalogue by its id and loaded on demand: a model call carries a connection's tools once the chat has loaded it (with tools_load, or by calling one of its tools), after SpaceMIX's own tools, in the order the groups were loaded, each group's tools sorted by name. See How the assistant gets its tools;
  • to the server-side assistant of the SpaceMIX API, by the key's scope: on demand in the same way for an OpenAI-compatible model; a CLI agent on the server gets every tool, plus tool_result_read;
  • in GET /api/v1/tools and POST /api/v1/tools/<name> (SpaceMIX API), with kind: "mcp" and connectionId.

They are not offered to extensions through host.tools or to widgets.

A connection's tool is left out, with a notice in the chat, when:

  • its name is taken by one of SpaceMIX's own tools, an extension's tool (not a member's build's, which comes after the connections) or an earlier connection's tool. Clashes are still settled in connection order, whichever groups a chat has loaded, so the same tool wins every turn;
  • its name is under the namespace of an extension that may have MCP tools (an extension with a net: permission, turned on, that the person may use, and not a member's build): <ns>_… stays that extension's MCP tool;
  • its inputSchema is over 64 KB as JSON;
  • the connection can't be listed (Couldn't list the tools of the <name> MCP connection: <error>); the other tools still work.

What the MCP server says is untrusted text that goes into the model's prompt. Titles and descriptions lose control, zero-width and bidi characters; a title is one line of at most 120 characters, a description at most 1,000; a tool with neither gets its name in words. Arguments go to the MCP server as the model sent them, checked only to be an object (Arguments must be an object.), not against the schema. A result is the call's structuredContent, else its text joined (parsed as JSON when it is), cut at 256 KB with a note; isError comes back as an error.

Approval and read-only

A connection's tool is read-only only if someone with server:settings ticked it in Test and pick tools (readOnlyTools). The MCP server's readOnlyHint and the tool's name don't decide, unlike an extension's MCP tools.

Where A ticked read-only tool Any other tool
The app's chat Runs without asking Asks first, unless the connection is switched to run without asking in Settings → Extensions → Approvals
/api/v1/tools/<name> Needs tools:read Needs tools:write; nobody is asked
The server-side assistant Offered with tools:read Offered only with tools:write; nobody is asked

Settings → Extensions → Approvals lists the connections; turning one's switch off lets its tools run without asking. That list is server-wide, in the kv key shell/autoApproveMcp (connection ids), and only server:settings may change it: anyone else's write is refused with Only people who may change server settings can change which MCP connections run without asking. (check_kv_write in apps/desktop/src-tauri/src/server.rs).

Where requests go

Every request to a connection is made by the SpaceMIX server: initialize, then notifications/initialized, protocol 2025-06-18, with the Mcp-Session-Id the server hands out sent back. A 404 on that session, or a "not initialized" error, initializes again once. Answers may be JSON or SSE. Redirects are refused, since they would carry the credentials elsewhere.

On a hosted server, no request goes to a private or local address: loopback, private ranges (RFC 1918, fc00::/7), link-local (169.254.0.0/16, fe80::/10), CGNAT (100.64.0.0/10), unspecified, multicast, broadcast or reserved, IPv4 written as IPv6 included. Each request resolves the host, checks every address and pins the connection to them, and the same goes for every address the OAuth metadata names. A refused address answers <origin> is a private or local address (<ip>). A hosted SpaceMIX server only connects to addresses on the internet. Adding or editing a connection checks its address up front.

Variable Default What it does
SPACEMIX_HOSTED unset 1, true, yes or on: the server is hosted. 0, false, no or off: it isn't, even on Railway. Unset: hosted when Railway's RAILWAY_ENVIRONMENT, RAILWAY_PROJECT_ID or RAILWAY_SERVICE_ID is set.
SPACEMIX_MCP_ALLOW_PRIVATE unset 1, true, yes or on: a hosted server may reach private and local addresses too.

A server that isn't hosted (the desktop app, a self-hosted server) may reach any address, http://localhost:3000/mcp included.

What stays on the server

Header values, the manual client secret, the registered client and the OAuth tokens are kept in a private kv namespace (_mcp_secrets) that no kv call reaches; the owner's Database view shows those rows without values. The connections themselves are in the private namespace _mcp and change only through the operations below. What a client gets of a connection:

Field What it is
id, name, enabled, createdAt, updatedAt As set; times in milliseconds.
url The whole address for server:settings, else its origin.
auth "none", "headers" or "oauth".
headerNames The header names, never their values.
oauth { connected, account?, connectedAt?, expiresAt?, scope?, clientId?, manualClient, hasClientSecret }: whether it is signed in, by whom, and whether a manual client (and a secret for it) is saved; never a token or the secret.
scope The OAuth scope to ask for, when set.
include, exclude, readOnlyTools The tool lists, by the MCP server's tool names.
status The last listing: { ok, message?, toolCount?, checkedAt }. The message names only the address's origin.

The app reaches the operations over Tauri IPC (mcp_call) in the desktop window and POST /api/mcp/<op> with a session in a browser: list, create, update, delete, test, tools, call, oauth-start and oauth-disconnect. They are the app's routes, not the SpaceMIX API: an API key can't reach them. Each change is announced on the change feed as namespace mcp, key connections, with no data in it.

Limits

What Limit
Connections per server 50
ID / name / URL 24 / 80 / 2048 characters
Headers 20; name 100 characters, value 8192
include, exclude, readOnlyTools 500 names each, 200 characters per name
OAuth scope / client ID / client secret 1000 / 500 / 2000 characters
Tools listed per connection 1000, over at most 50 pages
Tool name / title / description 64 / 120 / 1,000 characters
Tool input schema 64 KB, else the tool is left out
A request 15 seconds to connect, 60 seconds in all
An answer 8 MB
A result, as the model gets it 256 KB, then cut with a note
An error text from the server 300 characters
Tool list cache 5 minutes per connection; a failed listing 30 seconds; dropped on every change to the connection
OAuth sign-in 10 minutes to come back, once

Stability

Experimental: new, and not yet exercised against many MCP servers. The permissions, the tool names and the read-only rule are expected to stay; the limits and the Settings layout may change.

This page as markdown · All pages as one file