MCP Client

The Model Context Protocol (MCP) client manages MCP servers, their installations, tool access, credential bindings, and auth policies.
zaby.mcp  # → McpClient

Server management

Create

name
string
required
Display name
slug
string
required
URL-friendly identifier
type
string
required
”EXTERNAL” or “INTERNAL”
endpoint
string
required
MCP server endpoint URL
description
string
Human-readable description
server = await zaby.mcp.create_server({
    "name": "Web Search",
    "slug": "web-search",
    "type": "EXTERNAL",
    "endpoint": "https://mcp.search.io/sse",
})

Get

server = await zaby.mcp.get_server(server_id)

Update

await zaby.mcp.update_server(server_id, {
    "name": "Updated Name",
    "endpoint": "https://mcp.new-endpoint.io/sse",
})

Discover tools

Probe the server for available tools without installing:
tools = await zaby.mcp.discover_tools(server_id)

Tool catalog

Browse available MCP tools across all registered servers:
catalog = await zaby.mcp.list_catalog()

Installations

Install

installation = await zaby.mcp.install_server({
    "serverId": server_id,
    "name": "Search Prod",
    "config": {"api_key": "sk-..."},
})
serverId
string
required
Server to install
name
string
required
Installation name
config
dict
Server-specific configuration

List installations

installations = await zaby.mcp.list_installations()

Update installation

await zaby.mcp.update_installation(installation_id, {
    "config": {"api_key": "new-key"},
})

Revoke installation

await zaby.mcp.revoke_installation(installation_id)

Tool management

List installation tools

tools = await zaby.mcp.list_installation_tools(installation_id)

Update tool policy

await zaby.mcp.update_tool_policy(installation_id, tool_id, {
    "allowed": True,
    "requiredRole": "admin",
})

Preflight invocation

Validate a tool invocation without executing it:
result = await zaby.mcp.preflight_invocation(installation_id, tool_name, {
    "arguments": {"query": "test"},
})

Invoke tool

result = await zaby.mcp.invoke_tool(installation_id, tool_name, {
    "arguments": {"query": "What's the weather?"},
})

Credential bindings

binding = await zaby.mcp.create_credential_binding(installation_id, {
    "credentials": {"api_key": "sk-...", "secret": "..."},
})
await zaby.mcp.delete_credential_binding(binding_id)

Auth policies & access

await zaby.mcp.upsert_auth_policy(installation_id, {
    "type": "oauth2",
    "config": {"clientId": "...", "scopes": ["read"]},
})
await zaby.mcp.grant_access(installation_id, {
    "agentId": agent_id,
    "permissions": ["invoke", "discover"],
})

Full workflow

import asyncio
from zaby import Zaby

async def main():
    zaby = Zaby(api_key="zaby_pk_...")

    server = await zaby.mcp.create_server({
        "name": "Weather",
        "slug": "weather",
        "type": "EXTERNAL",
        "endpoint": "https://weather-mcp.example.com/sse",
    })

    installation = await zaby.mcp.install_server({
        "serverId": server["id"],
        "name": "Weather Prod",
        "config": {"api_key": "sk-..."},
    })

    await zaby.mcp.invoke_tool(installation["id"], "get_forecast", {
        "arguments": {"city": "London"},
    })

asyncio.run(main())