mcp
Give your agent the keys
Datalenk speaks MCP at https://datalenk.com/api/mcp. Point Claude, ChatGPT or your own agent at it with your API key, and it can set a site up and analyse it without you opening the dashboard once.
Connect
The transport is Streamable HTTP and the token is your ordinary API key — create one under Workspace → API. Its scopes apply: a key without write is not even offered the configuration tools, so an agent cannot try them and fail. That is the sane default for an agent you have not watched work yet.
Claude Code, Cursor, VS Code
These send a header you choose, so the API key goes straight in.
claude mcp add --transport http datalenk https://datalenk.com/api/mcp \ --header "Authorization: Bearer dlk_live_…"
{
"mcpServers": {
"datalenk": {
"type": "http",
"url": "https://datalenk.com/api/mcp",
"headers": { "Authorization": "Bearer dlk_live_…" }
}
}
}Claude Desktop and claude.ai
Straight answer: not yet, not directly. Their custom-connector flow runs OAuth against the server and offers no field for an API key, so pasting the URL there will fail. Until Datalenk ships OAuth, the working route on the desktop app is a local bridge, which needs Node installed:
{
"mcpServers": {
"datalenk": {
"command": "npx",
"args": ["mcp-remote", "https://datalenk.com/api/mcp",
"--header", "Authorization: Bearer dlk_live_…"]
}
}
}A whole site, in one conversation
The point of the configuration tools is that the path never breaks in the middle. Nothing below requires leaving the chat:
create_site domain: "example.com", timezone: "Europe/Paris"
→ paste the returned snippet before </body>
get_setup → receivingData: true, lastEventAt: 2 minutes ago
query_data group_by: ["event_name"] → what the site actually sends
add_goal match: "signup" → a conversion worth counting
add_funnel steps: ["pageview", "add_to_cart", "purchase"]
update_site_settings exclude_paths: ["/admin"] → stop counting your own visits
get_overview → and now the numbers mean somethingThe order matters more than it looks. Declaring a funnel before checking which events a site emits is how you end up with a funnel stuck at zero and no idea why — so add_funnel refuses steps that match no known event instead of accepting them politely.
The tools
Set the site up
Everything the dashboard onboarding does, without the dashboard.
create_siteAdd a site and get its install snippet back. Returns the existing site if the domain is already there, rather than splitting your data across two.
get_setupThe snippet to paste, whether we have ever received an event, when the last one arrived, how many visitors are on the site right now, plus the timezone and excluded paths. Start here when someone says tracking is broken.
update_site_settingsTimezone, and which paths to stop recording (admin, staging).
add_goalDeclare one conversion to track. Adds to the list, never replaces it.
list_goalsThe goals already configured.
add_funnelDeclare one ordered funnel. Adds to the list. Steps that match no event are refused up front, rather than saved into a funnel that stays silently at zero.
list_funnelsThe funnels already configured.
Read the data
Answers, not archives. Every tool returns JSON small enough to reason about.
list_sitesThe sites in this workspace.
get_overviewVisitors, pageviews, revenue, AI traffic, bounce rate, average session, conversions.
get_channelsVisitors and revenue by acquisition channel.
get_sourcesWhich AI assistants, search engines, social networks and referring sites.
get_top_pagesMost visited pages, with the revenue behind them.
get_revenueGross, refunds, fees and net, by channel. Needs a payment provider connected.
get_seo_actionsThe five SEO moves worth the most money this month, from Search Console crossed with real revenue.
query_dataThe open one: group by any dimensions over any window, up to 365 days. Use it when no tool above asks your exact question.
What writing does, and does not do
Every write tool is additive. add_goal and add_funnel read the existing list, append to it, and say so — asking twice for the same goal changes nothing and is not an error. The HTTP equivalents (PUT /goals, PUT /funnels) replace the whole list, which is the right shape for a deploy script and the wrong one for an agent that only meant to add one line.
There is no delete tool, on purpose. Removing a goal or a funnel is a decision worth making with your eyes on the screen: do it in the dashboard, or through the HTTP API where replacing the list is explicit.
Write tools need the write scope, and a read-only key never sees them listed. A write tool also refuses to guess which site you meant. Reading the wrong site gives you a number that looks off and you catch it; configuring the wrong site is silent. Pass the exact domain or the numeric id — a term matching two sites is rejected rather than resolved.
Where the HTTP API is still the answer
MCP is built for a conversation; some jobs are not one. Sending payments or identifying users from your backend belongs in ingestion. Filling a warehouse with raw events belongs in exports — and if you are handing that file to an assistant rather than a database, use dataset=rollup, which is the same data in a few hundred lines instead of a few hundred thousand.
Rate limits are shared with the REST API: 600 reads and 300 writes per minute.