Connectors and MCP
Give the agent Mistral connectors and remote MCP servers.
Guide: Connectors.
| Name | What it is |
|---|---|
agents.connector | Give the agent a Mistral connector by name, such as agents.connector("notion"). |
Connector | A Mistral connector that the agent uses, as agents.connector(name) returns it. |
agents.all_connectors | Give the agent every connector that the user who runs the session has connected. |
AllConnectors | Every connector that the user who runs the session has connected, as of the session's start. |
RemoteMCP | An MCP server the agent reaches over HTTP, declared under a name in Agent(mcps=...). |
agents.connectoragents.connector
def agents.connector(
name: str,
*,
run_as: Literal['auto', 'deployment'] | None = None,
auto_auth: bool = True,
credentials_name: str | None = None,
allow_mcp_ui: bool = False,
) -> ConnectorGive the agent a Mistral connector by name, such as agents.connector("notion").
The connector uses the connection of the user who runs the session. run_as="deployment" uses the connection of the identity the deployment runs with instead; locally, both use your MISTRAL_API_KEY. All connectors of one agent must use the same run_as and auto_auth, and name each connector once. Otherwise the session does not start; agents info and agents serve report the problem before that.
With the default run_as, the agent acts as the user who runs the session, so its deployment must be hardened: only the identities pinned to it can run it. agents serve and agents deploy harden it for you; see Hardened deployments.
A name that matches no connector, or a connector that fails to load, does not stop the session: it starts without that connector, you get an agents.Notice, and the SDK logs a warning such as No Mistral connector is named 'Lienar'. Did you mean 'linear'?.
ConnectorConnector
class Connector(
connector_name: str,
*,
run_as: Literal['auto', 'deployment'] | None = None,
auto_auth: bool = True,
credentials_name: str | None = None,
allow_mcp_ui: bool = False,
)A Mistral connector that the agent uses, as agents.connector(name) returns it.
agents.all_connectorsagents.all_connectors
def agents.all_connectors(
*,
exclude: Sequence[str] = (),
max_connectors: int | None = None,
auto_auth: bool = True,
allow_mcp_ui: bool = False,
) -> AllConnectorsGive the agent every connector that the user who runs the session has connected.
exclude drops connectors by name. Leave max_connectors unset: it keeps
the first connectors by name, not the ones the task needs. Narrow the set with
exclude.
auto_auth and allow_mcp_ui apply to every discovered connector and
mean what they mean on connector. To give one connector its own
credentials_name or allow_mcp_ui, name it with agents.connector(...)
in the same list, and the named declaration wins for that connector. It must keep the
same auto_auth and the default run_as, or the session does not start. For example,
this agent gets every connector but Jira, and Notion with the team credentials:
agents.Agent(
model="mistral-large-4",
connectors=[
agents.all_connectors(exclude=["jira"]),
agents.connector("notion", credentials_name="team"),
]
)AllConnectorsAllConnectors
class AllConnectorsEvery connector that the user who runs the session has connected, as of the session's start.
agents.all_connectors() returns it. A connector is in the set when it is active in the
user's workspace, has MCP tools, and the user has connected it. With auto_auth, the agent
can still find the other connectors and ask the user to connect one.
The set always uses the user's connections: it has no run_as="deployment" form.
| Attribute | Type | Description |
|---|---|---|
exclude | tuple[str, ...] | Connector names to drop from the set. |
max_connectors | int | None | The most discovered connectors the agent mounts, the first by name. None sets no cap. |
auto_auth | bool | Whether the agent may ask the user to connect a connector it found unconnected. |
allow_mcp_ui | bool | Whether MCP app resources are shown for every discovered connector. |
MCP
RemoteMCPRemoteMCP
class RemoteMCP(
*,
url: str,
auth_header_env_vars: Mapping[str, str] | None = None,
model_access: ToolModelAccess | None = None,
disabled_tools: Sequence[str] | None = None,
startup_timeout_seconds: float | None = None,
tool_timeout_seconds: float | None = None,
namespace: str | None = None,
id: str | None = None,
name: str | None = None,
)An MCP server the agent reaches over HTTP, declared under a name in Agent(mcps=...).
Each of its tools has the ID <namespace>.<tool name>, such as github.create_issue:
permission rules, approvals and hooks name the tool by it. Two servers of one agent cannot
share a namespace or an id, so give each its own key in mcps=.
A misspelled keyword raises TypeError, and a bad value raises SdkError naming the
argument. Defining the agent raises SdkError for two servers in one namespace, or for a
namespace that the built-in tools or the SDK's own tools hold.
| Parameter | Type | Default | Description |
|---|---|---|---|
url | str | required | The server's http:// or https:// endpoint. |
auth_header_env_vars | Mapping[str, str] | None | None | Header name to the name of the environment variable that holds the header's full value, read where the agent runs. |
model_access | ToolModelAccess | None | None | How the model reaches the server's tools, an agents.ToolModelAccess: "direct", "programmatic" or "both". Unset, it is "direct" for an agent without programs and "programmatic" otherwise. |
disabled_tools | Sequence[str] | None | None | The server's own names of tools to leave out. |
startup_timeout_seconds | float | None | None | How long listing the server's tools may take. Defaults to 30. |
tool_timeout_seconds | float | None | None | How long one tool call may take. Defaults to 300. |
namespace | str | None | None | The namespace of the server's tools. Defaults to its key in mcps. |
id | str | None | None | The server's ID, which Notice.source and ContextMessage.source give for it. Defaults to its key in mcps. |
name | str | None | None | The server's name in the messages the model gets about it, such as when its tools cannot be used. Defaults to its key in mcps. |