MCP Client — JSON-RPC 2.0 for Snowflake Managed MCP

A Python client for interacting with Snowflake’s Managed MCP Server via the standard MCP protocol

The MCP Protocol

Snowflake’s Managed MCP Server speaks JSON-RPC 2.0 with two key methods:

  • tools/list — Discover available tools and their input schemas
  • tools/call — Invoke a tool by name with arguments

The server URL follows the pattern:

https://{account}.snowflakecomputing.com/api/v2/databases/{db}/schemas/{schema}/mcp-servers/{name}

MCPToolbox


def MCPToolbox(
    client:__main__.MCPClient | None=None
):

Ergonomic wrapper around an MCP server’s tool inventory.

Caches the tool list, provides discovery helpers, and pairs naturally with display_mcp_result(). The primary happy path for MCP tool calling.

Lower-level control is available via MCPClient and mcp_request().


mcp_call


def mcp_call(
    tool_name:str, arguments:dict
)->dict:

Call an MCP tool using the default client.


mcp_tools_list


def mcp_tools_list(
    
)->list:

List all tools using the default client.


mcp_request


def mcp_request(
    method:str, params:dict | None=None
)->dict:

Send a JSON-RPC 2.0 request using the default client.


mcp_url


def mcp_url(
    
)->str:

Return the MCP server URL (lazily resolved from default session).


reset_default_mcp_client


def reset_default_mcp_client(
    
)->None:

Clear the cached default MCP client, forcing re-creation on next access.


MCPClient


def MCPClient(
    url:str, headers_factory:Callable, timeout:int=120
):

JSON-RPC 2.0 client for Snowflake Managed MCP Servers.


MCPError


def MCPError(
    code:int, message:str, data:NoneType=None
):

Raised when the MCP server returns a JSON-RPC error.

Let’s discover what tools are available:

tools = mcp_tools_list()
for t in tools:
    print(f"  {t['name']:<30s} {t.get('description', '')[:60]}")

Display Helpers

Rich display functions for rendering MCP responses in Jupyter notebooks with dark-mode compatible styling. display_mcp_result auto-detects the response type (SQL, Agent, Analyst, Search) and renders accordingly.


display_mcp_result


def display_mcp_result(
    response:dict, label:str=''
):

Best-effort notebook renderer for MCP tool responses.

Attempts to auto-detect the response shape and render it appropriately: SQL (result_set), Agent (content), Analyst (list), Search (list of dicts), or GENERIC (raw JSON fallback). Not format-authoritative — treat as a convenience helper for interactive exploration.