> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/integrations/catalog/custom-mcp.md).

# Custom MCP

Model Context Protocol server integration

* MCP connection

### Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

| Connector                | Authentication |
| ------------------------ | -------------- |
| MCP                      | API Key        |
| MCP                      | MCP with OAuth |
| MCP (Client Credentials) | Credentials    |

#### MCP

Connect to Model Context Protocol (MCP) servers to access external tools and capabilities.

**Set up in Custom MCP**

1. If the server requires authentication, obtain an API key from the server's provider.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **MCP**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field      | Required                 | What to enter                                                                                                                                              |
| ------------------ | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Base URL           | Yes                      | Base URL of the MCP server.                                                                                                                                |
| Authorization Type | Optional / as applicable | Authorization type for the MCP server when using API key authentication. Default is Bearer. If using Basic authentication, provide base64 encoded API key. |
| API Key            | Optional / as applicable | Optional API key for authentication. Provide base64 encoded API key if using Basic authentication.                                                         |
| Description        | Optional / as applicable | Optional description for this MCP server connection (e.g., include the server name).                                                                       |

**Provider documentation:** [Setup reference](https://modelcontextprotocol.io/docs/getting-started/intro).

#### MCP

Connect to MCP using OAuth2 authentication.

**Set up in Custom MCP**

1. Obtain access to the Custom MCP MCP server and the tools that your workflow will use. Use the server URL supplied by the provider or your administrator.
2. If your organization restricts application access or user consent, have its administrator approve the connection before you sign in.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **MCP**.
2. Select **Connect**, sign in to the provider account, and review the requested access. Complete authorization to return to StackAI.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field          | Required                 | What to enter                                                                                                                                                                                                         |
| ---------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Client Secret          | Optional / as applicable | The OAuth client secret (e.g., 1234567890). You may not need to set this, the OAuth flow will try to set it with Dynamic Client Registration, but some MCP Servers don't support it, so they require a Client Secret. |
| Custom Headers         | Optional / as applicable | Enter the custom headers issued for the account or service you are connecting.                                                                                                                                        |
| MCP Server URL         | Yes                      | The MCP server URL (e.g., <https://mcp.example.com>).                                                                                                                                                                 |
| Client ID              | Optional / as applicable | The OAuth client ID (e.g., 1234567890). You may not need to set this, the OAuth flow will try to set it with Dynamic Client Registration, but some MCP Servers don't support it, so they require a Client ID.         |
| Authorization Endpoint | Optional / as applicable | The OAuth endpoint URL (e.g., <https://mcp.example.com/oauth2/authorize>). You probably don't have to set this, the OAuth flow will try to discover it on its own.                                                    |
| Description            | Optional / as applicable | Optional description for this MCP server connection.                                                                                                                                                                  |

**Provider documentation:** [Setup reference](https://modelcontextprotocol.io/docs/getting-started/intro).

#### MCP (Client Credentials)

Connect to a Model Context Protocol (MCP) server using an OAuth2 client credentials service account. No browser sign-in: the client ID and secret are the identity, so the connection does not depend on an individual user's account.

**Set up in Custom MCP**

1. Prepare the Custom MCP account or service that the workflow will access. Grant access to the required resources and operations.
2. Obtain the account, endpoint, and authentication values listed below from the service administrator.

**Set up in StackAI**

1. Open **Settings → Connections**, add a connection, and select **MCP (Client Credentials)**.
2. Enter the credentials and connection details in the fields below.
3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

**Connection fields**

| StackAI field              | Required                 | What to enter                                                                                                                                                                                                                                |
| -------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MCP Server URL             | Yes                      | The MCP server endpoint StackAI should connect to.                                                                                                                                                                                           |
| Token URL                  | Yes                      | The OAuth2 token endpoint that issues access tokens. This is often on a different host than the MCP server (e.g. your identity provider).                                                                                                    |
| Client ID                  | Yes                      | Client ID of the service account / machine-to-machine application.                                                                                                                                                                           |
| Client Secret              | Yes                      | Client Secret issued alongside the Client ID.                                                                                                                                                                                                |
| Scopes                     | Optional / as applicable | Optional space-separated OAuth scopes to request. Leave empty if the authorization server assigns scopes to the client automatically.                                                                                                        |
| Token Endpoint Auth Method | Optional / as applicable | How to present the client credentials: 'client\_secret\_post' sends them in the request body, 'client\_secret\_basic' sends them as an HTTP Basic header. If the token request is rejected with an invalid\_client error, try the other one. |
| Audience                   | Optional / as applicable | Optional 'audience' parameter for the token request. Required by some providers (notably Auth0) to receive a JWT rather than an opaque token.                                                                                                |
| Resource                   | Optional / as applicable | Optional 'resource' parameter for the token request (RFC 8707). Set this when the authorization server requires the target resource to be named explicitly.                                                                                  |
| Description                | Optional / as applicable | Optional description for this MCP server connection.                                                                                                                                                                                         |

#### Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

### Use an action

1. Add the required **Custom MCP** action to the workflow.
2. Select a connection when the action requests one.
3. Complete the required fields. Use the reference picker when a value comes from another workflow step.
4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

### Actions

#### Call MCP Server

\[DEPRECATED] Interact with a Model Context Protocol (MCP) server. Leave Tool Name empty to list all tools available on the server (returns each tool's name, description, and input schema). Set Tool Name and Parameters to invoke a specific tool. Currently, only public servers and those accessible via API Key authentication are supported.

> **Deprecated:** Use Call Tool to invoke a tool, or List Tools to discover a server's tools.

**Inputs**

| Field      | Type            | Required | Description                                                                                                                                                                                                                    |
| ---------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Tool Name  | select (string) | No       | The name of the tool to invoke on the MCP server. Leave empty to return the catalog of all tools available on the server (each entry includes name, description, and input schema). Options load from the selected connection. |
| Parameters | textarea        | No       | Parameters to pass to the chosen tool as a JSON object string. Ignored when tool\_name is empty (listing mode).                                                                                                                |

**Outputs**

| Field  | Type   | Description                     |
| ------ | ------ | ------------------------------- |
| Result | object | The result of calling the tool. |

#### Call Tool

Call a tool on a Model Context Protocol (MCP) server. Select the tool and provide its parameters as a JSON object. Public servers and those accessible via API Key authentication are supported.

**Inputs**

| Field      | Type            | Required | Description                                                                                                                                                                                                                    |
| ---------- | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Tool Name  | select (string) | No       | The name of the tool to invoke on the MCP server. Leave empty to return the catalog of all tools available on the server (each entry includes name, description, and input schema). Options load from the selected connection. |
| Parameters | textarea        | No       | Parameters to pass to the chosen tool as a JSON object string. Ignored when tool\_name is empty (listing mode).                                                                                                                |

**Outputs**

| Field  | Type   | Description                     |
| ------ | ------ | ------------------------------- |
| Result | object | The result of calling the tool. |

#### List Tools

List the tools available on a Model Context Protocol (MCP) server. Returns each tool's name, description, and input schema. Public servers and those accessible via API Key authentication are supported.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field  | Type   | Description                                                                                         |
| ------ | ------ | --------------------------------------------------------------------------------------------------- |
| Result | object | The tool catalog. Contains a `tools` list where each entry has name, description, and input schema. |

#### List Resources

List the resources available on a Model Context Protocol (MCP) server. Returns each resource's uri, name, description, and MIME type. Resources are read-only content (documents, records, files) addressed by uri. Currently, only public servers and those accessible via API Key authentication are supported.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field  | Type   | Description                                                                                                  |
| ------ | ------ | ------------------------------------------------------------------------------------------------------------ |
| Result | object | The resource catalog. Contains a `resources` list where each entry has uri, name, description, and mimeType. |

#### List Resource Templates

List the resource templates available on a Model Context Protocol (MCP) server. A resource template is a parameterized resource: its uriTemplate contains placeholders (e.g. onelynk://schema/{type}) that you fill in to address a concrete resource. Returns each template's uriTemplate, name, description, and MIME type. Currently, only public servers and those accessible via API Key authentication are supported.

**Inputs**

No input fields are required in this catalog entry.

**Outputs**

| Field  | Type   | Description                                                                                                                                                                                                                       |
| ------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Result | object | The resource-template catalog. Contains a `resourceTemplates` list where each entry has uriTemplate, name, description, and mimeType. A uriTemplate has placeholders (e.g. `onelynk://schema/{type}`) you fill in before reading. |

#### Read Resource

Read a single resource from a Model Context Protocol (MCP) server by its uri. Returns the resource's text content (uri, mimeType, text). For a resource template, substitute its placeholders to form a concrete uri first. Only text resources are supported; binary content is omitted. Currently, only public servers and those accessible via API Key authentication are supported.

**Inputs**

| Field        | Type   | Required | Description                                                                                                                |
| ------------ | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| Resource URI | string | Yes      | The uri of the resource to read (e.g. onelynk://schema/general-ledger). For a template, substitute its placeholders first. |

**Outputs**

| Field  | Type   | Description                                                                                                                   |
| ------ | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| Result | object | The resource contents. Contains a `contents` list where each text part has uri, mimeType, and text. Binary parts are omitted. |

### Important behavior

If an operation is denied, check the connection’s granted permissions and the account’s access in the provider. Reauthorize the connection when it needs additional permissions.

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/integrations/catalog/custom-mcp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
