Connectors and MCP

Give the agent Mistral connectors and remote MCP servers.

Guide: Connectors.

NameWhat it is
agents.connectorGive the agent a Mistral connector by name, such as agents.connector("notion").
ConnectorA Mistral connector that the agent uses, as agents.connector(name) returns it.
agents.all_connectorsGive the agent every connector that the user who runs the session has connected.
AllConnectorsEvery connector that the user who runs the session has connected, as of the session's start.
RemoteMCPAn MCP server the agent reaches over HTTP, declared under a name in Agent(mcps=...).
agents.connector

agents.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,
) -> Connector

Give 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'?.

ParameterTypeDefaultDescription
namestrrequiredThe connector's name, such as "notion".
run_asLiteral['auto', 'deployment'] | NoneNoneWhose connection the connector uses: "auto" or "deployment". None is "auto".
auto_authboolTrueWhether a missing connection starts an authorization flow that asks the user to connect.
credentials_namestr | NoneNoneThe name of one of the connector's stored credentials, such as "team". None leaves the choice to the connectors API.
allow_mcp_uiboolFalseWhether MCP app resources the connector's tools declare are shown after their calls.
Connector

Connector

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.

ParameterTypeDefaultDescription
connector_namestrrequiredThe connector's name, such as "notion".
run_asLiteral['auto', 'deployment'] | NoneNoneWhose connection the connector uses: "auto" or "deployment", as on connector. None is "auto".
auto_authboolTrueWhether a missing connection starts an authorization flow that asks the user to connect.
credentials_namestr | NoneNoneThe name of one of the connector's stored credentials, such as "team". None leaves the choice to the connectors API.
allow_mcp_uiboolFalseWhether MCP app resources the connector's tools declare are shown after their calls.
agents.all_connectors

agents.all_connectors

def agents.all_connectors(
    *,
    exclude: Sequence[str] = (),
    max_connectors: int | None = None,
    auto_auth: bool = True,
    allow_mcp_ui: bool = False,
) -> AllConnectors

Give 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"),
    ]
)
ParameterTypeDefaultDescription
excludeSequence[str]()Connector names to drop from the set.
max_connectorsint | NoneNoneThe most discovered connectors the agent mounts, the first by name. Only connectors the user can use count, and a connector you name yourself is never capped away. None sets no cap.
auto_authboolTrueWhether the agent may ask the user to connect a connector it found unconnected.
allow_mcp_uiboolFalseWhether MCP app resources are shown for every discovered connector.
AllConnectors

AllConnectors

class AllConnectors

Every 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.

AttributeTypeDescription
excludetuple[str, ...]Connector names to drop from the set.
max_connectorsint | NoneThe most discovered connectors the agent mounts, the first by name. None sets no cap.
auto_authboolWhether the agent may ask the user to connect a connector it found unconnected.
allow_mcp_uiboolWhether MCP app resources are shown for every discovered connector.
MCP

MCP

RemoteMCP

RemoteMCP

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.

ParameterTypeDefaultDescription
urlstrrequiredThe server's http:// or https:// endpoint.
auth_header_env_varsMapping[str, str] | NoneNoneHeader name to the name of the environment variable that holds the header's full value, read where the agent runs.
model_accessToolModelAccess | NoneNoneHow 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_toolsSequence[str] | NoneNoneThe server's own names of tools to leave out.
startup_timeout_secondsfloat | NoneNoneHow long listing the server's tools may take. Defaults to 30.
tool_timeout_secondsfloat | NoneNoneHow long one tool call may take. Defaults to 300.
namespacestr | NoneNoneThe namespace of the server's tools. Defaults to its key in mcps.
idstr | NoneNoneThe server's ID, which Notice.source and ContextMessage.source give for it. Defaults to its key in mcps.
namestr | NoneNoneThe 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.