Python and TypeScript SDKs
Last reviewed against the app on 24 September 2026
Two small client libraries wrap the MCP server's JSON-RPC protocol. Both are version 0.1.0 and MIT licensed. You can also call the server directly: it is plain JSON-RPC 2.0 over HTTP at https://claribi.com/mcp/v1/.
| Python | TypeScript | |
|---|---|---|
| Package | claribi-mcp | @claribicom/mcp |
| Version | 0.1.0 | 0.1.0 |
| Runtime | Python 3.10 or later | Node.js 18 or later |
| HTTP | httpx (synchronous) | global fetch |
| Typed tool methods | Yes, generated from the tool catalog | Generated class included; call tools with callTool |
| License | MIT | MIT |
Python
pip install claribi-mcpfrom claribi_mcp import Client
with Client(api_key="claribi_mcp_...") as client:
client.initialize()
dashboards = client.list_dashboards(limit=5)
print(dashboards.structured["items"])
answer = client.run_analysis(question="What was revenue last quarter by region?")
print(answer.text)The client has one method per tool for the 19 tools that were in the catalog when this version was generated (dashboards, reports, data sources, analysis, data loading, usage, billing and signup). Newer tools, such as the forecast tools, are called by name:
run = client.call_tool("run_forecast", {"forecast_id": "...", "wait_seconds": 30})In version 0.1.0 the generate_report method still has the tool's old arguments: it asks for a title the server ignores and cannot pass data_source_ids or question. Call the tool by name instead:
job = client.call_tool("generate_report", {"template_id": "...", "question": "paid acquisition in Q3"})Other methods: list_tools(), list_resources(), read_resource(uri), list_prompts(), get_prompt(name, arguments) and ping(). Client() without credentials can call only the public tools.
OAuth tokens
from claribi_mcp import Client, BearerTokenAuth
def refresh():
token, expires_at = my_refresh_flow() # your OAuth refresh
return token, expires_at # expires_at in epoch seconds
client = Client(auth=BearerTokenAuth(
access_token=initial_token,
expires_at=initial_expires_at,
refresh_callable=refresh,
))The refresh function is called about 30 seconds before the token expires.
Errors
from claribi_mcp import Client, ToolError
with Client(api_key="claribi_mcp_...") as client:
try:
client.run_analysis(question="Revenue by month")
except ToolError as exc:
print(exc.code, exc) # e.g. -32007 when the plan lacks the featureToolError is raised for JSON-RPC errors and for tool results marked as errors; ClientError for transport problems.
TypeScript
npm install @claribicom/mcpimport { Client } from '@claribicom/mcp';
const client = new Client({ apiKey: 'claribi_mcp_...' });
await client.initialize();
const dashboards = await client.callTool('list_dashboards', { limit: 5 });
console.log(dashboards.structured);
const answer = await client.callTool('run_analysis', {
question: 'What was revenue last quarter by region?',
});
console.log(answer.text());Also available: listTools(), listResources(), readResource(uri), listPrompts(), getPrompt(name, args), ping(). Options: baseUrl, timeoutMs (default 60,000) and fetchImpl.
OAuth tokens
import { Client, BearerTokenAuth } from '@claribicom/mcp';
const client = new Client({
auth: new BearerTokenAuth(accessToken, expiresAtEpochSeconds, async () => {
const t = await myRefreshFlow();
return { accessToken: t.accessToken, expiresAt: t.expiresAt };
}),
});Errors
import { Client, ToolError } from '@claribicom/mcp';
const client = new Client(); // no credentials: public tools only
try {
await client.callTool('list_dashboards');
} catch (err) {
if (err instanceof ToolError) console.error(err.code, err.message); // -32001
}Regenerating tool methods
Both packages include a generator that reads /api/mcp-server/tool-catalog/ and writes one method per tool:
# Python
python scripts/codegen.py --catalog https://claribi.com/api/mcp-server/tool-catalog/ --output claribi_mcp/generated
# TypeScript
npm run codegen -- --catalog https://claribi.com/api/mcp-server/tool-catalog/ --output src/generated