OAUTH 2.0
ANALYTICS
Connect to Hex MCP. Create and continue data analysis threads, search projects, and query your data using natural language from your AI workflows.
from langchain_mcp_adapters.client import MultiServerMCPClient
from scalekit import ScalekitClient
client = ScalekitClient(env_url=ENV_URL, client_id=CLIENT_ID, client_secret=SECRET)
token = client.agent.get_token(user_id="user_id", connector="hexmcp")
mcp = MultiServerMCPClient({
"hexmcp": {
"url": "https://mcp.scalekit.com/hexmcp",
"headers": {"Authorization": "Bearer " + token}
}
})
tools = await mcp.get_tools()import OpenAI from "openai";
import { ScalekitClient } from "@scalekit-sdk/node";
const client = new ScalekitClient({ envUrl, clientId, clientSecret });
const token = await client.agent.getToken({ userId: "user_id", connector: "hexmcp" });
const openai = new OpenAI();
// Connect to MCP at https://mcp.scalekit.com/hexmcp
// Pass: Authorization: Bearer + tokenimport Anthropic from "@anthropic-ai/sdk";
import { ScalekitClient } from "@scalekit-sdk/node";
const client = new ScalekitClient({ envUrl, clientId, clientSecret });
const token = await client.agent.getToken({ userId: "user_id", connector: "hexmcp" });
const anthropic = new Anthropic();
// Connect to MCP at https://mcp.scalekit.com/hexmcp
// Pass: Authorization: Bearer + tokenfrom google.adk.agents import LlmAgent
from scalekit import ScalekitClient
client = ScalekitClient(env_url=ENV_URL, client_id=CLIENT_ID, client_secret=SECRET)
token = client.agent.get_token(user_id="user_id", connector="hexmcp")
# Connect to MCP at https://mcp.scalekit.com/hexmcp
# Pass: Authorization: Bearer + token// shared token
audit → bot_service_account
// scalekit
audit → user_abc ✓Does the agent access Hex as the user or as a shared key?
As the user. Each workspace member authorizes once and Scalekit resolves their credential at request time. Audit logs attribute every action to that user, not a shared service account.
Where is the Hex OAuth token stored?
In Scalekit's managed AES-256 token vault, namespaced per tenant. Refresh is automatic. Revocation is a single dashboard action. Tokens never appear in prompts, logs, or LLM context.
Can I limit what the agent is allowed to do in Hex?
Yes. Pass a tool name filter to listScopedTools so the analytics agent only sees the subset you authorize. Pre-API-call scope checks block out-of-policy actions before the request reaches Hex.
What happens when a user revokes Hex access?
The connection is invalidated on the next tool call. Subsequent requests for that user fail closed with a clear error. Other users in the tenant remain unaffected. The event is logged for audit.
Which Hex projects can analysis threads touch?
Only projects the authorizing user can access. Thread creation and natural language queries run with the user's Hex workspace role, so restricted data apps stay restricted.