Skip to main content

MCP

Squid can connect to an external MCP server or a customized Squid MCP Server to help define tools and actions for your AI agents.

What is MCP?

MCP (Model Context Protocol) is an open protocol to facilitate communication between AI agents and external services. It allows Squid AI agents to access tools and perform actions by connecting to an MCP server, which exposes various functionalities through defined tools.

To learn more about creating an MCP server in Squid, check out our MCP Server documentation.

Setting up the connector

To set up the MCP connector in Squid, complete the following setup steps:

  1. Navigate to the Squid Console and select your desired Squid application.
  2. Click the Connectors tab.
  3. Click Available Connectors and find the MCP connector. Then Click Add Connector.
  4. Provide the following details:
  • Connector ID: A unique ID of your choice. It is best to keep it brief and meaningful

  • MCP URL: The MCP endpoint URL provided by the external MCP server or your customized Squid MCP server. Finding your Squid MCP server URL is dependent on your development environment:

    • If you are developing locally, your MCP URL will be logged in your terminal under MCP Servers.
    • If you have deployed your backend, navigate to the Backend tab in the console and locate the MCP URL under MCP Servers.
  • Authorization (Optional): Toggle on to automatically inject an authorization key-value pair with all of your MCP requests. This can be useful for including auth credentials that may be required by the MCP server. The Authorization Header Value is stored securely as a Squid secret and masked in the console; only its name is kept in the connector configuration.

  1. Click Test Connection to test your connection to the server. If the connection fails, verify the value of your MCP URL and authorization header if you added one.
  2. Once the connection is successful, click Add Connector.

Using the MCP connector with an agent

After adding the connector, attach it to an agent in the Agent Studio by adding it to the agent's abilities, or pass it per-request with the connectedIntegrations ask option:

await squid.ai().agent('AGENT_ID').ask('Look up the weather in Tokyo', {
connectedIntegrations: [
{
integrationId: 'MCP_CONNECTOR_ID',
integrationType: 'mcp',
description: 'Call this server for weather tools',
},
],
});

The agent discovers the server's tools and calls them as needed during the conversation.

Limiting which tools the agent can use

By default, the agent has access to every tool the MCP server exposes. To restrict it to specific tools, list their names in the toolsToUse option:

  • In the Agent Studio: when adding or editing the MCP connector ability, fill in the Tools to use field with a comma-separated list of tool names. Leave it blank to allow all tools.
  • In the SDK: pass toolsToUse in the connected integration's options:
await squid.ai().agent('AGENT_ID').ask('Look up the weather in Tokyo', {
connectedIntegrations: [
{
integrationId: 'MCP_CONNECTOR_ID',
integrationType: 'mcp',
description: 'Call this server for weather tools',
options: { toolsToUse: ['getWeather', 'getForecast'] },
},
],
});

An omitted or empty toolsToUse list allows all tools; a non-empty list allows only the exact tool names it contains.

Exposing an API connector as an MCP server

An API connector can also be surfaced to an agent over MCP without writing any MCP server code. Squid generates an MCP server from the connector's schema: every endpoint becomes an MCP tool named after its endpoint ID, with the tool's description and input parameters derived from the endpoint definition.

To expose an API connector as an MCP server:

  1. In the Squid Console, open the API connector's configuration and toggle on Expose as MCP Server.
  2. Squid now serves an MCP server for the connector at https://YOUR_APP_URL/mcp/CONNECTOR_ID. The server and its tools are also listed in the Backend tab of the console under MCP Servers.
  3. Connect the server to an agent. In the Agent Studio, the connector now appears among the MCP abilities, so you can add it to the agent's abilities like any other MCP connector. In the SDK, pass a connectedIntegrations entry with integrationType: 'api' and connectedAsMcp: true:
await squid.ai().agent('AGENT_ID').ask('What is the current exchange rate?', {
connectedIntegrations: [
{
integrationId: 'API_CONNECTOR_ID',
integrationType: 'api',
connectedAsMcp: true,
description: 'Call this API for exchange rate data',
},
],
});

The toolsToUse option works here as well: since the tool names match the connector's endpoint IDs, pass the endpoint IDs the agent may call in the entry's options to restrict access to specific endpoints.

When the agent calls a tool, Squid executes the corresponding API endpoint the same way as a direct squid.api().request() call: the connector's injections are applied, and the endpoint's security rules are enforced. Squid forwards the calling user's authorization (bearer token or API key) with every tool call, so each call runs with the original caller's identity rather than a shared credential — a user who isn't authorized to call an endpoint directly can't reach it through the agent either.