Skip to main content

MCP toolsets and pinned tools

A toolset is a short list of tools picked from one or more registered servers. It gives a client or an agent exactly what it needs without granting whole servers, and it has its own MCP address at /toolset/{toolset_name}/mcp. Pinning is the related safety control. Normally a server's tool list, descriptions and input schemas come from the upstream server on every tools/list. When you pin a server the gateway serves the reviewed copy and raises an alert when the upstream changes it, which stops a compromised server from quietly changing what a tool claims to do.

A real-world scenario​

A support assistant should search Jira and search the knowledge base, nothing else. The admin creates the support-agent toolset with jira-search_issues and confluence-search_pages, grants it to the assistant's key, and points the assistant at /toolset/support-agent/mcp. The assistant sees two tools. A month later the Jira server's vendor renames a tool and adds a new one. Because the admin pinned the Jira server, clients keep getting the reviewed catalogue and the admin receives an mcp_pinned_tools_changed alert, reviews the change on the MCP Tools tab and re-pins.

Create a toolset​

Toolsets are created by proxy admins. Tools are referenced by server_id, which accepts the server id, name or alias, and tool_name.

  1. In the Admin UI, open MCP Servers and the Toolsets tab, then click New Toolset. Enter Toolset Name and Description, search a server under Available Tools, expand it and click the tools to add them to Your Toolset. Click Create Toolset. The toast reads "Toolset created".

  2. Or create it with the API:

    curl -X POST http://localhost:4000/v1/mcp/toolset \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
    -d '{
    "toolset_name": "support-agent",
    "description": "Read tickets and search the knowledge base",
    "tools": [
    {"server_id": "jira", "tool_name": "search_issues"},
    {"server_id": "confluence", "tool_name": "search_pages"}
    ]
    }'

    Expected result, with status 201:

    {
    "toolset_id": "ts_01JD4Q9K7X2M8N3P5R6T7V8W9Y",
    "toolset_name": "support-agent",
    "description": "Read tickets and search the knowledge base",
    "tools": [{"server_id": "jira", "tool_name": "search_issues"}, {"server_id": "confluence", "tool_name": "search_pages"}],
    "created_by": "admin"
    }
  3. Grant the toolset to the key. On Virtual Keys, edit the key and pick the toolset in the MCP server picker, which lists access groups, servers and toolsets together. Or set object_permission.mcp_toolsets on the key or team:

    curl -X POST http://localhost:4000/key/update \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
    -d '{"key": "sk-support-bot", "object_permission": {"mcp_toolsets": ["support-agent"]}}'
  4. Point the client at http://localhost:4000/toolset/support-agent/mcp with the key. Its tool list shows exactly jira-search_issues and confluence-search_pages. The Toolsets tab has Copy endpoint URL in each row's actions menu.

The key still needs access to the underlying servers. GET /v1/mcp/toolset lists the toolsets the calling key may use, PUT /v1/mcp/toolset with toolset_id updates one and DELETE /v1/mcp/toolset/{toolset_id} removes it, after which keys and teams that used it lose those tools. In a Responses API request the Chat UI attaches a toolset as an MCP tool whose server_label is the toolset name, and GET /mcp-rest/tools/list?toolset_name=support-agent lists it over REST.

MethodPathSummary
GET/v1/mcp/toolsetList toolsets
POST/v1/mcp/toolsetCreate a toolset
PUT/v1/mcp/toolsetUpdate a toolset
GET/v1/mcp/toolset/{toolset_id}Get a toolset
DELETE/v1/mcp/toolset/{toolset_id}Delete a toolset

Pin a server's tools​

Pinning stores the server's current tools, descriptions and input schemas on the server's database row. From then on clients receive the pinned catalogue, and when the upstream list differs the gateway raises an mcp_pinned_tools_changed alert through the configured alerting channels instead of serving the new or altered tools. Servers defined in config.yaml cannot be pinned because they have no database row.

  1. Open MCP Servers, click the server and open the MCP Tools tab. The Pinned tools card reads Live catalogue. Review the tools listed under Available Tools, then click Pin current tools.

  2. Or pin with the API:

    curl -X POST http://localhost:4000/v1/mcp/server/8f1c2d3e-4b5a-4c6d-9e7f-0a1b2c3d4e5f/pin \
    -H "Authorization: Bearer $SPANWAY_MASTER_KEY"

    Expected result, one entry per pinned tool:

    {
    "search_issues": {"description": "Search Jira issues with JQL", "input_schema": {"type": "object", "properties": {"jql": {"type": "string"}}}}
    }
  3. The card now reads "Pinned, 1 tools". When the upstream changes, the alert arrives and the card shows Re-pin current tools so you can accept the change after reviewing it. Unpin, or DELETE /v1/mcp/server/{server_id}/pin, returns to the live catalogue.

Other roles see the pin state with a note that only a proxy admin can change it.

Errors​

StatusWhereMeaningFix
403 Only proxy admins can create MCP toolsets.POST, PUT /v1/mcp/toolset and DELETE /v1/mcp/toolset/{toolset_id}The key is not a proxy admin key. The update and delete routes say the same for their verb.Use an admin key.
403 API key does not have access to this toolset.GET /v1/mcp/toolset/{toolset_id}, /toolset/{toolset_name}/mcpThe key or its team does not list the toolset in mcp_toolsets.Grant it as shown above.
404 Toolset '...' not found.Toolset routes and /toolset/{toolset_name}/mcpNo toolset has that id or name.Check the Toolsets tab. The endpoint uses the name, the management routes use the id.
409 A toolset named 'support-agent' already exists.POST, PUT /v1/mcp/toolsetNames are unique.Pick another name or update the existing toolset.
503 Database not available/toolset/{toolset_name}/mcpToolsets live in the database and the gateway runs without one.Set DATABASE_URL.
Pin fails with "Could not change the pinned tools"MCP Tools tabThe gateway could not list the server's tools, or the server is defined in config.yaml. The API answers below say which.Check the server's health badge, and move the server to the database to pin it.
400 MCP server '<id>' exposes no tools that pass the guardrails; nothing to pin.POST /v1/mcp/server/{server_id}/pinEvery tool the server lists was blocked by a guardrail, so there is nothing safe to pin.Review the guardrails or the server, then pin again.
403 Admin access required to pin MCP server tools. or ... to unpin MCP server tools.POST, DELETE /v1/mcp/server/{server_id}/pinThe key is not a proxy admin key.Use an admin key.
404 MCP server '<id>' not found in the database.POST, DELETE /v1/mcp/server/{server_id}/pinNo database row has that id, for example a server from config.yaml.Check the id, or move the server to the database.
500 Database not connected. Connect a database to your proxyToolset and pin routesThe gateway has no database.Set DATABASE_URL.
Tools missing from a toolset sessionAny clientThe key may use the toolset but not one of its servers.Grant the server too, see access control.

Creating, changing and deleting a toolset, and pinning or unpinning a server, are audited with the before and after values, see audit logs.

Logs​

LevelLineMeaningAction
WARNINGspanway.proxy.mcp_server.toolset_db::list_mcp_toolsets - <error>The toolsets could not be read from the database, so the list came back empty and keys limited to a toolset saw no tools from it for that request.Check the database. The next request reads the toolsets again.

Toolset changes write audit rows rather than log lines. The other MCP lines are in the log reference.