SERVICE ACCOUNT
DATA WAREHOUSE
Every dataset, table, and analytical pipeline your backend connects to lives in BigQuery. BigQuery (Service Account) MCP gives your agent server-to-server authenticated access using a GCP service account — no user OAuth required.
import { ScalekitClient } from "@scalekit-sdk/node";
import { DynamicStructuredTool } from "@langchain/core/tools";
import { createReactAgent } from "@langchain/langgraph/prebuilt";
import { z } from "zod";
const sk = new ScalekitClient(envUrl, clientId, clientSecret);
const { tools } = await sk.tools.listScopedTools("user_123", {
filter: { connectionNames: ["bigqueryserviceaccount"], toolNames: ["bigqueryserviceaccount_list_datasets", "bigqueryserviceaccount_get_table", "bigqueryserviceaccount_run_query"] },
pageSize: 100,
});
const lcTools = tools.map((t) => new DynamicStructuredTool({
name: t.tool.definition.name,
description: t.tool.definition.description,
schema: z.object({}).passthrough(),
func: async (args) => {
const { data } = await sk.tools.executeTool({
toolName: t.tool.definition.name,
identifier: "user_123",
params: args,
});
return JSON.stringify(data);
},
}));
const agent = createReactAgent({ llm, tools: lcTools });import { ScalekitClient } from "@scalekit-sdk/node";
import OpenAI from "openai";
const sk = new ScalekitClient(envUrl, clientId, clientSecret);
const openai = new OpenAI();
const { tools } = await sk.tools.listScopedTools("user_123", {
filter: { connectionNames: ["bigqueryserviceaccount"], toolNames: ["bigqueryserviceaccount_list_datasets", "bigqueryserviceaccount_get_table", "bigqueryserviceaccount_run_query"] },
pageSize: 100,
});
const llmTools = tools.map((t) => ({
type: "function",
function: {
name: t.tool.definition.name,
description: t.tool.definition.description,
parameters: t.tool.definition.input_schema,
},
}));
const resp = await openai.responses.create({
model: "gpt-4o", input: prompt, tools: llmTools,
});import { ScalekitClient } from "@scalekit-sdk/node";
import Anthropic from "@anthropic-ai/sdk";
const sk = new ScalekitClient(envUrl, clientId, clientSecret);
const anthropic = new Anthropic();
const { tools } = await sk.tools.listScopedTools("user_123", {
filter: { connectionNames: ["bigqueryserviceaccount"], toolNames: ["bigqueryserviceaccount_list_datasets", "bigqueryserviceaccount_get_table", "bigqueryserviceaccount_run_query"] },
pageSize: 100,
});
const llmTools = tools.map((t) => ({
name: t.tool.definition.name,
description: t.tool.definition.description,
input_schema: t.tool.definition.input_schema,
}));
const msg = await anthropic.messages.create({
model: "claude-sonnet-4-6", max_tokens: 1024,
tools: llmTools,
messages: [{ role: "user", content: prompt }],
});import { Agent } from "@google/adk/agents";
import {
MCPToolset, StreamableHTTPConnectionParams,
} from "@google/adk/tools/mcp";
const toolset = new MCPToolset({
connectionParams: new StreamableHTTPConnectionParams({
url: "https://mcp.scalekit.com/bigqueryserviceaccount",
headers: { Authorization: `Bearer ${userScopedToken}` },
}),
});
const agent = new Agent({
name: "agent", model: "gemini-2.0-flash",
tools: await toolset.getTools(),
});// shared token
audit → bot_service_account
user_filter → broken
// scalekit
audit → user_abc
scope → enforced ✓How does the agent authenticate to BigQuery?
You connect BigQuery once with a service account, and Scalekit authenticates every call. Audit logs record every action the agent takes.
Where are the BigQuery service account credentials stored?
In Scalekit's managed AES-256 token vault, namespaced per tenant. Revocation is a single dashboard action. Credentials never appear in prompts, logs, or LLM context.
Can I limit what the agent is allowed to do in BigQuery?
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 BigQuery.
What happens when a user revokes BigQuery 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.
Can the agent query datasets the service account lacks access to?
No. Queries run with the service account's BigQuery permissions. IAM roles, dataset-level access, row-level security, and column-level masking all apply. Out-of-scope data returns an access error.
What other MCP connectors does Scalekit support?
Scalekit runs the Snowflake MCP server, ClickHouse MCP server, and Tableau MCP server on the same token vault, scope checks, and audit trail. Browse 500+ connectors in the MCP connector directory.