You can call Kendall MCP tools directly from your own Python code: scripts, notebooks, scheduled jobs, or anywhere you want structured access to your store data without the Kendall app. This page walks through a minimal working example.
mcp SDK requires it).pip install mcp
On the Connectors & MCP page, create a token under Access tokens. Copy it when you create it. You can’t see it again.
Treat the token like a password: anyone with it can read your store’s data. Revoke it from the same page when you no longer need it.
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/mcp"
TOKEN = "kmcp_..."
HEADERS = {"Authorization": f"Bearer {TOKEN}"}
async def main():
async with streamablehttp_client(URL, headers=HEADERS) 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())
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.
Each tool’s arguments are documented in its schema, which you can inspect via session.list_tools() (the inputSchema field on each tool). 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 return the top 50 rows by spend by default. To get more, raise limit (e.g. 500 or 1000). There is no "unlimited" flag.
Use mcp.client.streamable_http.streamablehttp_client. The SSE client (mcp.client.sse.sse_client) won’t connect.
If you don’t want to deal with async, wrap the call in a small helper: