Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions backend/src/analytics_agent/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _validate_mcp_url(url: str) -> None:

class ConnectionField(BaseModel):
key: str
label: str
label: str | None
value: str
sensitive: bool = False
placeholder: str = ""
Expand Down Expand Up @@ -734,7 +734,10 @@ async def list_connections(session: AsyncSession = Depends(get_session)):
]
else:
status_str = "unconfigured"
fields = []
# get fields from conn_cfg.items, set key and value
fields = [
ConnectionField(key=k, label=None, value=str(v)) for (k, v) in conn_cfg.items()
]

oauth_status = (
OAuthStatus(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/api/settings.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface ConnectionField {
key: string;
label: string;
label: string | null;
value: string;
sensitive: boolean;
placeholder: string;
Expand Down
22 changes: 21 additions & 1 deletion frontend/src/components/Settings/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import { AddConnectionFlow } from "./connections/AddConnectionFlow";
import type { NewConnectionPayload, ConnectionPlugin } from "./connections/types";
import { ModelSection } from "./ModelSection";
import { AboutSection } from "./AboutSection";
import {CONNECTION_PLUGINS} from "@/components/Settings/connections";

type Section = "connections" | "model" | "prompt" | "display" | "about";

Expand Down Expand Up @@ -977,7 +978,26 @@ function ConnectionsSection() {

const CONTEXT_PLATFORM_TYPES = new Set(["datahub", "datahub-mcp"]);
const datahubConns = connections.filter((c) => CONTEXT_PLATFORM_TYPES.has(c.type));
const engineConns = connections.filter((c) => !CONTEXT_PLATFORM_TYPES.has(c.type) && c.type !== "chart");
const engineConns = connections.filter((c) => !CONTEXT_PLATFORM_TYPES.has(c.type) && c.type !== "chart")
.map(conn =>{
// rebuild fields from plugin definition, carrying over stored values
const plugin = CONNECTION_PLUGINS.find(p => p.id === conn.type)
if (plugin && plugin.fields.length > 0) {
conn.fields = plugin.fields.map(pf => {
const value = conn.fields.find(f => f.key === pf.key)?.value ?? ""
const field: ConnectionField = {
key: pf.key,
label: pf.label,
value: value,
sensitive: pf.type === "password",
placeholder: pf.placeholder ?? "",
secret_key: ""
}
return field
})
}
return conn
})

return (
<div className="space-y-6">
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/Settings/connections/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function createSimplePlugin(spec: SimplePluginSpec): ConnectionPlugin {
category: spec.category,
transport: "native",
description: spec.description,
fields: spec.fields,
icon: spec.icon,
Form: ({ onDone, onCancel }) => (
<SimpleFormShell
Expand Down Expand Up @@ -93,6 +94,7 @@ export function createMcpStdioPlugin(spec: McpStdioPluginSpec): ConnectionPlugin
transport: "mcp-stdio",
description: spec.description,
icon: spec.icon,
fields: fields,
Form: ({ onDone, onCancel }) => (
<SimpleFormShell
fields={fields}
Expand Down Expand Up @@ -168,6 +170,7 @@ export function createMcpSsePlugin(spec: McpSsePluginSpec): ConnectionPlugin {
transport: "mcp-sse",
description: spec.description,
icon: spec.icon,
fields: fields,
Form: ({ onDone, onCancel }) => (
<SimpleFormShell
fields={fields}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@ export const bigqueryPlugin: ConnectionPlugin = {
category: "engine",
transport: "native",
description: "Connect to Google BigQuery",
fields: FIELDS,
Form: BigQueryForm,
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const customMcpEnginePlugin: ConnectionPlugin = {
category: "engine",
transport: "mcp-stdio",
description: "Connect to any MCP-compatible data source",
fields: [],
Form: GenericMcpForm,
};

Expand All @@ -18,5 +19,6 @@ export const customMcpContextPlugin: ConnectionPlugin = {
category: "context_platform",
transport: "mcp-stdio",
description: "Connect to any MCP-compatible context platform",
fields: [],
Form: GenericMcpForm,
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ function normalizeAcrylMcpUrl(raw: string): string {
return withScheme;
}

const FIELDS = [
{
key: "url",
label: "MCP server URL",
type: "mono" as const,
placeholder: "https://<tenant>.acryl.io/integrations/ai/mcp/",
required: true,
transform: normalizeAcrylMcpUrl,
},
{
key: "token",
label: "Access token",
type: "password" as const,
placeholder: "eyJhbGci…",
required: true,
hint: "Sent as Authorization: Bearer <token>",
},
]

function DataHubMcpForm({
onDone,
onCancel,
Expand All @@ -26,24 +45,7 @@ function DataHubMcpForm({
}) {
return (
<SimpleFormShell
fields={[
{
key: "url",
label: "MCP server URL",
type: "mono",
placeholder: "https://<tenant>.acryl.io/integrations/ai/mcp/",
required: true,
transform: normalizeAcrylMcpUrl,
},
{
key: "token",
label: "Access token",
type: "password",
placeholder: "eyJhbGci…",
required: true,
hint: "Sent as Authorization: Bearer <token>",
},
]}
fields={FIELDS}
onCancel={onCancel}
onDone={async (payload) => {
const { url, token, ...rest } = payload.config;
Expand All @@ -68,5 +70,6 @@ export const datahubMcpPlugin: ConnectionPlugin = {
category: "context_platform",
transport: "mcp-sse",
description: "Connect to DataHub through its managed MCP server",
fields: FIELDS,
Form: DataHubMcpForm,
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const mysqlPlugin: ConnectionPlugin = {
category: "engine",
transport: "native",
description: "Connect to a MySQL or MariaDB database",
fields: FIELDS,
Form: ({ onDone, onCancel }) => (
<SimpleFormShell
fields={FIELDS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const postgresqlPlugin: ConnectionPlugin = {
category: "engine",
transport: "native",
description: "Connect to a PostgreSQL database",
fields: FIELDS,
Form: ({ onDone, onCancel }) => (
<SimpleFormShell
fields={FIELDS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,5 +215,6 @@ export const snowflakePlugin: ConnectionPlugin = {
category: "engine",
transport: "native",
description: "Direct connection to Snowflake cloud data warehouse",
fields: [],
Form: SnowflakeForm,
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const sqlitePlugin: ConnectionPlugin = {
category: "engine",
transport: "native",
description: "Connect to a local SQLite database file",
fields: FIELDS,
Form: ({ onDone, onCancel }) => (
<SimpleFormShell
fields={FIELDS}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Settings/connections/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface ConnectionPlugin {
category: ConnectionCategory;
transport: ConnectionTransport;
description: string;
fields: FieldDef[];
icon?: React.ReactNode;
Form: React.FC<{
onDone: (payload: NewConnectionPayload) => void;
Expand Down
Loading