CREATE MCP SERVER
statementsupportedAI & MLCreates a new MCP (Model Context Protocol) server or replaces an existing MCP server.
Syntax
supportedpartialnot supportednot scored
CREATE [ OR REPLACE ] MCP SERVER [ IF NOT EXISTS ] <name>
FROM SPECIFICATION $$<specification_yaml>$$
Parameters
| Name | Required | Description |
|---|---|---|
name | String that specifies the identifier for the MCP server; must be unique for the schema in which the MCP server is created. In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"). Identifiers enclosed in double quotes are also case-sensitive. For more information, see Identifier requirements. | |
FROM SPECIFICATION $$specification_yaml$$ | Specifies the YAML specification defining the tools and configuration for the MCP server. The specification must include a tools array with one or more tool definitions, a tool_config entry, or both. Each tool in tools must specify: name: Unique identifier for the tool type: Tool type (see supported tool types) title: Human-readable title for the tool description: Description of what the tool does For GENERIC and CORTEX_AGENT_RUN tools, you can also specify an optional annotations object with MCP tool behavior hints: readOnlyHint: If true, the tool doesn’t modify its environment. destructiveHint: If true, the tool might perform destructive updates. This hint is meaningful only when readOnlyHint is false. idempotentHint: If true, repeated calls with the same arguments have the same effect as one call. openWorldHint: If true, the tool might interact with external entities. Each annotation is optional. For omitted annotations, Snowflake uses the default for the tool type. The defaults for GENERIC and CORTEX_AGENT_RUN are readOnlyHint: false, destructiveHint: true, idempotentHint: false, and openWorldHint: true. Tool annotations are hints for MCP clients. They don’t enforce tool behavior or replace access control. Configure privileges for the underlying object according to the actual operations that the tool can perform. Supported tool types: CORTEX_SEARCH_SERVICE_QUERY: Cortex Search Service tool CORTEX_ANALYST_MESSAGE: Cortex Analyst tool SYSTEM_EXECUTE_SQL: SQL execution tool CORTEX_AGENT_RUN: Cortex Agent tool CODING_AGENT: Coding Agent tool, with no stored agent object. Snowflake adds the code_toolset_all tool on every run GENERIC: Custom tool for UDFs and stored procedures Tool-specific requirements: For CORTEX_SEARCH_SERVICE_QUERY, CORTEX_ANALYST_MESSAGE, and CORTEX_AGENT_RUN tools: identifier: Fully qualified name of the underlying object (for example, database.schema.object_name) If an MCP server has at least one of the CORTEX_AGENT_RUN or CODING_AGENT tools, Snowflake automatically adds three tools: ASYNC_AGENT_RUN_STATUS, AGENT_RUN_RESULT, and ASYNC_AGENT_RUN_CANCEL. If CORTEX_AGENT_RUN or CODING_AGENT is invoked with "background": true, it returns immediately with a handle; that handle can be passed to ASYNC_AGENT_RUN_STATUS or ASYNC_AGENT_RUN_CANCEL to get the status or cancel a run respectively. AGENT_RUN_RESULT can be used to fetch a result from a run (whether background or not). See Cortex Agent supplementary tools and Run an agent tool in the background. For GENERIC tools: identifier: Fully qualified name of the UDF or stored procedure config: Configuration object specifying: type: Either function (for UDF) or procedure (for stored procedure) warehouse: Warehouse to use for execution input_schema: JSON schema defining the function/procedure parameters For CODING_AGENT tools: Add the tool to the server specification. Omit identifier. This tool does not reference a stored agent object. config: Optional agent configuration. It can include any field of the Cortex Agents run request, such as model, instructions, tools, tool_resources, and skills. See Coding Agent. Snowflake appends code_toolset_all after any tools in config. A run can include code_toolset_all or code_execution, but not both. The appended tool defaults to always_ask, so a state-modifying tool pauses and the call ends before it runs. Set tool_resources.code_toolset_all.permission_policy.type to always_allow for a trusted automation that should run those tools in one call. See Coding Agent. Generated agent tools: To serve every Cortex Agent that the caller’s role can use, add a top-level tool_config list with one entry: type: CORTEX_AGENT_RUN selection: all The entry accepts no other keys, and the list accepts only one entry. Snowflake doesn’t store the generated tools in the specification. It generates them on each tools/list request, for the role that makes the request. See Serve every agent the caller can use. |
Usage notes
- The OR REPLACE and IF NOT EXISTS clauses are mutually exclusive. They can’t both be used in the same statement.
- CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
- CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
- When configuring hostnames for MCP server connections, use hyphens (-) instead of underscores (_). MCP servers have connection issues with hostnames containing underscores.
- External OAuth authorization-server binding and advertised scopes aren’t set in the MCP server specification. Configure them with the OAUTH_AUTHORIZATION_SERVER and OAUTH_SCOPES_SUPPORTED parameters on the enclosing account, database, or schema. For details, see Configure External OAuth authentication for MCP servers.
- The MCP server specification is stored as metadata and can be viewed using DESCRIBE MCP SERVER.
- Multiple tools can be defined in a single MCP server specification.
- Tool names must be unique within a single MCP server.
- If the specification has a tool_config entry, tool names in tools can’t start with sf_. Snowflake reserves this prefix for generated agent tools.
- DESCRIBE MCP SERVER and GET_DDL show the tool_config entry, but not the tools that Snowflake generates from it.
- Regarding metadata: Attention Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
Access control requirements
A role used to execute this operation must have the following privileges at a minimum: Privilege | Object CREATE MCP SERVER | Schema USAGE | Schema For tools that reference other objects, additional privileges are required: Privilege | Object USAGE | Cortex Search Service (for CORTEX_SEARCH_SERVICE_QUERY tools) SELECT | Semantic View (for CORTEX_ANALYST_MESSAGE tools) USAGE | Cortex Agent (for CORTEX_AGENT_RUN tools) USAGE | User-defined function or stored procedure (for GENERIC tools) USAGE | Warehouse (for GENERIC tools) Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.