MCP servers
Use Model Context Protocol (MCP) servers to connect flows and agents to external tools and data sources. Runtype supports saved and runtime MCP servers.
Overview
MCP servers expose tools to the model during flow execution. You can save a server for reuse or pass its configuration at runtime.
MCP servers provide these capabilities:
- Tool discovery: Runtype lists tools that the server exposes.
- Parameter schemas: Runtype exposes each tool’s input schema.
- Session support: MCP clients can maintain sessions with compatible servers.
- Standard protocol: Runtype connects to MCP-compatible servers.
Choose a server type
Choose a server type based on how you supply its configuration:
Use saved MCP servers
Save a custom MCP server to reuse its tools across flows and agents.
Add a saved server
Choose a dashboard or API workflow:
Dashboard
API
To add a saved server from the dashboard, follow these steps:
- On Tools, click Create Tool.
- In the Type menu, select MCP Server. The dashboard opens the server form.
- In Server URL, enter the MCP server endpoint.
- Choose an authentication type and enter its credentials.
- Click Discover Tools. The dashboard lists the tools that it finds.
- Click Add Server. The dashboard saves the server.
Discover tools from a saved server
To verify a saved server and list its tools, send a POST request:
The API returns a response similar to the following:
Replace YOUR_API_KEY with your Runtype API key.
Use saved tools in a flow
Add saved MCP tool IDs to the tools object in a prompt step. The following examples use the customer_support server:
Use the TypeScript SDK to dispatch a flow with saved MCP tools:
This example reads the API key from the RUNTYPE_API_KEY environment variable.
Use the Python SDK to dispatch the same flow:
This example reads the API key from the RUNTYPE_API_KEY environment variable.
Send the same flow with cURL:
Replace YOUR_API_KEY with your Runtype API key.
Use passthrough mode
To attach every tool that a saved server exposes, add a wildcard entry to toolIds:
The wildcard expands into concrete tool IDs at execution time. This behavior means:
- New tools from the MCP server are available without editing the flow.
- Approval rules,
toolConfigs,perToolLimits, and usage tracking use concrete tool IDs. - When
toolIdscontains both the wildcard and a curated ID for one server, Runtype uses the wildcard and ignores the curated ID.
Choose passthrough mode when you trust every tool on the server and want to receive new tools without changing the flow. Choose curated tool IDs when you need to review each tool.
Use the TypeScript SDK to attach passthrough tools:
Send the same passthrough configuration with cURL:
Replace YOUR_API_KEY with your Runtype API key.
Share saved servers
Saved MCP servers in an organization are shared with its members. Members can list and use them, view metadata, test connections, and discover tools. Runtype encrypts saved credentials and does not return credential values in API responses.
Server owners and organization admins can perform these actions:
- Edit the server configuration, including the URL, timeout, transport, and allowed tools.
- Rotate or replace credentials.
- Refresh or reconnect the OAuth2 connection.
- Turn the server on or off.
- Delete the server.
Other members can view server details but cannot manage them. A management request from another member returns 403 with this message: “This MCP server was added by a teammate. Only the person who added it or an org admin can change it.”
Use the following fields in GET /mcp/servers and GET /mcp/servers/:name responses to control management actions in client code:
Servers that you register outside an organization stay private to your account and are not visible to other users.
When an organization has duplicate server names, an admin’s by-name DELETE request returns 409 with candidate IDs. Pass the optional id query parameter, as in DELETE /mcp/servers/:name?id=SERVER_ID, to identify the registration to remove.
Use runtime MCP servers
Pass a server configuration inline when its URL or credentials vary by request.
Choose runtime servers
Use runtime MCP servers for these cases:
- Pass per-user credentials in a multi-tenant application.
- Test a server before saving it.
- Configure a one-off integration.
- Set a server URL at request time.
Configure a runtime server
Pass the server configuration in the prompt step’s tools object:
Pass the per-user token from your application in userCredentials.mcpToken.
Use the Python SDK to pass the same runtime configuration:
Pass the per-user token from your application in user_credentials["mcp_token"].
Send the runtime configuration with cURL:
Replace the placeholders with your values:
YOUR_API_KEY: Your Runtype API key.YOUR_MCP_TOKEN: The token that the MCP server accepts.
Authentication types
Choose one of the following authentication types for a custom MCP server:
Replace every credential placeholder in the table with a value that the server accepts. Replace the name inside each {{secret:NAME}} reference with a managed secret name from your account.
Use the headers type when a server requires two or more HTTP headers. Each header value can contain a {{secret:NAME}} reference, which Runtype resolves from your managed secrets when it sends the request. The headers field is valid only with type: "headers" and must contain at least one valid HTTP header.
In the dashboard, open Advanced authentication and select Multiple headers. Runtype
encrypts saved header values and hides them. To edit them, enter a complete replacement set. The
same headers record works with POST /v1/mcp/servers, inline tools.mcpServers, and full
product object (FPO) agent configurations.
OAuth 2.1 authentication
Use the dashboard OAuth2 flow when an MCP server requires OAuth instead of a static token.
Detect OAuth2 on URL entry
On the dashboard, enter the MCP server URL. Runtype probes the server for OAuth2 metadata through RFC 9728 protected-resource discovery.
When Runtype finds OAuth2 metadata, the dashboard shows Connect with OAuth2 instead of manual token fields. It displays the discovered issuer and supported scopes.
The discovery flow also handles servers whose authorization-server metadata is at the host root while the issuer contains a path.
Authorize in the browser
Click Connect with OAuth2. The dashboard opens a popup for sign-in and consent. Runtype uses PKCE for the authorization-code exchange, so the browser does not handle a client secret.
After you approve access, the popup closes and the dashboard discovers tools for selection.
Use discovery diagnostics
When Runtype does not detect OAuth2, expand OAuth2 not detected. View discovery details. The panel lists each discovery phase, the URL that Runtype probed, the response status, and any error. Use these details to troubleshoot an MCP server that supports OAuth2 but is not detected.
Find OAuth2 setup
Use the OAuth2 setup in either of these locations:
- On the Tools page, when you create an MCP Server tool.
- In the agent tool-selection modal, when you add a server while choosing tools for an agent.
Configured OAuth2 servers appear in the agent tool-selection modal with their discovered tool counts.
Tool ID format
Use the following format for a saved custom server tool ID:
For example:
mcp:customer_support:search_articles: A tool on the savedcustomer_supportserver.mcp:customer_support:create_ticket: Another tool on the same saved server.
Replace SERVER_NAME with the saved server name and TOOL_NAME with the MCP tool name.
Runtime server tool IDs use the custom_ prefix:
Replace SERVER_ID with the runtime server’s id value and TOOL_NAME with the MCP tool name.
Use the * value as the passthrough wildcard for saved servers:
Runtime server configuration
Configure runtime MCP servers with the following fields:
Use environment-specific servers
Assign an environment to a saved server when you need separate development and production configurations:
Replace the placeholders with your values:
YOUR_API_KEY: Your Runtype API key.YOUR_DEVELOPMENT_TOKEN: The token for the development server.YOUR_PRODUCTION_TOKEN: The token for the production server.
Add the environment to the dispatch request to select a saved server configuration:
Limits
Runtype applies these limits to runtime MCP configuration:
Combine MCP tools with other tools
Add saved tools, built-in tools, runtime tools, and runtime MCP servers to one prompt. This tools object combines these tool sources:
Replace YOUR_TOOL_ID with the ID of a saved tool.
Protect MCP credentials
Use these practices to protect MCP credentials:
Store saved-server credentials in the server configuration. Runtype encrypts them before storage.
Keep runtime credentials out of logs and persistent storage. Use environment variables or managed secret references instead of hardcoding tokens.
Set allowedTools to limit the tools that a server can expose when possible.
Troubleshoot MCP servers
When a required saved MCP server cannot load its tools, the execution stops with a message naming the connection and a recovery action. Authorization failures require reconnecting the server; timeouts and temporary outages receive at most one discovery retry before the execution stops. These failures do not trigger model fallback or additional agent turns.
Structured execution errors include error.details.mcpFailure with serverId,
serverName, stage, code, retryable, and diagnosticId. Keep the diagnostic
reference when investigating a failed run. Browser voice tests display the same safe
message and provide a button to open Tools → MCP servers. Upstream response bodies
and credentials are not included in these messages.
An unavailable required MCP connection stops execution before prompt fallbacks, including fixed-message fallbacks. Reconnect or repair the required connection before running the flow or agent again.
Use these checks to troubleshoot common MCP server failures:
Connection timeout
Check these settings:
- Confirm that the server URL is reachable.
- Increase the
timeoutvalue up to 60000 milliseconds. - Confirm that firewall and network rules allow the connection.
Authentication failed
Check these settings:
- Confirm that the token is valid and has not expired.
- Confirm that the auth type matches the server’s requirements.
- For
api_key, confirm thatheaderNamematches the server’s header.
Permission denied (403)
Permission denied (403)
Check these settings:
- Confirm that the server owner or an organization admin manages the server.
- Check
canManagein theGET /mcp/serversresponse. - Ask the server owner or an organization admin to make the change.
Tools do not appear
Check these settings:
- Send a
POSTrequest to/mcp/servers/:name/testto verify discovery. - Check the
allowedToolsfilter when you set it. - Confirm that the server implements the
tools/listmethod.
API reference
Use these endpoints to manage saved servers and discover tools:
Next steps
Continue with these guides: