> 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/technical-reference/connections-and-tool-execution/custom-mcp-connections-and-tool-discovery.md).

# Custom MCP Connections and Tool Discovery

A custom MCP connection makes tools from an MCP server available to StackAI. Tool discovery shows the operations that the server exposes to the connected account.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2Frm1axa1Lt3J23crsTPpP%2FG051.mp4?alt=media&token=f53669cc-5a9a-4332-a6c1-8de53e10ce0e>" %}

## Before you begin

A supported MCP server URL and its required authentication details.

## MCP connection concepts

| Term           | Definition                                                                                                                                               |
| -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| MCP server     | A server that exposes tools and other supported capabilities through Model Context Protocol. Discover the catalog available to the authenticated client. |
| Transport      | The communication mechanism used between an MCP client and server. The client and server must support the same connection method.                        |
| Tool discovery | Retrieval of the available tool names, descriptions, and input schemas. Use the current discovered schema instead of guessing an operation name.         |
| Tool argument  | A value supplied when calling a tool. It must match that tool’s exposed input schema and refer to accessible resources.                                  |
| Authentication | Verification of the account or credential making a request. It identifies the caller but does not grant every resource permission.                       |

## Connect a custom MCP server

1. Add the MCP connection using the server’s supported transport and authentication.

![Add the required MCP integration, then review the tools it makes available.](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/cUyVy4YMGliaCa0wXt4j/assets/g051-g051-02-catalog.png)

Add the required MCP integration, then review the tools it makes available.

2. Load its tool catalog and inspect the available descriptions and input schemas.
3. Select the required tools and run an operation with the expected input fields.

<figure><img src="https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2Fx21pgBD0tAH6f598eg9K%2Fcustom-mcp-configuration.png?alt=media" alt="Custom mcp configuration controls in StackAI" width="624"><figcaption><p>Enter the MCP endpoint in Server URL and give the connection a recognizable Label. Description explains what the server provides. Authorization supports OAuth Bearer authentication. For another authentication method, supply the header required by the server in Headers. Use the server’s documented header name and value format; the form’s placeholders are not a credential configuration to copy.</p></figcaption></figure>

The selected tools are available with the connected account’s permissions.

## Behavior and limitations

A successful connection does not guarantee access to every tool or underlying resource. Servers can change their catalogs or restrict tools by account. Refresh discovery after a server change. Treat tool errors separately from connection failures, and follow the server’s documentation for its authentication method.

## Related resources

[MCP tools in an agent](https://docs.stackai.com/guides-and-quickstarts/using-tools-and-actions/mcp-tools-in-an-agent.md)

[Connection Ownership, Sharing, and Permissions](https://docs.stackai.com/technical-reference/connections-and-tool-execution/connection-ownership-sharing-and-permissions.md)


---

# 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/technical-reference/connections-and-tool-execution/custom-mcp-connections-and-tool-discovery.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.
