snowflake.snowpark.mcp.MCPServer

class snowflake.snowpark.mcp.MCPServer(name: str, tools: Iterable[Tool] = ())[source]

Bases: object

A Snowflake-managed MCP server defined in Python.

The definition is independent of where it is deployed: pass database, schema and suffix to each method to work with, for example, a dev and a prod copy of the same server. database and schema default to the session’s current ones. Pass database, schema and suffix the same way to deploy, grant_usage, call_tool and drop: each call targets the copy they name.

Parameters:
  • name – The server name, an unquoted identifier.

  • tools – The server’s tools.

Methods

add(*tools)

Adds tools.

call_tool(session, tool_name[, arguments, ...])

Calls a deployed tool over session with tool-call arguments, by name, and returns its result.

deploy(session, *[, database, schema, ...])

Creates or replaces the server and the procedures and UDFs of its Python tools.

drop(session, *[, database, schema, suffix, ...])

Drops the server and, with include_tools=True, the procedures and UDFs it created, which the session's role owns.

endpoint_url(session, *[, database, schema, ...])

Returns the URL MCP clients connect to.

grant_usage(session, role, *[, database, ...])

Grants role what it needs to connect to the server and call each of its tools: usage on the database, schema and server, usage on every tool's procedure, UDF, agent or search service and its database and schema, select on semantic views, and usage on every warehouse set on a tool.

to_spec([session, database, schema, suffix])

Returns the server's specification as a dict.

to_yaml([session, database, schema, suffix])

Returns the server's specification as YAML, as CREATE MCP SERVER takes it.

tool(name)

Returns the tool with this name.