snowflake-analytics-mcp-server 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -103,7 +103,7 @@ These are additive generative-AI tools (token-billed, higher latency than the SQ
103
103
  | `cortex_summarize` | `text` | Concise summary of a text |
104
104
  | `cortex_classify` | `text`, `categories[]` | Classify text into your categories via AI_CLASSIFY |
105
105
  | `cortex_translate` | `text`, `to_language`, `from_language?` | Translate text (source auto-detected when omitted) |
106
-
106
+ | `SNOWFLAKE_PARTNER_CSID` | recommended | AnalyticsModel_MCP | Partner Connection String Identifier registered on SPN; sent as the Snowflake application tag for Connected-Application telemetry |
107
107
  `cortex_ask` generates SQL and always restricts it to read-only statements, regardless of `SNOWFLAKE_READ_ONLY`.
108
108
 
109
109
  **Cortex prerequisites:** the account must be in a region that supports Cortex, and the connecting role needs the `SNOWFLAKE.CORTEX_USER` database role plus the `USE AI FUNCTIONS` privilege. If a Cortex call fails on region or privileges, the tool returns a hint explaining what to grant.
@@ -15,6 +15,7 @@ export interface SnowflakeConfig {
15
15
  readOnly: boolean;
16
16
  cortexEnabled: boolean;
17
17
  cortexModel: string;
18
+ csid: string;
18
19
  }
19
20
  export declare function loadConfig(): SnowflakeConfig;
20
21
  export declare function getConfig(): SnowflakeConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"snowflake.d.ts","sourceRoot":"","sources":["../src/snowflake.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ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BAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExD"}
package/dist/snowflake.js CHANGED
@@ -28,6 +28,26 @@ function req(name) {
28
28
  }
29
29
  return v.trim();
30
30
  }
31
+ /**
32
+ * Validate the partner CSID before it's used as the `application` connection
33
+ * option. The snowflake-sdk validates this field itself (first character must
34
+ * be a LETTER, followed by letters/digits/`._-`, with a length cap), so we
35
+ * mirror that here to fail loudly with a clear message rather than a cryptic
36
+ * driver error at connect time.
37
+ *
38
+ * NOTE: confirm the exact bounds against your INSTALLED driver version — they
39
+ * can shift between releases:
40
+ * grep -rn "application" node_modules/snowflake-sdk/lib/connection/connection_config.js
41
+ * Align this regex to whatever that shows, and also to section 4 of the
42
+ * Snowflake Native Connector Best Practice Guide (the CSID naming convention).
43
+ */
44
+ function validateCsid(csid) {
45
+ if (!/^[A-Za-z][A-Za-z0-9._-]{0,49}$/.test(csid)) {
46
+ throw new Error(`Invalid SNOWFLAKE_PARTNER_CSID "${csid}". Must start with a letter, then ` +
47
+ `letters, digits, and . _ - (max 50 chars).`);
48
+ }
49
+ return csid;
50
+ }
31
51
  /**
32
52
  * Normalize a private key into valid PEM regardless of how it survived transport.
33
53
  * Handles: proper multi-line PEM, PEM with literal `\n`, PEM flattened onto one
@@ -88,6 +108,9 @@ export function loadConfig() {
88
108
  // Cortex AI tools are on by default; set SNOWFLAKE_CORTEX_ENABLED=false to hide them.
89
109
  cortexEnabled: (process.env.SNOWFLAKE_CORTEX_ENABLED || "true").toLowerCase() !== "false",
90
110
  cortexModel: (process.env.SNOWFLAKE_CORTEX_MODEL || "llama3.1-8b").trim(),
111
+ // Partner Connection String Identifier registered on SPN. Override via
112
+ // SNOWFLAKE_PARTNER_CSID if it ever changes.
113
+ csid: validateCsid((process.env.SNOWFLAKE_PARTNER_CSID || "Analytics-model").trim()),
91
114
  };
92
115
  }
93
116
  let cfg = null;
@@ -103,7 +126,7 @@ function buildConnection(c) {
103
126
  username: c.username,
104
127
  authenticator: c.authenticator,
105
128
  clientSessionKeepAlive: true,
106
- application: "AnalyticsModel_MCP",
129
+ application: c.csid,
107
130
  };
108
131
  if (c.password)
109
132
  opts.password = c.password;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snowflake-analytics-mcp-server",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Snowflake MCP server for the Analytics Model platform. Table discovery, SQL query, and Cortex AI tools over stdio, runnable via npx.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",