Mcp management API
This page documents the 41 gateway endpoints tagged mcp_management in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| GET | /v1/mcp/access_groups | List MCP access group names |
| GET | /v1/mcp/discover | Browse the MCP catalogue |
| POST | /v1/mcp/make_public | Publish servers on the AI hub |
| GET | /v1/mcp/network/client-ip | Show your IP address as the gateway sees it |
| GET | /v1/mcp/openapi-registry | Browse well-known OpenAPI APIs |
| GET | /v1/mcp/registry.json | Read the public MCP registry |
| GET | /v1/mcp/server | List MCP servers |
| POST | /v1/mcp/server | Add an MCP server |
| PUT | /v1/mcp/server | Update an MCP server |
| GET | /v1/mcp/server/health | Check MCP server health |
| POST | /v1/mcp/server/import | Import MCP servers from a client config |
| POST | /v1/mcp/server/oauth/session | Stage a server for an OAuth test |
| POST | /v1/mcp/server/register | Submit an MCP server for admin review |
| GET | /v1/mcp/server/submissions | List MCP servers submitted for review |
| GET | /v1/mcp/server/{server_id} | Read one MCP server |
| DELETE | /v1/mcp/server/{server_id} | Delete an MCP server |
| PUT | /v1/mcp/server/{server_id}/approve | Approve a submitted MCP server |
| POST | /v1/mcp/server/{server_id}/oauth-user-credential | Save your own OAuth token for an MCP server |
| DELETE | /v1/mcp/server/{server_id}/oauth-user-credential | Remove a stored OAuth token |
| GET | /v1/mcp/server/{server_id}/oauth-user-credential/status | Check your OAuth connection to an MCP server |
| POST | /v1/mcp/server/{server_id}/pin | Pin a server's tool catalogue |
| DELETE | /v1/mcp/server/{server_id}/pin | Unpin a server's tool catalogue |
| PUT | /v1/mcp/server/{server_id}/reject | Reject a submitted MCP server |
| GET | /v1/mcp/server/{server_id}/tool-policy | Read a catalogue server's tool policy |
| PUT | /v1/mcp/server/{server_id}/tool-policy | Turn write tools on for a catalogue server |
| POST | /v1/mcp/server/{server_id}/user-credential | Save your own API key for an MCP server |
| DELETE | /v1/mcp/server/{server_id}/user-credential | Remove a stored personal API key |
| GET | /v1/mcp/server/{server_id}/user-credentials | List who has connected to an MCP server |
| GET | /v1/mcp/server/{server_id}/user-env-vars | Check your settings for an MCP server |
| POST | /v1/mcp/server/{server_id}/user-env-vars | Save your settings for an MCP server |
| DELETE | /v1/mcp/server/{server_id}/user-env-vars | Clear your settings for an MCP server |
| GET | /v1/mcp/sessions | List live MCP gateway sessions |
| DELETE | /v1/mcp/sessions | Close live MCP gateway sessions |
| GET | /v1/mcp/tools | List the MCP tools your key can use |
| GET | /v1/mcp/toolset | List toolsets |
| POST | /v1/mcp/toolset | Create a toolset |
| PUT | /v1/mcp/toolset | Update a toolset |
| GET | /v1/mcp/toolset/{toolset_id} | Get a toolset |
| DELETE | /v1/mcp/toolset/{toolset_id} | Delete a toolset |
| GET | /v1/mcp/user-credentials | List your MCP connections |
| GET | /v1/mcp/user-env-vars/status | Check your settings across MCP servers |
Endpoints
GET /v1/mcp/access_groups
List MCP access group names
Lists the names of every MCP access group defined on MCP servers in the config file and the database, sorted. Use the names when you grant a key or team a group instead of single servers. Any virtual key or Admin UI session may call it. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/access_groups" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The access group names | application/json MCPAccessGroupsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
access_groups | array of string | Yes | Every MCP access group name, sorted |
GET /v1/mcp/discover
Browse the MCP catalogue
Returns the catalogue of well-known MCP server templates that can be added to the gateway in a few clicks, filtered by a query on names and descriptions, by category, or by url, which keeps only the templates that serve that server address. Each template carries a trust_tier: verified when the service's own vendor publishes the server and Spanway checked it, unverified otherwise, and the publisher that maintains it. The Admin UI shows the list on the Add server page and uses url to suggest a template when an admin types a custom address. Proxy admins and admin viewers only. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
query | query | string or null | No | Search filter for server names and descriptions |
category | query | string or null | No | Filter by category |
url | query | string or null | No | Keep only the templates that serve this MCP server address |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/discover" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The matching catalogue entries | application/json MCPDiscoverResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is neither a proxy admin nor an admin viewer key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
categories | array of string | Yes | Every category in the catalogue, sorted |
servers | array of CatalogConnector | Yes | The catalogue entries that match the filters |
POST /v1/mcp/make_public
Publish servers on the AI hub
Publish the named servers on the AI hub, where GET /public/mcp_hub lists them. Signed-in users always see the list, and anyone without a key sees it only while enable_public_model_hub is on. Listing a server does not open it to public addresses, a server with available_on_public_internet: false stays reachable from internal addresses only. The list replaces the previous one, is saved to the config and is written to the audit log. Proxy admins only.
Request body (application/json, schema MakeMCPServersPublicRequest):
| Field | Type | Required | Description |
|---|---|---|---|
mcp_server_ids | array of string | Yes | Mcp Server Ids |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/make_public" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mcp_server_ids": [
"8f1c2d3e-4b5a-4c6d-9e7f-0a1b2c3d4e5f"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 202 | The servers now public | application/json MakeMCPServersPublicResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key passed the route check but is not a proxy admin key | application/json ErrorDetail |
| 404 | A listed id matches no server | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The config could not be saved | application/json ErrorDetail |
GET /v1/mcp/network/client-ip
Show your IP address as the gateway sees it
Returns the caller's IP address as the gateway sees it, after any trusted proxy headers. Use it to check which address an IP allow list or the public MCP registry filter will match. Any virtual key or Admin UI session may call it. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/network/client-ip" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The caller's address | application/json MCPClientIPResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
ip | string or null | Yes | The caller's IP address as the gateway sees it |
GET /v1/mcp/openapi-registry
Browse well-known OpenAPI APIs
Returns well-known public APIs, with their OpenAPI document and OAuth 2.0 endpoints, that can be turned into an MCP server from their OpenAPI spec. The Admin UI uses it in the OpenAPI server picker. Proxy admins and admin viewers only. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/openapi-registry" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The APIs | application/json OpenAPIRegistryResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
apis | array of OpenAPIRegistryEntry | Yes | APIs that can be added as OpenAPI MCP servers |
GET /v1/mcp/registry.json
Read the public MCP registry
Lists the gateway's own MCP endpoint and every MCP server published for the caller's network, in the MCP registry format that MCP clients use to discover servers. No key is needed. Callers from outside your network see only servers marked as available on the public internet. The route answers 404 until the public registry is turned on in the settings. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/registry.json"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The registry | application/json MCPRegistryResponse |
| 404 | The public registry is turned off | application/json ErrorDetail |
| 429 | One address sent more requests to the public pages this minute than the gateway allows. Wait the number of seconds in Retry-After and try again | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
servers | array of MCPRegistryServer | Yes | The gateway itself first, then each public server |
GET /v1/mcp/server
List MCP servers
Lists the MCP servers the caller may see, with the teams each one is shared with. Proxy admins see every server, other users and keys see only the servers they can reach, without their credentials. Pass team_id to list the servers one team can use (members of that team and proxy admins only) and connected_app_view to mark servers a connected app of yours can reach. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
team_id | query | string or null | No | Filter MCP servers by team scope. When provided, returns only servers the team has access to plus globally available (allow_all_keys) servers. Used by the Create Key UI to show team-scoped MCP servers. |
connected_app_view | query | boolean | No | Annotate each returned server with connected_app_reachable: whether a connected app authorized by the calling user (a gateway OAuth session) is served this server on the aggregate MCP endpoint. |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The servers the caller may see | application/json array of Spanway_MCPServerTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller may not list another team's servers | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
POST /v1/mcp/server
Add an MCP server
Adds an MCP server to the gateway so keys, teams and agents can use its tools through one governed endpoint. Send its URL and transport (or a local command for stdio), how the gateway should authenticate to it, and who may use it. Credentials are stored encrypted and never returned. Proxy admins only. The new server is recorded in the audit log. A reserved or taken id, name or alias answers 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No | The spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability |
Request body (application/json, schema NewMCPServerRequest):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string or null | No | Allowed Tools |
approval_status | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
catalog_entry | string or null | No | Catalog Entry |
command | string or null | No | Command |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string or null | No | Extra Headers |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
issuer | string or null | No | Issuer |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
registration_url | string or null | No | Registration Url |
rpm | integer or null | No | Rpm |
server_id | string or null | No | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
subject_token_type | string or null | No | Subject Token Type |
submitted_at | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
submitted_by | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | No | Transport |
url | string or null | No | Url |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"alias": "issue_tracker",
"allowed_tools": [
"search_issues",
"get_issue"
],
"auth_type": "bearer_token",
"credentials": {
"auth_value": "sk-example-upstream-token"
},
"description": "Issue tracker for the product team",
"mcp_access_groups": [
"engineering-tools"
],
"server_name": "issue_tracker",
"transport": "http",
"url": "https://mcp.example.com/mcp"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 201 | The new server, credentials left out | application/json Spanway_MCPServerTable |
| 400 | The id, name or alias is reserved or already used, or catalog_entry names no catalogue connector | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected, or saving the server failed | application/json ErrorDetail |
PUT /v1/mcp/server
Update an MCP server
Changes an MCP server's settings. A field left out keeps its stored value and a field sent as null is cleared. Masked secrets sent back unchanged keep the stored secret, but changing the server's URL or destination requires sending its secrets again. Keys and agents see the change on their next request. Proxy admins only, and the change is recorded in the audit log with the values before and after.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No | The spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability |
Request body (application/json, schema UpdateMCPServerRequest):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string or null | No | Allowed Tools |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
command | string or null | No | Command |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string or null | No | Extra Headers |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
issuer | string or null | No | Issuer |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
registration_url | string or null | No | Registration Url |
rpm | integer or null | No | Rpm |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
subject_token_type | string or null | No | Subject Token Type |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | No | Transport |
url | string or null | No | Url |
Example request:
curl -X PUT "http://localhost:4000/v1/mcp/server" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"allowed_tools": [
"search_issues",
"get_issue",
"list_projects"
],
"description": "Issue tracker for product and support",
"server_id": "8f1c2d3e-4b5a-4c6d-9e7f-0a1b2c3d4e5f"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 202 | The server after the change | application/json Spanway_MCPServerTable |
| 400 | A field breaks a rule named in the detail, or catalog_entry names no catalogue connector | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
GET /v1/mcp/server/health
Check MCP server health
Runs a health check on the MCP servers the caller may use, or only on the server_ids you pass, and returns one status per server. reachable (the server answered but its authentication was not checked) appears only with include_reachability, otherwise it is reported as unknown. Any virtual key or Admin UI session may call it. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_ids | query | array of string or null | No | Server IDs to check. If not provided, checks all accessible servers. |
include_reachability | query | boolean | No | Allow the 'reachable' status for responding servers whose authentication is unchecked. |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server/health" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One status per server | application/json array of MCPServerHealth |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 422 | Validation Error | application/json HTTPValidationError |
POST /v1/mcp/server/import
Import MCP servers from a client config
Bulk-imports MCP servers from the mcpServers mapping that desktop and coding assistants keep in their config files, or from the mcp_servers array of the Anthropic Messages API. Each entry becomes a gateway MCP server, and the answer lists what was imported, skipped (for example a name already in use) and failed, so a partial import is visible. Proxy admins only.
Request body (application/json, schema MCPConnectorImportRequest):
| Field | Type | Required | Description |
|---|---|---|---|
mcp_servers | object or array of MCPConnectorEntry | Yes | A config file's mcpServers mapping by name, or a Messages API mcp_servers list |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server/import" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mcp_servers": {
"docs": {
"args": [
"-y",
"@example/docs-mcp@1.2.3"
],
"command": "npx"
},
"issue-tracker": {
"headers": {
"Authorization": "Bearer sk-example-upstream-token"
},
"type": "http",
"url": "https://mcp.example.com/mcp"
}
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | What was imported, skipped and failed | application/json MCPConnectorImportResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
errors | array of MCPConnectorImportFailure | Yes | Errors |
imported | array of MCPConnectorImportResult | Yes | Imported |
skipped | array of MCPConnectorImportSkipped | Yes | Skipped |
POST /v1/mcp/server/oauth/session
Stage a server for an OAuth test
Cache a server definition in memory for about five minutes without writing it to the database, so an OAuth flow can be run against it before it is saved. The Admin UI calls this from the server form. Proxy admins only.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No | The spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability |
Request body (application/json, schema NewMCPServerRequest):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string or null | No | Allowed Tools |
approval_status | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
catalog_entry | string or null | No | Catalog Entry |
command | string or null | No | Command |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string or null | No | Extra Headers |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
issuer | string or null | No | Issuer |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
registration_url | string or null | No | Registration Url |
rpm | integer or null | No | Rpm |
server_id | string or null | No | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
subject_token_type | string or null | No | Subject Token Type |
submitted_at | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
submitted_by | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | No | Transport |
url | string or null | No | Url |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server/oauth/session" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"alias": "issue_tracker",
"allowed_tools": [
"search_issues",
"get_issue"
],
"auth_type": "oauth2",
"credentials": {
"client_id": "example-client-id"
},
"description": "Issue tracker for the product team",
"mcp_access_groups": [
"engineering-tools"
],
"server_name": "issue_tracker",
"transport": "http",
"url": "https://mcp.example.com/mcp"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The staged server with its credentials masked | application/json Spanway_MCPServerTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | Staging the server failed | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string | No | Allowed Tools |
approval_status | string or null | No | Approval status: 'pending_review', 'active', 'rejected' |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
catalog_entry | string or null | No | Catalog Entry |
command | string or null | No | Command |
connected_app_reachable | boolean or null | No | Connected App Reachable |
created_at | string or null | No | Created At |
created_by | string or null | No | Created By |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
enabled_write_tools | array of string | No | Enabled Write Tools |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string | No | Extra Headers |
has_user_credential | boolean or null | No | Has User Credential |
health_check_error | string or null | No | Health Check Error |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
is_config | boolean | No | Whether this server is defined in config and is read-only. |
issuer | string or null | No | Issuer |
last_health_check | string or null | No | Last Health Check |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
pinned_tools | object or null | No | Pinned Tools |
registration_url | string or null | No | Registration Url |
review_notes | string or null | No | Review Notes |
reviewed_at | string or null | No | Reviewed At |
rpm | integer or null | No | Rpm |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
status | enum: "healthy", "reachable", "unhealthy", "unknown" or null | No | Health status: 'healthy', 'unhealthy', 'unknown', or 'reachable' (requires include_reachability=true; authentication and tools unchecked) |
subject_token_type | string or null | No | Subject Token Type |
submitted_at | string or null | No | Submitted At |
submitted_by | string or null | No | Submitted By |
teams | array of object | No | Teams |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | Yes | Transport |
updated_at | string or null | No | Updated At |
updated_by | string or null | No | Updated By |
url | string or null | No | Url |
POST /v1/mcp/server/register
Submit an MCP server for admin review
Lets a team member propose an MCP server without admin rights. The server is saved with approval status pending_review and stays unusable until a proxy admin approves it with PUT /v1/mcp/server/{server_id}/approve. Call it with a team key, proxy admins create servers with POST /v1/mcp/server instead and get 403 here. Local stdio servers cannot be submitted and answer 400, and so does a name or alias another server already uses.
Request body (application/json, schema NewMCPServerRequest):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string or null | No | Allowed Tools |
approval_status | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
catalog_entry | string or null | No | Catalog Entry |
command | string or null | No | Command |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string or null | No | Extra Headers |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
issuer | string or null | No | Issuer |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
registration_url | string or null | No | Registration Url |
rpm | integer or null | No | Rpm |
server_id | string or null | No | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
subject_token_type | string or null | No | Subject Token Type |
submitted_at | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
submitted_by | string or null | No | Server-managed: set by the endpoint; caller values are overridden. |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | No | Transport |
url | string or null | No | Url |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server/register" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"alias": "issue_tracker",
"allowed_tools": [
"search_issues",
"get_issue"
],
"auth_type": "bearer_token",
"credentials": {
"auth_value": "sk-example-upstream-token"
},
"description": "Issue tracker for the product team",
"mcp_access_groups": [
"engineering-tools"
],
"server_name": "issue_tracker",
"transport": "http",
"url": "https://mcp.example.com/mcp"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 201 | The submitted server, waiting for review | application/json Spanway_MCPServerTable |
| 400 | The key has no team, the server runs locally, or its name is taken | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | Proxy admins create servers directly | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected, or saving the server failed | application/json ErrorDetail |
GET /v1/mcp/server/submissions
List MCP servers submitted for review
The admin review queue: every MCP server team members submitted with POST /v1/mcp/server/register, with counts per approval status. Proxy admins and admin viewers only. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server/submissions" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The submissions and their counts | application/json MCPSubmissionsSummary |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
active | integer | Yes | Active |
items | array of Spanway_MCPServerTable | Yes | Items |
pending_review | integer | Yes | Pending Review |
rejected | integer | Yes | Rejected |
total | integer | Yes | Total |
GET /v1/mcp/server/{server_id}
Read one MCP server
Returns one MCP server with its current health status. Proxy admins see everything except secret values, other callers only see servers they can reach, without credentials. A server you cannot reach answers 404, the same as one that does not exist. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes | |
include_reachability | query | boolean | No | Allow the 'reachable' status for responding servers whose authentication is unchecked. |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server/server_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The server | application/json Spanway_MCPServerTable |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string | No | Allowed Tools |
approval_status | string or null | No | Approval status: 'pending_review', 'active', 'rejected' |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
catalog_entry | string or null | No | Catalog Entry |
command | string or null | No | Command |
connected_app_reachable | boolean or null | No | Connected App Reachable |
created_at | string or null | No | Created At |
created_by | string or null | No | Created By |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
enabled_write_tools | array of string | No | Enabled Write Tools |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string | No | Extra Headers |
has_user_credential | boolean or null | No | Has User Credential |
health_check_error | string or null | No | Health Check Error |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
is_config | boolean | No | Whether this server is defined in config and is read-only. |
issuer | string or null | No | Issuer |
last_health_check | string or null | No | Last Health Check |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
pinned_tools | object or null | No | Pinned Tools |
registration_url | string or null | No | Registration Url |
review_notes | string or null | No | Review Notes |
reviewed_at | string or null | No | Reviewed At |
rpm | integer or null | No | Rpm |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
status | enum: "healthy", "reachable", "unhealthy", "unknown" or null | No | Health status: 'healthy', 'unhealthy', 'unknown', or 'reachable' (requires include_reachability=true; authentication and tools unchecked) |
subject_token_type | string or null | No | Subject Token Type |
submitted_at | string or null | No | Submitted At |
submitted_by | string or null | No | Submitted By |
teams | array of object | No | Teams |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | Yes | Transport |
updated_at | string or null | No | Updated At |
updated_by | string or null | No | Updated By |
url | string or null | No | Url |
DELETE /v1/mcp/server/{server_id}
Delete an MCP server
Removes an MCP server from the gateway. Keys, teams and agents lose its tools on their next request, and the deletion is recorded in the audit log with the server as it was. Proxy admins only. The deletion cannot be undone. The answer is an empty 202.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes | |
spanway-changed-by | header | string or null | No | The spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability |
Example request:
curl -X DELETE "http://localhost:4000/v1/mcp/server/server_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 202 | The server was deleted | |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
PUT /v1/mcp/server/{server_id}/approve
Approve a submitted MCP server
Approves a server a team member submitted, or one rejected earlier: its approval status becomes active and keys with access can use it right away. Proxy admins only. A server that is already active answers 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X PUT "http://localhost:4000/v1/mcp/server/server_id-123/approve" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The approved server | application/json Spanway_MCPServerTable |
| 400 | The server is already active | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string | No | Allowed Tools |
approval_status | string or null | No | Approval status: 'pending_review', 'active', 'rejected' |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
catalog_entry | string or null | No | Catalog Entry |
command | string or null | No | Command |
connected_app_reachable | boolean or null | No | Connected App Reachable |
created_at | string or null | No | Created At |
created_by | string or null | No | Created By |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
enabled_write_tools | array of string | No | Enabled Write Tools |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string | No | Extra Headers |
has_user_credential | boolean or null | No | Has User Credential |
health_check_error | string or null | No | Health Check Error |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
is_config | boolean | No | Whether this server is defined in config and is read-only. |
issuer | string or null | No | Issuer |
last_health_check | string or null | No | Last Health Check |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
pinned_tools | object or null | No | Pinned Tools |
registration_url | string or null | No | Registration Url |
review_notes | string or null | No | Review Notes |
reviewed_at | string or null | No | Reviewed At |
rpm | integer or null | No | Rpm |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
status | enum: "healthy", "reachable", "unhealthy", "unknown" or null | No | Health status: 'healthy', 'unhealthy', 'unknown', or 'reachable' (requires include_reachability=true; authentication and tools unchecked) |
subject_token_type | string or null | No | Subject Token Type |
submitted_at | string or null | No | Submitted At |
submitted_by | string or null | No | Submitted By |
teams | array of object | No | Teams |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | Yes | Transport |
updated_at | string or null | No | Updated At |
updated_by | string or null | No | Updated By |
url | string or null | No | Url |
POST /v1/mcp/server/{server_id}/oauth-user-credential
Save your own OAuth token for an MCP server
Stores the OAuth access token (and refresh token) you obtained for an OpenAPI or OAuth MCP server, so its tools act as you. Tokens are stored encrypted and never returned. Any user may store their own token. When the server enforces OAuth identity binding, storing a token here answers 403 and you connect through the gateway's OAuth flow instead.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Request body (application/json, schema MCPOAuthUserCredentialRequest):
| Field | Type | Required | Description |
|---|---|---|---|
access_token | string | Yes | Access Token |
expires_in | integer or null | No | Expires In |
refresh_token | string or null | No | Refresh Token |
scopes | array of string or null | No | Scopes |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server/server_id-123/oauth-user-credential" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"access_token": "sk-example-oauth-access",
"expires_in": 3600,
"refresh_token": "sk-example-oauth-refresh",
"scopes": [
"read"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The stored token's status | application/json MCPOAuthUserCredentialStatus |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The server enforces OAuth identity binding, or the caller has no access to the server | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
connected_at | string or null | No | Connected At |
expires_at | string or null | No | Expires At |
has_credential | boolean | Yes | Has Credential |
is_expired | boolean | No | Is Expired |
server_id | string | Yes | Server Id |
DELETE /v1/mcp/server/{server_id}/oauth-user-credential
Remove a stored OAuth token
Revokes your stored OAuth token for an MCP server, so its tools stop acting as you until you connect again. A proxy admin may pass user_id to revoke another user's token. The answer reports has_credential false.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes | |
user_id | query | string or null | No |
Example request:
curl -X DELETE "http://localhost:4000/v1/mcp/server/server_id-123/oauth-user-credential" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The token is gone | application/json MCPOAuthUserCredentialStatus |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
connected_at | string or null | No | Connected At |
expires_at | string or null | No | Expires At |
has_credential | boolean | Yes | Has Credential |
is_expired | boolean | No | Is Expired |
server_id | string | Yes | Server Id |
GET /v1/mcp/server/{server_id}/oauth-user-credential/status
Check your OAuth connection to an MCP server
Tells you whether you have an OAuth token stored for this MCP server and when it expires, without returning the token. The Admin UI uses it to show a Connect or Reconnect button. Any user may check their own status. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server/server_id-123/oauth-user-credential/status" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Your connection status | application/json MCPOAuthUserCredentialStatus |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
connected_at | string or null | No | Connected At |
expires_at | string or null | No | Expires At |
has_credential | boolean | Yes | Has Credential |
is_expired | boolean | No | Is Expired |
server_id | string | Yes | Server Id |
POST /v1/mcp/server/{server_id}/pin
Pin a server's tool catalogue
Pin the server's current upstream tool list, descriptions and input schemas (admin only). tools/list serves the pinned catalog from now on and an upstream change raises an mcp_pinned_tools_changed alert. Use it to stop a third-party server from quietly changing what its tools say to your agents. A server with no tool that passes the guardrails answers 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Request body (application/json, object):
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server/server_id-123/pin" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The pinned tools by name | application/json object |
| 400 | No tool of the server passes the guardrails | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
DELETE /v1/mcp/server/{server_id}/pin
Unpin a server's tool catalogue
Unpin the server's tool list (admin only), so tools/list serves the live upstream catalog again and no longer alerts on changes. Use it after you have reviewed an upstream change you accept, then pin again.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/v1/mcp/server/server_id-123/pin" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The server is unpinned | application/json MCPToolsUnpinned |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
server_id | string | Yes | Server Id |
status | "unpinned" | Yes | Status |
PUT /v1/mcp/server/{server_id}/reject
Reject a submitted MCP server
Rejects a server a team member submitted, with optional review_notes that tell the submitter why. The server stays unusable and can be approved later. Proxy admins only. A server that is already rejected answers 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Request body (application/json, schema RejectMCPServerRequest):
| Field | Type | Required | Description |
|---|---|---|---|
review_notes | string or null | No | Review Notes |
Example request:
curl -X PUT "http://localhost:4000/v1/mcp/server/server_id-123/reject" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"review_notes": "Use the shared tracker server instead"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The rejected server | application/json Spanway_MCPServerTable |
| 400 | The server is already rejected | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
allow_all_keys | boolean | No | Allow All Keys |
allowed_tools | array of string | No | Allowed Tools |
approval_status | string or null | No | Approval status: 'pending_review', 'active', 'rejected' |
args | array of string | No | Args |
audience | string or null | No | Audience |
auth_type | enum: "none", "api_key", "bearer_token", "basic", "authorization", "oauth2", "aws_sigv4", "token", ... or null | No | Auth Type |
authorization_url | string or null | No | Authorization Url |
available_on_public_internet | boolean | No | Available On Public Internet |
byok_api_key_help_url | string or null | No | Byok Api Key Help Url |
byok_description | array of string | No | Byok Description |
catalog_entry | string or null | No | Catalog Entry |
command | string or null | No | Command |
connected_app_reachable | boolean or null | No | Connected App Reachable |
created_at | string or null | No | Created At |
created_by | string or null | No | Created By |
credentials | MCPCredentials or null | No | |
dcr_bridge | boolean or null | No | Dcr Bridge |
delegate_auth_to_upstream | boolean | No | Delegate Auth To Upstream |
description | string or null | No | Description |
enabled_write_tools | array of string | No | Enabled Write Tools |
env | object | No | Env |
env_vars | array of MCPEnvVar or null | No | Env Vars |
extra_headers | array of string | No | Extra Headers |
has_user_credential | boolean or null | No | Has User Credential |
health_check_error | string or null | No | Health Check Error |
instructions | string or null | No | Instructions |
is_byok | boolean | No | Is Byok |
is_config | boolean | No | Whether this server is defined in config and is read-only. |
issuer | string or null | No | Issuer |
last_health_check | string or null | No | Last Health Check |
max_concurrent_requests | integer or null | No | Max Concurrent Requests |
mcp_access_groups | array of string | No | Mcp Access Groups |
mcp_info | object or null | No | Mcp Info |
oauth2_flow | enum: "client_credentials", "authorization_code" or null | No | Oauth2 Flow |
oauth_passthrough | boolean | No | Oauth Passthrough |
per_server_oauth_discovery | boolean | No | Per Server Oauth Discovery |
pinned_tools | object or null | No | Pinned Tools |
registration_url | string or null | No | Registration Url |
review_notes | string or null | No | Review Notes |
reviewed_at | string or null | No | Reviewed At |
rpm | integer or null | No | Rpm |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
source_url | string or null | No | Source Url |
spec_path | string or null | No | Spec Path |
static_headers | object or null | No | Static Headers |
status | enum: "healthy", "reachable", "unhealthy", "unknown" or null | No | Health status: 'healthy', 'unhealthy', 'unknown', or 'reachable' (requires include_reachability=true; authentication and tools unchecked) |
subject_token_type | string or null | No | Subject Token Type |
submitted_at | string or null | No | Submitted At |
submitted_by | string or null | No | Submitted By |
teams | array of object | No | Teams |
timeout | number or null | No | Timeout |
token_exchange_endpoint | string or null | No | Token Exchange Endpoint |
token_exchange_profile | string or null | No | Token Exchange Profile |
token_url | string or null | No | Token Url |
tool_name_to_description | object or null | No | Tool Name To Description |
tool_name_to_display_name | object or null | No | Tool Name To Display Name |
transport | enum: "sse", "http", "stdio" | Yes | Transport |
updated_at | string or null | No | Updated At |
updated_by | string or null | No | Updated By |
url | string or null | No | Url |
GET /v1/mcp/server/{server_id}/tool-policy
Read a catalogue server's tool policy
Shows which tools of a server added from the MCP catalogue are read-only by default and which write tools an admin turned on. Proxy admins and admin viewers only. Nothing is changed. A server defined in config.yaml is not in the database, so it answers 404 and its policy is the enabled_write_tools list in config.yaml.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server/server_id-123/tool-policy" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tool policy | application/json MCPToolPolicyResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is neither a proxy admin nor an admin viewer key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
catalog_entry | string or null | Yes | The catalogue connector the server matches, by its catalog_entry or by its URL or command |
enabled_write_tools | array of string | Yes | Write tools an admin turned on for this server. Every other write tool stays hidden |
read_only_tools | array of string | Yes | Tool names or patterns the connector treats as read-only, so agents can always use them |
server_id | string | Yes | The MCP server the policy belongs to |
PUT /v1/mcp/server/{server_id}/tool-policy
Turn write tools on for a catalogue server
Sets which write tools are enabled on a server added from the MCP catalogue. Catalogue servers start with only their read-only tools, so an agent cannot change data until an admin turns a write tool on here. The list replaces the previous one. Proxy admins only, and every change is recorded in the audit log with the list before and after. A server that matches no catalogue connector, by catalog_entry or by its URL or command, answers 400.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes | |
spanway-changed-by | header | string or null | No | The spanway-changed-by header enables tracking of actions performed by authorized users on behalf of other users, providing an audit trail for accountability |
Request body (application/json, schema MCPToolPolicyUpdateRequest):
| Field | Type | Required | Description |
|---|---|---|---|
enabled_write_tools | array of string | Yes | Write tools to turn on. Replaces the old list, names trimmed, de-duplicated and sorted |
Example request:
curl -X PUT "http://localhost:4000/v1/mcp/server/server_id-123/tool-policy" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"enabled_write_tools": [
"create_issue"
]
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tool policy after the change | application/json MCPToolPolicyResponse |
| 400 | The server was not added from the catalogue | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
catalog_entry | string or null | Yes | The catalogue connector the server matches, by its catalog_entry or by its URL or command |
enabled_write_tools | array of string | Yes | Write tools an admin turned on for this server. Every other write tool stays hidden |
read_only_tools | array of string | Yes | Tool names or patterns the connector treats as read-only, so agents can always use them |
server_id | string | Yes | The MCP server the policy belongs to |
POST /v1/mcp/server/{server_id}/user-credential
Save your own API key for an MCP server
Stores your personal API key for an MCP server that asks each user to bring their own key, so its tools act as you. The key is stored encrypted and never returned. With save false nothing is stored and the answer reports has_credential false. Any user may store their own key for a server they can use. A server that does not take personal keys answers 400. With audit logging on, every stored or replaced key writes an audit row that never carries the key.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Request body (application/json, schema MCPUserCredentialRequest):
| Field | Type | Required | Description |
|---|---|---|---|
credential | string | Yes | Your personal API key or token for the MCP server, stored encrypted |
save | boolean | No | True stores the key. False stores nothing and answers false |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server/server_id-123/user-credential" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"credential": "sk-example-personal-token",
"save": true
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Whether a key is now stored | application/json MCPUserCredentialResponse |
| 400 | The server does not take personal keys, or the key has no user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no access to this MCP server | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
has_credential | boolean | Yes | Has Credential |
server_id | string | Yes | Server Id |
DELETE /v1/mcp/server/{server_id}/user-credential
Remove a stored personal API key
Deletes your stored personal API key for an MCP server, so its tools stop acting as you. A proxy admin may pass user_id to remove another user's key, for example when someone leaves. The answer reports has_credential false. With audit logging on, removing a stored key writes an audit row.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes | |
user_id | query | string or null | No |
Example request:
curl -X DELETE "http://localhost:4000/v1/mcp/server/server_id-123/user-credential" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The key is gone | application/json MCPUserCredentialResponse |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
has_credential | boolean | Yes | Has Credential |
server_id | string | Yes | Server Id |
GET /v1/mcp/server/{server_id}/user-credentials
List who has connected to an MCP server
Lists every user who stored a personal API key or OAuth token for this MCP server, with the credential type and dates and no secrets. Use it before rotating a server or offboarding a user. Proxy admins and admin viewers only. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server/server_id-123/user-credentials" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The users and their credential types | application/json array of MCPServerUserCredentialListItem |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
GET /v1/mcp/server/{server_id}/user-env-vars
Check your settings for an MCP server
Shows which per-user settings (environment variables such as a personal token) this MCP server needs from you and which you have already filled in. Values are never returned, only whether each one is set. Any user may check their own. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/server/server_id-123/user-env-vars" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Your settings status | application/json MCPUserEnvVarsStatus |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no access to this MCP server | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
missing_count | integer | No | Missing Count |
required | array of MCPUserEnvVarSpec | No | Required |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
setup_url | string or null | No | Setup Url |
POST /v1/mcp/server/{server_id}/user-env-vars
Save your settings for an MCP server
Store the calling user's per-user MCP env var values for this server. Submitted values are merged over any previously stored values, so you only send the fields you want to set or change, and a variable left out (or sent empty) keeps its stored value. Use DELETE to clear all stored values. Values are stored encrypted and never returned. Any user may store their own.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Request body (application/json, schema MCPUserEnvVarsRequest):
| Field | Type | Required | Description |
|---|---|---|---|
values | object | Yes | Values |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/server/server_id-123/user-env-vars" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"values": {
"TRACKER_API_TOKEN": "sk-example-personal-token"
}
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Your settings status after the change | application/json MCPUserEnvVarsStatus |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no access to this MCP server | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
missing_count | integer | No | Missing Count |
required | array of MCPUserEnvVarSpec | No | Required |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
setup_url | string or null | No | Setup Url |
DELETE /v1/mcp/server/{server_id}/user-env-vars
Clear your settings for an MCP server
Deletes every per-user setting you stored for this MCP server, for example before handing a shared laptop on. The status that comes back shows each setting as not set. Any user may clear their own.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
server_id | path | string | Yes |
Example request:
curl -X DELETE "http://localhost:4000/v1/mcp/server/server_id-123/user-env-vars" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Your settings, now empty | application/json MCPUserEnvVarsStatus |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The caller has no access to this MCP server | application/json ErrorDetail |
| 404 | No MCP server has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
alias | string or null | No | Alias |
missing_count | integer | No | Missing Count |
required | array of MCPUserEnvVarSpec | No | Required |
server_id | string | Yes | Server Id |
server_name | string or null | No | Server Name |
setup_url | string or null | No | Setup Url |
GET /v1/mcp/sessions
List live MCP gateway sessions
Shows the live stateful MCP sessions this gateway worker holds, grouped by AI client and by user, with how long each has been idle. Use it to see who is connected before a restart or to spot a stuck client. Proxy admins and admin viewers only. Each worker reports only its own sessions. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/sessions" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The live sessions on this worker | application/json MCPGatewaySessionsResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
by_client | array of MCPGatewaySessionGroupCount | No | By Client |
by_user | array of MCPGatewaySessionGroupCount | No | By User |
sessions | array of MCPGatewaySession | No | Sessions |
total_sessions | integer | Yes | Total Sessions |
worker_pid | integer | Yes | Worker Pid |
DELETE /v1/mcp/sessions
Close live MCP gateway sessions
Force-closes live stateful MCP sessions on this gateway worker, chosen by session_id_prefix, by the user_id that opened them, or both. Use it to cut off a client after revoking its access. Proxy admins only. Send at least one filter, otherwise the call answers 400. The client has to open a new session, which runs every access check again.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
session_id_prefix | query | string or null | No | |
user_id | query | string or null | No |
Example request:
curl -X DELETE "http://localhost:4000/v1/mcp/sessions" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The sessions that were closed | application/json MCPGatewaySessionsTerminateResponse |
| 400 | Neither filter was sent | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
sessions | array of MCPGatewaySession | No | Sessions |
terminated_sessions | integer | Yes | Terminated Sessions |
worker_pid | integer | Yes | Worker Pid |
GET /v1/mcp/tools
List the MCP tools your key can use
Lists every MCP tool the calling key may use, across the servers it reaches directly and through MCP access groups, with each tool's description and argument schema. Use it to check what an agent will see before you hand it the key. Any virtual key or Admin UI session may call it. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/tools" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The tools the key may use | application/json MCPToolListResponse |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
tools | array of MCPListedTool | Yes | Every tool the calling key may use |
GET /v1/mcp/toolset
List toolsets
Lists the toolsets the calling key may use: every toolset for proxy admins, otherwise the ones granted to the key or its team. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/toolset" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The toolsets the calling key may use | application/json array of MCPToolset |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
POST /v1/mcp/toolset
Create a toolset
Create a named toolset: a hand-picked set of tools from one or more MCP servers that agents reach at one endpoint, /toolset/{toolset_name}/mcp, instead of every tool of every server. Proxy admins only. A name already in use answers 409.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No |
Request body (application/json, schema NewMCPToolsetRequest):
| Field | Type | Required | Description |
|---|---|---|---|
description | string or null | No | Description |
tools | array of MCPToolsetTool | No | Tools |
toolset_name | string | Yes | Toolset Name |
Example request:
curl -X POST "http://localhost:4000/v1/mcp/toolset" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Read tickets and search the knowledge base",
"tools": [
{
"server_id": "jira",
"tool_name": "search_issues"
},
{
"server_id": "confluence",
"tool_name": "search_pages"
}
],
"toolset_name": "support-agent"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 201 | The toolset, reachable at /toolset/{toolset_name}/mcp | application/json MCPToolset |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 409 | Toolset names are unique | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
PUT /v1/mcp/toolset
Update a toolset
Changes a toolset. A field left out keeps its stored value and a field sent as null is cleared, except toolset_name and tools, which a toolset always has, so empty the selection with an explicit []. Agents see the change on their next request. Proxy admins only. A name already in use answers 409.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
spanway-changed-by | header | string or null | No |
Request body (application/json, schema UpdateMCPToolsetRequest):
| Field | Type | Required | Description |
|---|---|---|---|
description | string or null | No | Description |
tools | array of MCPToolsetTool or null | No | Tools |
toolset_id | string | Yes | Toolset Id |
toolset_name | string or null | No | Toolset Name |
Example request:
curl -X PUT "http://localhost:4000/v1/mcp/toolset" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"description": "Read tickets and search the knowledge base",
"tools": [
{
"server_id": "jira",
"tool_name": "search_issues"
},
{
"server_id": "confluence",
"tool_name": "search_pages"
}
],
"toolset_id": "ts_01JD4Q9K7X2M8N3P5R6T7V8W9Y",
"toolset_name": "support-agent"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The toolset after the update | application/json MCPToolset |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No toolset has that id | application/json ErrorDetail |
| 409 | Toolset names are unique | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
created_at | string or null | No | Created At |
created_by | string or null | No | Created By |
description | string or null | No | Description |
tools | array of MCPToolsetTool | No | Tools |
toolset_id | string | Yes | Toolset Id |
toolset_name | string | Yes | Toolset Name |
updated_at | string or null | No | Updated At |
updated_by | string or null | No | Updated By |
GET /v1/mcp/toolset/{toolset_id}
Get a toolset
Returns one toolset with its tools. Proxy admins can read any toolset, other keys only the ones granted to them or their team. Nothing is changed.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
toolset_id | path | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/mcp/toolset/toolset_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The toolset | application/json MCPToolset |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key or its team does not list the toolset | application/json ErrorDetail |
| 404 | No toolset has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
created_at | string or null | No | Created At |
created_by | string or null | No | Created By |
description | string or null | No | Description |
tools | array of MCPToolsetTool | No | Tools |
toolset_id | string | Yes | Toolset Id |
toolset_name | string | Yes | Toolset Name |
updated_at | string or null | No | Updated At |
updated_by | string or null | No | Updated By |
DELETE /v1/mcp/toolset/{toolset_id}
Delete a toolset
Deletes a toolset. Agents using its endpoint lose access on their next request, while the MCP servers and their tools stay as they were. Proxy admins only. The answer is an empty 202.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
toolset_id | path | string | Yes | |
spanway-changed-by | header | string or null | No |
Example request:
curl -X DELETE "http://localhost:4000/v1/mcp/toolset/toolset_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 202 | The toolset was deleted | |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key is not a proxy admin key | application/json ErrorDetail |
| 404 | No toolset has that id | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway has no database connected | application/json ErrorDetail |
GET /v1/mcp/user-credentials
List your MCP connections
Lists every MCP server you have connected with OAuth (credential_type oauth2) or your own API key (byok), with expiry times and no secrets, so you can see and clean up what acts on your behalf. A personal key never expires, so it has no expires_at. Any user may list their own. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/user-credentials" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Your stored connections | application/json array of MCPUserCredentialListItem |
| 400 | The key is not tied to a user, so there is nothing to store per user | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
GET /v1/mcp/user-env-vars/status
Check your settings across MCP servers
Per-user MCP settings status across every server you can use, so the Admin UI can highlight servers that still need a value from you. Values are never returned. Any user may call it. Nothing is changed.
Example request:
curl -X GET "http://localhost:4000/v1/mcp/user-env-vars/status" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | One status per server that needs settings | application/json array of MCPUserEnvVarsStatus |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |