🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@useatlas/sdk

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@useatlas/sdk - npm Package Compare versions

Comparing version
0.1.0
to
0.1.1
+46
-3
dist/client.d.ts

@@ -8,3 +8,3 @@ /**

export type { AuthMode, Conversation, Message, ConversationWithMessages, DBType, HealthStatus, ConnectionHealth, ConnectionInfo, ConnectionDetail, ActionApprovalMode, ActionLogEntry, ActionStatus, RollbackInfo, DeliveryChannel, RunStatus, Recipient, ScheduledTask, ScheduledTaskWithRuns, ScheduledTaskRun, TableInfo, TableColumn, StarterPrompt, StarterPromptProvenance, StarterPromptsResponse, } from "@useatlas/types";
import type { AuthMode, ChatErrorCode, Conversation, ConversationWithMessages, ConnectionHealth, ConnectionInfo, DeliveryChannel, ActionApprovalMode, ActionStatus, RollbackInfo, Recipient, ScheduledTask, ScheduledTaskWithRuns, ScheduledTaskRun, StarterPromptsResponse, TableInfo } from "@useatlas/types";
import type { AuthMode, ChatErrorCode, Conversation, ConversationWithMessages, ConnectionHealth, ConnectionInfo, DeliveryChannel, ActionApprovalMode, ActionStatus, PlanLimitStatus, RollbackInfo, Recipient, ScheduledTask, ScheduledTaskWithRuns, ScheduledTaskRun, StarterPromptsResponse, TableInfo } from "@useatlas/types";
import { type BeginConnectOptions, type BeginConnectResult, type BuildConfigOptions, type CompleteConnectOptions, type CompleteConnectResult, type ConnectMachineToMachineOptions, type ConnectMachineToMachineResult, type ListAgentsResponse, type McpClientConfig, type RevokeAgentResponse } from "./mcp";

@@ -68,2 +68,20 @@ /** @deprecated Use `Recipient` instead. */

conversationId?: string;
/**
* Identifier of the underlying agent run. Present whenever the agent loop
* ran; useful for correlating with durable-session records and server logs.
*/
runId?: string;
/**
* Set when one or more SQL queries matched an approval rule and were
* enqueued for admin approval instead of executed. The run is NOT a
* complete answer in this case — the queued query runs only after
* approval. `requestId` is null when no approval-queue row could be
* created.
*/
pendingApproval?: {
requestId: string | null;
ruleName: string;
matchedRules: string[];
message: string;
};
pendingActions?: Array<{

@@ -77,2 +95,12 @@ id: string;

}>;
/**
* 80–109% plan-usage warning band (#3452). Present when the workspace
* is approaching or in grace against its token budget; omitted below
* 80% and on self-hosted deployments.
*/
planWarning?: {
code: "plan_limit_warning";
message: string;
metrics: PlanLimitStatus[];
};
}

@@ -95,2 +123,11 @@ export interface ListConversationsResponse {

}
export interface ListTablesOptions {
/**
* Connection (or group) to scope the table list to. The returned set matches
* exactly what the SQL validation pipeline enforces for that connection
* (group-scoped whitelist, ADR-0012). An unknown id yields a 404; omitting it
* resolves to the default group.
*/
connectionId?: string;
}
export interface GetStarterPromptsOptions {

@@ -333,6 +370,12 @@ /** Maximum number of prompts to return (server clamps to 1–50, default 6). */

/**
* List all queryable tables from the semantic layer, including column
* List the queryable tables from the semantic layer, including column
* details. Does not require admin role.
*
* Pass `connectionId` to scope the list to a specific connection (or
* group): the returned set matches exactly what `validateSQL` / `executeSQL`
* enforce for that connection (the group-scoped whitelist, ADR-0012). An
* unknown `connectionId` is rejected with a 404 rather than silently falling
* back to the global list. Omitting it resolves to the default group.
*/
listTables(): Promise<ListTablesResponse>;
listTables(opts?: ListTablesOptions): Promise<ListTablesResponse>;
/**

@@ -339,0 +382,0 @@ * Fetch the adaptive list of starter prompts for the current user.

+16
-5

@@ -193,2 +193,5 @@ // ../oauth-helper/src/errors.ts

});
if (params.resource !== undefined && params.resource.length > 0) {
body.set("resource", params.resource);
}
let res;

@@ -338,3 +341,4 @@ try {

code: options.code,
codeVerifier: options.codeVerifier
codeVerifier: options.codeVerifier,
resource: options.resource ?? `${apiUrl}/mcp`
}, { fetchImpl });

@@ -358,3 +362,3 @@ const claims = decodeJwtPayload(tokenResponse.access_token);

const apiUrl = stripTrailingSlashes2(options.apiUrl);
const url = `${apiUrl}/mcp/${encodeURIComponent(options.workspaceId)}/sse`;
const url = `${apiUrl}/mcp/${encodeURIComponent(options.workspaceId)}`;
const isMultiWorkspace = (options.workspaces?.length ?? 0) > 0;

@@ -365,2 +369,3 @@ if (isMultiWorkspace && !options.workspaces.includes(options.workspaceId)) {

const block = isMultiWorkspace ? {
type: "http",
url,

@@ -370,2 +375,3 @@ headers: { Authorization: `Bearer ${options.accessToken}` },

} : {
type: "http",
url,

@@ -379,6 +385,7 @@ headers: { Authorization: `Bearer ${options.accessToken}` }

kind: "bare",
type: block.type,
url: block.url,
headers: block.headers,
env: block.env
} : { kind: "bare", url: block.url, headers: block.headers };
} : { kind: "bare", type: block.type, url: block.url, headers: block.headers };
case "claude-desktop":

@@ -631,4 +638,8 @@ case "cursor":

},
async listTables() {
const res = await get("/api/v1/tables");
async listTables(opts) {
const params = new URLSearchParams;
if (opts?.connectionId != null)
params.set("connectionId", opts.connectionId);
const qs = params.toString();
const res = await get(`/api/v1/tables${qs ? `?${qs}` : ""}`);
return unwrap(res);

@@ -635,0 +646,0 @@ },

@@ -16,4 +16,5 @@ /**

*/
export { createAtlasClient, AtlasError, type AtlasErrorCode, type AtlasClient, type AtlasClientOptions, type QueryOptions, type QueryResponse, type Conversation, type Message, type ConversationWithMessages, type ListConversationsResponse, type ListConversationsOptions, type ChatMessage, type ChatOptions, type ShareConversationResponse, type StreamEvent, type StreamFinishReason, type StreamQueryOptions, type DeliveryChannel, type Recipient, type ScheduledTaskRecipient, type ScheduledTask, type ScheduledTaskWithRuns, type ScheduledTaskRun, type ListScheduledTasksResponse, type ListScheduledTasksOptions, type CreateScheduledTaskInput, type UpdateScheduledTaskInput, type DBType, type HealthStatus, type ConnectionHealth, type ConnectionInfo, type ConnectionDetail, type ConnectionHealthCheck, type PluginType, type PluginStatus, type AuthMode, type AdminOverview, type EntitySummary, type SemanticStats, type AuditLogEntry, type AuditLogResponse, type AuditLogOptions, type AuditStats, type PluginInfo, type PluginHealthCheckResponse, type RunStatus, type ActionApprovalMode, type ValidateSQLResponse, type ValidationLayer, type ActionStatus, type RollbackActionResponse, type ListTablesResponse, type TableInfo, type TableColumn, type StarterPrompt, type StarterPromptProvenance, type StarterPromptsResponse, type GetStarterPromptsOptions, } from "./client";
export { createAtlasClient, AtlasError, type AtlasErrorCode, type AtlasClient, type AtlasClientOptions, type QueryOptions, type QueryResponse, type Conversation, type Message, type ConversationWithMessages, type ListConversationsResponse, type ListConversationsOptions, type ChatMessage, type ChatOptions, type ShareConversationResponse, type StreamEvent, type StreamFinishReason, type StreamQueryOptions, type DeliveryChannel, type Recipient, type ScheduledTaskRecipient, type ScheduledTask, type ScheduledTaskWithRuns, type ScheduledTaskRun, type ListScheduledTasksResponse, type ListScheduledTasksOptions, type CreateScheduledTaskInput, type UpdateScheduledTaskInput, type DBType, type HealthStatus, type ConnectionHealth, type ConnectionInfo, type ConnectionDetail, type ConnectionHealthCheck, type PluginType, type PluginStatus, type AuthMode, type AdminOverview, type EntitySummary, type SemanticStats, type AuditLogEntry, type AuditLogResponse, type AuditLogOptions, type AuditStats, type PluginInfo, type PluginHealthCheckResponse, type RunStatus, type ActionApprovalMode, type ValidateSQLResponse, type ValidationLayer, type ActionStatus, type RollbackActionResponse, type ListTablesResponse, type ListTablesOptions, type TableInfo, type TableColumn, type StarterPrompt, type StarterPromptProvenance, type StarterPromptsResponse, type GetStarterPromptsOptions, } from "./client";
export { fetchStarterPrompts, type FetchStarterPromptsConfig, type FetchStarterPromptsCredentials, } from "./fetch-starter-prompts";
export type { ConnectionContribution, ExecuteSqlResult, ExecuteSqlSuccessResult, ExecuteSqlFailureResult, } from "@useatlas/types";
export { AtlasMcpError, beginConnect, buildConfig, completeConnect, connectMachineToMachine, type AtlasMcpErrorCode, type BeginConnectOptions, type BeginConnectResult, type BuildConfigOptions, type CompleteConnectOptions, type CompleteConnectResult, type ConnectMachineToMachineOptions, type ConnectMachineToMachineResult, type ListAgentsResponse, type McpBareConfig, type McpClientConfig, type McpClientId, type McpHttpServer, type McpWrappedConfig, type RevokeAgentResponse, } from "./mcp";

@@ -193,2 +193,5 @@ // ../oauth-helper/src/errors.ts

});
if (params.resource !== undefined && params.resource.length > 0) {
body.set("resource", params.resource);
}
let res;

@@ -338,3 +341,4 @@ try {

code: options.code,
codeVerifier: options.codeVerifier
codeVerifier: options.codeVerifier,
resource: options.resource ?? `${apiUrl}/mcp`
}, { fetchImpl });

@@ -358,3 +362,3 @@ const claims = decodeJwtPayload(tokenResponse.access_token);

const apiUrl = stripTrailingSlashes2(options.apiUrl);
const url = `${apiUrl}/mcp/${encodeURIComponent(options.workspaceId)}/sse`;
const url = `${apiUrl}/mcp/${encodeURIComponent(options.workspaceId)}`;
const isMultiWorkspace = (options.workspaces?.length ?? 0) > 0;

@@ -365,2 +369,3 @@ if (isMultiWorkspace && !options.workspaces.includes(options.workspaceId)) {

const block = isMultiWorkspace ? {
type: "http",
url,

@@ -370,2 +375,3 @@ headers: { Authorization: `Bearer ${options.accessToken}` },

} : {
type: "http",
url,

@@ -379,6 +385,7 @@ headers: { Authorization: `Bearer ${options.accessToken}` }

kind: "bare",
type: block.type,
url: block.url,
headers: block.headers,
env: block.env
} : { kind: "bare", url: block.url, headers: block.headers };
} : { kind: "bare", type: block.type, url: block.url, headers: block.headers };
case "claude-desktop":

@@ -631,4 +638,8 @@ case "cursor":

},
async listTables() {
const res = await get("/api/v1/tables");
async listTables(opts) {
const params = new URLSearchParams;
if (opts?.connectionId != null)
params.set("connectionId", opts.connectionId);
const qs = params.toString();
const res = await get(`/api/v1/tables${qs ? `?${qs}` : ""}`);
return unwrap(res);

@@ -635,0 +646,0 @@ },

@@ -129,2 +129,17 @@ /**

issuer?: string;
/**
* RFC 8707 resource indicator bound to the issued token. Defaults to
* `${apiUrl}/mcp` — the hosted MCP endpoint this token authenticates
* against. Better Auth's `@better-auth/oauth-provider` only mints a
* **signed JWT** access token (vs an opaque one) when the token
* request carries a `resource`; this `completeConnect` flow immediately
* `decodeJwtPayload`s the token to read the workspace claim, so without
* the indicator a real hosted exchange yields an opaque token and fails
* with `malformed_jwt` (#3526 — same bug class as the CLI's #3493).
*
* Pass an explicit value only when the hosted MCP endpoint is mounted
* somewhere other than `${apiUrl}/mcp`; otherwise leave it unset and
* the default applies.
*/
resource?: string;
/** Test seam. */

@@ -176,6 +191,6 @@ fetchImpl?: typeof fetch;

* tokens this is required — the hosted MCP edge mounts at
* `/mcp/{workspace_id}/sse`. For multi-workspace setups pass the
* default-workspace id (typically the singular claim from
* `completeConnect`); per-request overrides happen via the
* `X-Atlas-Workspace` header.
* `/mcp/{workspace_id}` (canonical Streamable-HTTP path, no `/sse`). For
* multi-workspace setups pass the default-workspace id (typically the
* singular claim from `completeConnect`); per-request overrides happen
* via the `X-Atlas-Workspace` header.
*/

@@ -198,6 +213,7 @@ workspaceId: string;

* in the path, but the implemented hosted MCP endpoint mounts at
* `/mcp/{workspace_id}/sse` and resolves per-request overrides via
* the `X-Atlas-Workspace` header. The SDK emits the implemented
* shape — a single config block, one default workspace in the
* path, and the env hint for per-request overrides.
* `/mcp/{workspace_id}` (canonical Streamable-HTTP path) and resolves
* per-request overrides via the `X-Atlas-Workspace` header. The SDK
* emits the implemented shape — a single config block, `type: "http"`,
* one default workspace in the path, and the env hint for per-request
* overrides.
*

@@ -210,2 +226,12 @@ * Omit (or pass an empty array) for the legacy single-workspace

export interface McpHttpServer {
/**
* Transport discriminator — always `"http"` (Streamable HTTP). Pins the
* transport for clients that key off it explicitly (Claude Code, VS
* Code); without it those clients guess from the URL and a bare `{ url }`
* defaulted them to the deprecated HTTP+SSE transport, which the hosted
* endpoint no longer speaks, so the first request 400s. Clients that
* auto-detect (Cursor, Continue) ignore the field. Matches the CLI's
* hosted-config writer in `plugins/mcp/src/init/config-merge.ts`.
*/
type: "http";
url: string;

@@ -212,0 +238,0 @@ headers: {

@@ -193,2 +193,5 @@ // ../oauth-helper/src/errors.ts

});
if (params.resource !== undefined && params.resource.length > 0) {
body.set("resource", params.resource);
}
let res;

@@ -338,3 +341,4 @@ try {

code: options.code,
codeVerifier: options.codeVerifier
codeVerifier: options.codeVerifier,
resource: options.resource ?? `${apiUrl}/mcp`
}, { fetchImpl });

@@ -358,3 +362,3 @@ const claims = decodeJwtPayload(tokenResponse.access_token);

const apiUrl = stripTrailingSlashes2(options.apiUrl);
const url = `${apiUrl}/mcp/${encodeURIComponent(options.workspaceId)}/sse`;
const url = `${apiUrl}/mcp/${encodeURIComponent(options.workspaceId)}`;
const isMultiWorkspace = (options.workspaces?.length ?? 0) > 0;

@@ -365,2 +369,3 @@ if (isMultiWorkspace && !options.workspaces.includes(options.workspaceId)) {

const block = isMultiWorkspace ? {
type: "http",
url,

@@ -370,2 +375,3 @@ headers: { Authorization: `Bearer ${options.accessToken}` },

} : {
type: "http",
url,

@@ -379,6 +385,7 @@ headers: { Authorization: `Bearer ${options.accessToken}` }

kind: "bare",
type: block.type,
url: block.url,
headers: block.headers,
env: block.env
} : { kind: "bare", url: block.url, headers: block.headers };
} : { kind: "bare", type: block.type, url: block.url, headers: block.headers };
case "claude-desktop":

@@ -385,0 +392,0 @@ case "cursor":

{
"name": "@useatlas/sdk",
"version": "0.1.0",
"version": "0.1.1",
"description": "TypeScript SDK for the Atlas text-to-SQL agent API",
"type": "module",
"scripts": {
"build": "rm -rf dist && bun build src/index.ts src/client.ts src/mcp.ts --outdir dist --target node --external '@useatlas/types' && bun x tsc -p tsconfig.build.json",
"build": "rm -rf dist && bun build src/index.ts src/client.ts src/mcp.ts --outdir dist --target node --external '@useatlas/types' && ./node_modules/.bin/tsgo -p tsconfig.build.json",
"prepublishOnly": "bun run build",

@@ -55,4 +55,5 @@ "test": "bun test src/__tests__/client.test.ts src/__tests__/stream.test.ts src/__tests__/integration.test.ts src/__tests__/stream-integration.test.ts src/__tests__/fetch-starter-prompts.test.ts src/__tests__/mcp.test.ts"

"devDependencies": {
"@atlas/oauth-helper": "workspace:*"
"@atlas/oauth-helper": "workspace:*",
"@typescript/native-preview": "^7.0.0-dev.20260623.1"
}
}