You can call Kendall MCP tools directly from your own Python code — useful for scripts, notebooks, scheduled jobs, or anywhere you want structured access to your store data without going through the Kendall UI.

This page walks through a minimal working example.

Prerequisites

pip install mcp

Get your MCP URL

Each Kendall store has its own MCP endpoint, of the form:

<https://mcp.kendall.ai/sse?store_id=><STORE_ID>&secret=<SECRET>

You can copy the full URL (including the secret) from the Kendall MCP Server field on the Store Settings page (link) inside the Kendall app. Note: Treat the secret like a password — anyone with the URL can read your store's data.

Minimal working example

The example below initializes a session, lists the available tools, then calls get_ads_report for the last 30 days at the ad level.

import asyncio
import json

from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

URL = "<https://mcp.kendall.ai/sse?store_id=><STORE_ID>&secret=<SECRET>"

async def main():
    async with streamablehttp_client(URL) as (read, write, _):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # Optional — see what tools this store exposes
            tools = await session.list_tools()
            print([t.name for t in tools.tools])

            result = await session.call_tool(
                "get_ads_report",
                {
                    "platform": "facebook",
                    "last_x_days": "30",
                    "level": "ad",
                    "limit": 500,
                },
            )

            for block in result.content:
                text = getattr(block, "text", None)
                if text:
                    print(json.dumps(json.loads(text), indent=2))

asyncio.run(main())

How responses are shaped

result.content is a list of content blocks. For Kendall tools you'll almost always get a single TextContent whose .text is a JSON string — json.loads it and you have a normal Python dict you can index, filter, or feed into pandas.

Most Kendall tools include a _fields key in the response that documents the abbreviated field names — handy when you're exploring a new tool.

Picking arguments

Each tool's arguments are documented in its schema, which you can inspect via session.list_tools() (the inputSchema field on each tool). The argument names match what's described inside Kendall — for example get_ads_report accepts platform, last_x_days, date_start/date_end, level (campaign, adset, ad), sort_by, sort_order, min_spend, and limit.

Tools default to returning the top 50 rows by spend to keep responses small. If you want everything, raise limit (e.g. 500 or 1000) — there is no "unlimited" flag.

Gotcha: use the streamable-HTTP client, not the SSE client