@transcend-io/mcp-server-preferences 0.3.6 → 0.4.1

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
@@ -6,7 +6,7 @@ Transcend MCP Server for privacy preference management. Provides tools for query
6
6
 
7
7
  Requires **Node.js ≥ 22.12** (see `engines` in `package.json`).
8
8
 
9
- For local runs from this repository, copy [`secret.env.example`](../../../secret.env.example) to **`secret.env`** at the repo root (gitignored) and set your API key (see **Run from the monorepo**). The key must be created with **MCP** enabled in the Transcend dashboard (a toggle when you create the key).
9
+ For local runs from this repository, copy [`secret.env.example`](../../../secret.env.example) to **`secret.env`** at the repo root (gitignored) and set the OAuth environment variables (see **Run from the monorepo**).
10
10
 
11
11
  ## Install
12
12
 
@@ -21,12 +21,31 @@ Or run from a checkout of this repository (see **Run from the monorepo** below).
21
21
  ## Usage
22
22
 
23
23
  ```bash
24
- # With TRANSCEND_API_KEY in the environment; from the monorepo use secret.env (see Run from the monorepo)
25
- TRANSCEND_API_KEY=your-api-key transcend-mcp-preferences
24
+ # With OAuth env vars in the environment; from the monorepo use secret.env (see Run from the monorepo)
25
+ TRANSCEND_OAUTH_CLIENT_ID=your-client-id \
26
+ TRANSCEND_OAUTH_CLIENT_SECRET=your-client-secret \
27
+ TRANSCEND_OAUTH_REDIRECT_PORT=your-client-redirect-port \
28
+ transcend-mcp-preferences
26
29
  ```
27
30
 
28
31
  The process speaks MCP over **stdio** and is meant to be launched by an MCP client (for example Cursor or Claude Desktop), not used as an interactive shell.
29
32
 
33
+ ### OAuth client setup
34
+
35
+ OAuth stdio is the recommended path for MCP clients (Cursor, Claude Desktop). Requires **org admin** access to create OAuth clients.
36
+
37
+ 1. Navigate to [app.transcend.com/admin/oauth-clients](https://app.transcend.com/admin/oauth-clients) and create an OAuth client.
38
+ 2. Copy the **client ID** and **client secret**.
39
+ 3. Register `http://127.0.0.1:{port}/callback` — use **`127.0.0.1`, not `localhost`**, and ensure the path is `/callback`. Set `TRANSCEND_OAUTH_REDIRECT_PORT` to the matching port.
40
+
41
+ At startup the server verifies client ID, secret, and redirect URI. On first tool call it opens a browser for login. Tokens are session-only (in-memory).
42
+
43
+ **OAuth scopes:** `ViewPrivacyCenter`, `ManagePrivacyCenter`. The signed-in user must hold these permissions. See [`src/scopes.ts`](./src/scopes.ts).
44
+
45
+ Full setup, troubleshooting, and multi-server guidance: [MCP root README](../README.md#oauth-client-setup).
46
+
47
+ > **API key alternative:** set `TRANSCEND_API_KEY` instead of OAuth vars for stdio (OAuth is disabled when both are set).
48
+
30
49
  ### MCP client configuration
31
50
 
32
51
  `npx` runs the package’s `transcend-mcp-preferences` binary (see `bin` in `package.json`).
@@ -38,7 +57,9 @@ The process speaks MCP over **stdio** and is meant to be launched by an MCP clie
38
57
  "command": "npx",
39
58
  "args": ["-y", "@transcend-io/mcp-server-preferences"],
40
59
  "env": {
41
- "TRANSCEND_API_KEY": "your-api-key"
60
+ "TRANSCEND_OAUTH_CLIENT_ID": "your-client-id",
61
+ "TRANSCEND_OAUTH_CLIENT_SECRET": "your-client-secret",
62
+ "TRANSCEND_OAUTH_REDIRECT_PORT": "your-client-redirect-port"
42
63
  }
43
64
  }
44
65
  }
@@ -49,7 +70,7 @@ When developing in this repository, reuse the same variable names from root **`s
49
70
 
50
71
  ### Run from the monorepo
51
72
 
52
- 1. **Credentials** — From the repository root, copy [`secret.env.example`](../../../secret.env.example) to **`secret.env`** and set `TRANSCEND_API_KEY` (and optional URL overrides).
73
+ 1. **Credentials** — From the repository root, copy [`secret.env.example`](../../../secret.env.example) to **`secret.env`** and set `TRANSCEND_OAUTH_CLIENT_ID`, `TRANSCEND_OAUTH_CLIENT_SECRET`, and `TRANSCEND_OAUTH_REDIRECT_PORT` (and optional URL overrides).
53
74
 
54
75
  2. **Build and run** — `node ./dist/cli.mjs` matches the `transcend-mcp-preferences` `bin` (use `node` because `pnpm exec transcend-mcp-preferences` may not resolve this package’s own binary in a pnpm workspace):
55
76
 
@@ -66,11 +87,16 @@ See [CONTRIBUTING.md](../../../CONTRIBUTING.md#mcp-servers) for workspace layout
66
87
 
67
88
  ### Environment variables
68
89
 
69
- | Variable | Required | Default | Description |
70
- | ------------------- | -------- | ------------------------------------------ | -------------------------------------------------- |
71
- | `TRANSCEND_API_KEY` | Yes | — | Transcend API key |
72
- | `TRANSCEND_API_URL` | No | `https://api.transcend.io` | GraphQL backend API URL (matches CLI convention) |
73
- | `SOMBRA_URL` | No | `https://multi-tenant.sombra.transcend.io` | Sombra REST API URL (matches CLI / SDK convention) |
90
+ | Variable | Required (stdio OAuth) | Default | Description |
91
+ | ------------------------------- | ---------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
92
+ | `TRANSCEND_OAUTH_CLIENT_ID` | Yes | — | Client ID from [app.transcend.com/admin/oauth-clients](https://app.transcend.com/admin/oauth-clients) |
93
+ | `TRANSCEND_OAUTH_CLIENT_SECRET` | Yes | | Client secret from the same OAuth clients page |
94
+ | `TRANSCEND_OAUTH_REDIRECT_PORT` | Yes | | Localhost port for the OAuth callback server; **must match the port in your registered redirect URI** |
95
+ | `TRANSCEND_OAUTH_REDIRECT_HOST` | No | `127.0.0.1` | Loopback host for the OAuth callback (`127.0.0.1` or `::1` for `http://[::1]:{port}/callback`) |
96
+ | `TRANSCEND_OAUTH_ISSUER` | No | auto-detected | OAuth issuer URL; production auto-detects region. Test-only override |
97
+ | `TRANSCEND_API_KEY` | No | — | API key for stdio (alternative to OAuth). Disables OAuth when set alongside client ID |
98
+ | `TRANSCEND_API_URL` | No | `https://api.transcend.io` | GraphQL backend API URL (matches CLI convention) |
99
+ | `SOMBRA_URL` | No | `https://multi-tenant.sombra.transcend.io` | Sombra REST API URL (matches CLI / SDK convention) |
74
100
 
75
101
  **Monorepo:** keep these in root **`secret.env`** (from [`secret.env.example`](../../../secret.env.example)); see **Run from the monorepo**.
76
102
 
package/dist/cli.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { t as getPreferenceTools } from "./tools-b51SJyJn.mjs";
2
+ import { n as getPreferenceTools, t as PREFERENCE_OAUTH_SCOPES } from "./scopes-Ck0_EcNu.mjs";
3
3
  import { TranscendGraphQLBase, TranscendRestClient, createMCPServer } from "@transcend-io/mcp-server-base";
4
4
  //#region src/cli.ts
5
5
  createMCPServer({
6
6
  name: "transcend-mcp-preferences",
7
7
  version: "1.0.0",
8
+ oauthScopes: PREFERENCE_OAUTH_SCOPES,
8
9
  getTools: getPreferenceTools,
9
10
  createClients: ({ auth, sombraUrl, graphqlUrl, dashboardUrl }) => ({
10
11
  rest: new TranscendRestClient(auth, sombraUrl),
package/dist/cli.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {\n createMCPServer,\n TranscendGraphQLBase,\n TranscendRestClient,\n} from '@transcend-io/mcp-server-base';\n\nimport { getPreferenceTools } from './tools/index.js';\n\ncreateMCPServer({\n name: 'transcend-mcp-preferences',\n version: '1.0.0',\n getTools: getPreferenceTools,\n createClients: ({ auth, sombraUrl, graphqlUrl, dashboardUrl }) => ({\n rest: new TranscendRestClient(auth, sombraUrl),\n graphql: new TranscendGraphQLBase(auth, graphqlUrl),\n dashboardUrl,\n }),\n});\n"],"mappings":";;;;AASA,gBAAgB;CACd,MAAM;CACN,SAAS;CACT,UAAU;CACV,gBAAgB,EAAE,MAAM,WAAW,YAAY,oBAAoB;EACjE,MAAM,IAAI,oBAAoB,MAAM,UAAU;EAC9C,SAAS,IAAI,qBAAqB,MAAM,WAAW;EACnD;EACD;CACF,CAAC"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {\n createMCPServer,\n TranscendGraphQLBase,\n TranscendRestClient,\n} from '@transcend-io/mcp-server-base';\n\nimport { PREFERENCE_OAUTH_SCOPES } from './scopes.js';\nimport { getPreferenceTools } from './tools/index.js';\n\ncreateMCPServer({\n name: 'transcend-mcp-preferences',\n version: '1.0.0',\n oauthScopes: PREFERENCE_OAUTH_SCOPES,\n getTools: getPreferenceTools,\n createClients: ({ auth, sombraUrl, graphqlUrl, dashboardUrl }) => ({\n rest: new TranscendRestClient(auth, sombraUrl),\n graphql: new TranscendGraphQLBase(auth, graphqlUrl),\n dashboardUrl,\n }),\n});\n"],"mappings":";;;;AAUA,gBAAgB;CACd,MAAM;CACN,SAAS;CACT,aAAa;CACb,UAAU;CACV,gBAAgB,EAAE,MAAM,WAAW,YAAY,oBAAoB;EACjE,MAAM,IAAI,oBAAoB,MAAM,UAAU;EAC9C,SAAS,IAAI,qBAAqB,MAAM,WAAW;EACnD;EACD;CACF,CAAC"}
package/dist/index.d.mts CHANGED
@@ -1,8 +1,13 @@
1
1
  import { ToolClients, ToolDefinition, z } from "@transcend-io/mcp-server-base";
2
+ import { ScopeName } from "@transcend-io/privacy-types";
2
3
 
3
4
  //#region src/tools/index.d.ts
4
5
  declare function getPreferenceTools(clients: ToolClients): ToolDefinition[];
5
6
  //#endregion
7
+ //#region src/scopes.d.ts
8
+ /** OAuth scopes required for Preference MCP tools (offline_access added by base). */
9
+ declare const PREFERENCE_OAUTH_SCOPES: readonly [ScopeName.ViewPrivacyCenter, ScopeName.ManagePrivacyCenter];
10
+ //#endregion
6
11
  //#region src/tools/preferences_query.d.ts
7
12
  declare const IdentifierSchema: z.ZodObject<{
8
13
  value: z.ZodString;
@@ -61,7 +66,7 @@ type DeletePreferencesInput = z.infer<typeof DeletePreferencesSchema>;
61
66
  //#region src/tools/preferences_append_identifiers.d.ts
62
67
  declare const AppendIdentifiersSchema: z.ZodObject<{
63
68
  partition: z.ZodString;
64
- user_id: z.ZodString;
69
+ userId: z.ZodString;
65
70
  identifiers: z.ZodArray<z.ZodObject<{
66
71
  value: z.ZodString;
67
72
  type: z.ZodOptional<z.ZodString>;
@@ -78,7 +83,7 @@ declare const UpdateIdentifiersItemSchema: z.ZodObject<{
78
83
  type UpdateIdentifiersItemInput = z.infer<typeof UpdateIdentifiersItemSchema>;
79
84
  declare const UpdateIdentifiersSchema: z.ZodObject<{
80
85
  partition: z.ZodString;
81
- user_id: z.ZodString;
86
+ userId: z.ZodString;
82
87
  identifiers: z.ZodArray<z.ZodObject<{
83
88
  oldValue: z.ZodString;
84
89
  newValue: z.ZodString;
@@ -90,7 +95,7 @@ type UpdateIdentifiersInput = z.infer<typeof UpdateIdentifiersSchema>;
90
95
  //#region src/tools/preferences_delete_identifiers.d.ts
91
96
  declare const DeleteIdentifiersSchema: z.ZodObject<{
92
97
  partition: z.ZodString;
93
- user_id: z.ZodString;
98
+ userId: z.ZodString;
94
99
  identifiers: z.ZodArray<z.ZodObject<{
95
100
  value: z.ZodString;
96
101
  type: z.ZodOptional<z.ZodString>;
@@ -98,5 +103,5 @@ declare const DeleteIdentifiersSchema: z.ZodObject<{
98
103
  }, z.core.$strip>;
99
104
  type DeleteIdentifiersInput = z.infer<typeof DeleteIdentifiersSchema>;
100
105
  //#endregion
101
- export { type AppendIdentifiersInput, AppendIdentifiersSchema, type DeleteIdentifiersInput, DeleteIdentifiersSchema, type DeletePreferencesInput, DeletePreferencesSchema, type IdentifierInput, IdentifierSchema, type QueryPreferencesInput, QueryPreferencesSchema, type UpdateIdentifiersInput, type UpdateIdentifiersItemInput, UpdateIdentifiersItemSchema, UpdateIdentifiersSchema, type UpsertPreferencesInput, type UpsertPreferencesPurposeInput, UpsertPreferencesPurposeSchema, type UpsertPreferencesRecordInput, UpsertPreferencesRecordSchema, UpsertPreferencesSchema, getPreferenceTools };
106
+ export { type AppendIdentifiersInput, AppendIdentifiersSchema, type DeleteIdentifiersInput, DeleteIdentifiersSchema, type DeletePreferencesInput, DeletePreferencesSchema, type IdentifierInput, IdentifierSchema, PREFERENCE_OAUTH_SCOPES, type QueryPreferencesInput, QueryPreferencesSchema, type UpdateIdentifiersInput, type UpdateIdentifiersItemInput, UpdateIdentifiersItemSchema, UpdateIdentifiersSchema, type UpsertPreferencesInput, type UpsertPreferencesPurposeInput, UpsertPreferencesPurposeSchema, type UpsertPreferencesRecordInput, UpsertPreferencesRecordSchema, UpsertPreferencesSchema, getPreferenceTools };
102
107
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/tools/index.ts","../src/tools/preferences_query.ts","../src/tools/preferences_upsert.ts","../src/tools/preferences_delete.ts","../src/tools/preferences_append_identifiers.ts","../src/tools/preferences_update_identifiers.ts","../src/tools/preferences_delete_identifiers.ts"],"mappings":";;;iBASgB,kBAAA,CAAmB,OAAA,EAAS,WAAA,GAAc,cAAA;;;cCP7C,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;KAIjB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,gBAAA;AAAA,cAEhC,sBAAA,EAAsB,CAAA,CAAA,SAAA;;;;;;;KAIvB,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,sBAAA;;;cCVtC,8BAAA,EAA8B,CAAA,CAAA,SAAA;;;;KAI/B,6BAAA,GAAgC,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAE9C,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;KAM9B,4BAAA,GAA+B,CAAA,CAAE,KAAA,QAAa,6BAAA;AAAA,cAE7C,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;;KAIxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cChBvC,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;KAIxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCJvC,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;KAKxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCPvC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;KAK5B,0BAAA,GAA6B,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,cAE3C,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;KAOxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCZvC,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;KAKxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/tools/index.ts","../src/scopes.ts","../src/tools/preferences_query.ts","../src/tools/preferences_upsert.ts","../src/tools/preferences_delete.ts","../src/tools/preferences_append_identifiers.ts","../src/tools/preferences_update_identifiers.ts","../src/tools/preferences_delete_identifiers.ts"],"mappings":";;;;iBASgB,kBAAA,CAAmB,OAAA,EAAS,WAAA,GAAc,cAAA;;;;cCN7C,uBAAA,YAAuB,SAAA,CAAA,iBAAA,EAAA,SAAA,CAAA,mBAAA;;;cCDvB,gBAAA,EAAgB,CAAA,CAAA,SAAA;;;;KAIjB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,gBAAA;AAAA,cAEhC,sBAAA,EAAsB,CAAA,CAAA,SAAA;;;;;;;KAIvB,qBAAA,GAAwB,CAAA,CAAE,KAAA,QAAa,sBAAA;;;cCVtC,8BAAA,EAA8B,CAAA,CAAA,SAAA;;;;KAI/B,6BAAA,GAAgC,CAAA,CAAE,KAAA,QAAa,8BAAA;AAAA,cAE9C,6BAAA,EAA6B,CAAA,CAAA,SAAA;;;;;;;;;KAM9B,4BAAA,GAA+B,CAAA,CAAE,KAAA,QAAa,6BAAA;AAAA,cAE7C,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;;;;KAIxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cChBvC,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;KAIxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCJvC,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;KAKxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCPvC,2BAAA,EAA2B,CAAA,CAAA,SAAA;;;;;KAK5B,0BAAA,GAA6B,CAAA,CAAE,KAAA,QAAa,2BAAA;AAAA,cAE3C,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;;KAOxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA;;;cCZvC,uBAAA,EAAuB,CAAA,CAAA,SAAA;;;;;;;;KAKxB,sBAAA,GAAyB,CAAA,CAAE,KAAA,QAAa,uBAAA"}
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as UpdateIdentifiersItemSchema, c as DeletePreferencesSchema, d as QueryPreferencesSchema, i as UpsertPreferencesSchema, l as AppendIdentifiersSchema, n as UpsertPreferencesPurposeSchema, o as UpdateIdentifiersSchema, r as UpsertPreferencesRecordSchema, s as DeleteIdentifiersSchema, t as getPreferenceTools, u as IdentifierSchema } from "./tools-b51SJyJn.mjs";
2
- export { AppendIdentifiersSchema, DeleteIdentifiersSchema, DeletePreferencesSchema, IdentifierSchema, QueryPreferencesSchema, UpdateIdentifiersItemSchema, UpdateIdentifiersSchema, UpsertPreferencesPurposeSchema, UpsertPreferencesRecordSchema, UpsertPreferencesSchema, getPreferenceTools };
1
+ import { a as UpsertPreferencesSchema, c as DeleteIdentifiersSchema, d as IdentifierSchema, f as QueryPreferencesSchema, i as UpsertPreferencesRecordSchema, l as DeletePreferencesSchema, n as getPreferenceTools, o as UpdateIdentifiersItemSchema, r as UpsertPreferencesPurposeSchema, s as UpdateIdentifiersSchema, t as PREFERENCE_OAUTH_SCOPES, u as AppendIdentifiersSchema } from "./scopes-Ck0_EcNu.mjs";
2
+ export { AppendIdentifiersSchema, DeleteIdentifiersSchema, DeletePreferencesSchema, IdentifierSchema, PREFERENCE_OAUTH_SCOPES, QueryPreferencesSchema, UpdateIdentifiersItemSchema, UpdateIdentifiersSchema, UpsertPreferencesPurposeSchema, UpsertPreferencesRecordSchema, UpsertPreferencesSchema, getPreferenceTools };
@@ -1,4 +1,5 @@
1
1
  import { createListResult, createToolResult, defineTool, z } from "@transcend-io/mcp-server-base";
2
+ import { ScopeName } from "@transcend-io/privacy-types";
2
3
  //#region src/tools/preferences_query.ts
3
4
  const IdentifierSchema = z.object({
4
5
  value: z.string().describe("Identifier value"),
@@ -37,7 +38,7 @@ function createPreferencesQueryTool(clients) {
37
38
  //#region src/tools/preferences_append_identifiers.ts
38
39
  const AppendIdentifiersSchema = z.object({
39
40
  partition: z.string().describe("Partition/organization context"),
40
- user_id: z.string().describe("User ID to append identifiers to"),
41
+ userId: z.string().describe("User ID to append identifiers to"),
41
42
  identifiers: z.array(IdentifierSchema).describe("Array of identifier objects to append")
42
43
  });
43
44
  function createPreferencesAppendIdentifiersTool(clients) {
@@ -54,9 +55,9 @@ function createPreferencesAppendIdentifiersTool(clients) {
54
55
  idempotentHint: false
55
56
  },
56
57
  zodSchema: AppendIdentifiersSchema,
57
- handler: async ({ partition, user_id, identifiers }) => {
58
+ handler: async ({ partition, userId, identifiers }) => {
58
59
  return createToolResult(true, {
59
- ...await rest.appendIdentifiers(partition, user_id, identifiers.map((id) => ({
60
+ ...await rest.appendIdentifiers(partition, userId, identifiers.map((id) => ({
60
61
  value: id.value,
61
62
  type: id.type
62
63
  }))),
@@ -102,7 +103,7 @@ function createPreferencesDeleteTool(clients) {
102
103
  //#region src/tools/preferences_delete_identifiers.ts
103
104
  const DeleteIdentifiersSchema = z.object({
104
105
  partition: z.string().describe("Partition/organization context"),
105
- user_id: z.string().describe("User ID to delete identifiers from"),
106
+ userId: z.string().describe("User ID to delete identifiers from"),
106
107
  identifiers: z.array(IdentifierSchema).describe("Array of identifier objects to delete")
107
108
  });
108
109
  function createPreferencesDeleteIdentifiersTool(clients) {
@@ -119,9 +120,9 @@ function createPreferencesDeleteIdentifiersTool(clients) {
119
120
  idempotentHint: false
120
121
  },
121
122
  zodSchema: DeleteIdentifiersSchema,
122
- handler: async ({ partition, user_id, identifiers }) => {
123
+ handler: async ({ partition, userId, identifiers }) => {
123
124
  return createToolResult(true, {
124
- ...await rest.deleteIdentifiers(partition, user_id, identifiers.map((id) => ({
125
+ ...await rest.deleteIdentifiers(partition, userId, identifiers.map((id) => ({
125
126
  value: id.value,
126
127
  type: id.type
127
128
  }))),
@@ -140,7 +141,7 @@ const UpdateIdentifiersItemSchema = z.object({
140
141
  });
141
142
  const UpdateIdentifiersSchema = z.object({
142
143
  partition: z.string().describe("Partition/organization context"),
143
- user_id: z.string().describe("User ID to update identifiers for"),
144
+ userId: z.string().describe("User ID to update identifiers for"),
144
145
  identifiers: z.array(UpdateIdentifiersItemSchema).describe("Array of identifier update objects with old and new values")
145
146
  });
146
147
  function createPreferencesUpdateIdentifiersTool(clients) {
@@ -157,9 +158,9 @@ function createPreferencesUpdateIdentifiersTool(clients) {
157
158
  idempotentHint: true
158
159
  },
159
160
  zodSchema: UpdateIdentifiersSchema,
160
- handler: async ({ partition, user_id, identifiers }) => {
161
+ handler: async ({ partition, userId, identifiers }) => {
161
162
  return createToolResult(true, {
162
- ...await rest.updateIdentifiers(partition, user_id, identifiers.map((id) => ({
163
+ ...await rest.updateIdentifiers(partition, userId, identifiers.map((id) => ({
163
164
  oldValue: id.oldValue,
164
165
  newValue: id.newValue,
165
166
  type: id.type
@@ -234,6 +235,10 @@ function getPreferenceTools(clients) {
234
235
  ];
235
236
  }
236
237
  //#endregion
237
- export { UpdateIdentifiersItemSchema as a, DeletePreferencesSchema as c, QueryPreferencesSchema as d, UpsertPreferencesSchema as i, AppendIdentifiersSchema as l, UpsertPreferencesPurposeSchema as n, UpdateIdentifiersSchema as o, UpsertPreferencesRecordSchema as r, DeleteIdentifiersSchema as s, getPreferenceTools as t, IdentifierSchema as u };
238
+ //#region src/scopes.ts
239
+ /** OAuth scopes required for Preference MCP tools (offline_access added by base). */
240
+ const PREFERENCE_OAUTH_SCOPES = [ScopeName.ViewPrivacyCenter, ScopeName.ManagePrivacyCenter];
241
+ //#endregion
242
+ export { UpsertPreferencesSchema as a, DeleteIdentifiersSchema as c, IdentifierSchema as d, QueryPreferencesSchema as f, UpsertPreferencesRecordSchema as i, DeletePreferencesSchema as l, getPreferenceTools as n, UpdateIdentifiersItemSchema as o, UpsertPreferencesPurposeSchema as r, UpdateIdentifiersSchema as s, PREFERENCE_OAUTH_SCOPES as t, AppendIdentifiersSchema as u };
238
243
 
239
- //# sourceMappingURL=tools-b51SJyJn.mjs.map
244
+ //# sourceMappingURL=scopes-Ck0_EcNu.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes-Ck0_EcNu.mjs","names":[],"sources":["../src/tools/preferences_query.ts","../src/tools/preferences_append_identifiers.ts","../src/tools/preferences_delete.ts","../src/tools/preferences_delete_identifiers.ts","../src/tools/preferences_update_identifiers.ts","../src/tools/preferences_upsert.ts","../src/tools/index.ts","../src/scopes.ts"],"sourcesContent":["import { createListResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nexport const IdentifierSchema = z.object({\n value: z.string().describe('Identifier value'),\n type: z.string().optional().describe('Identifier type (optional)'),\n});\nexport type IdentifierInput = z.infer<typeof IdentifierSchema>;\n\nexport const QueryPreferencesSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to query'),\n});\nexport type QueryPreferencesInput = z.infer<typeof QueryPreferencesSchema>;\n\nexport function createPreferencesQueryTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_query',\n description: 'Query consent preferences for multiple users by their identifiers',\n category: 'Preference Management',\n readOnly: true,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n zodSchema: QueryPreferencesSchema,\n handler: async ({ partition, identifiers }) => {\n const result = await rest.queryPreferences({\n partition,\n identifiers: identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n });\n\n return createListResult(result, {\n totalCount: result.length,\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { IdentifierSchema } from './preferences_query.js';\n\nexport const AppendIdentifiersSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n userId: z.string().describe('User ID to append identifiers to'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to append'),\n});\nexport type AppendIdentifiersInput = z.infer<typeof AppendIdentifiersSchema>;\n\nexport function createPreferencesAppendIdentifiersTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_append_identifiers',\n description: 'Append additional identifiers to an existing user preference record',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Appends identifiers to the user preference record',\n annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },\n zodSchema: AppendIdentifiersSchema,\n handler: async ({ partition, userId, identifiers }) => {\n const result = await rest.appendIdentifiers(\n partition,\n userId,\n identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n identifiersAdded: identifiers.length,\n message: 'Identifiers appended successfully',\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { IdentifierSchema } from './preferences_query.js';\n\nexport const DeletePreferencesSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to delete'),\n});\nexport type DeletePreferencesInput = z.infer<typeof DeletePreferencesSchema>;\n\nexport function createPreferencesDeleteTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_delete',\n description: 'Delete consent preferences for specified users',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Deletes preference data for the identifiers',\n annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },\n zodSchema: DeletePreferencesSchema,\n handler: async ({ partition, identifiers }) => {\n const result = await rest.deletePreferences(\n partition,\n identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n message: `Successfully deleted ${result.count} preference records`,\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { IdentifierSchema } from './preferences_query.js';\n\nexport const DeleteIdentifiersSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n userId: z.string().describe('User ID to delete identifiers from'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to delete'),\n});\nexport type DeleteIdentifiersInput = z.infer<typeof DeleteIdentifiersSchema>;\n\nexport function createPreferencesDeleteIdentifiersTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_delete_identifiers',\n description: 'Delete specific identifiers from a user preference record',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Deletes identifiers from the user preference record',\n annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },\n zodSchema: DeleteIdentifiersSchema,\n handler: async ({ partition, userId, identifiers }) => {\n const result = await rest.deleteIdentifiers(\n partition,\n userId,\n identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n identifiersDeleted: identifiers.length,\n message: 'Identifiers deleted successfully',\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nexport const UpdateIdentifiersItemSchema = z.object({\n oldValue: z.string().describe('Old identifier value'),\n newValue: z.string().describe('New identifier value'),\n type: z.string().optional().describe('Identifier type (optional)'),\n});\nexport type UpdateIdentifiersItemInput = z.infer<typeof UpdateIdentifiersItemSchema>;\n\nexport const UpdateIdentifiersSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n userId: z.string().describe('User ID to update identifiers for'),\n identifiers: z\n .array(UpdateIdentifiersItemSchema)\n .describe('Array of identifier update objects with old and new values'),\n});\nexport type UpdateIdentifiersInput = z.infer<typeof UpdateIdentifiersSchema>;\n\nexport function createPreferencesUpdateIdentifiersTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_update_identifiers',\n description: 'Update existing identifiers for a user (e.g., when email changes)',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Updates identifiers for the user preference record',\n annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },\n zodSchema: UpdateIdentifiersSchema,\n handler: async ({ partition, userId, identifiers }) => {\n const result = await rest.updateIdentifiers(\n partition,\n userId,\n identifiers.map((id) => ({\n oldValue: id.oldValue,\n newValue: id.newValue,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n identifiersUpdated: identifiers.length,\n message: 'Identifiers updated successfully',\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nexport const UpsertPreferencesPurposeSchema = z.object({\n purpose: z.string().describe('Purpose slug'),\n enabled: z.boolean().describe('Whether consent is granted'),\n});\nexport type UpsertPreferencesPurposeInput = z.infer<typeof UpsertPreferencesPurposeSchema>;\n\nexport const UpsertPreferencesRecordSchema = z.object({\n identifier: z.string().describe('User identifier'),\n identifierType: z.string().optional().describe('Identifier type (optional)'),\n purposes: z.array(UpsertPreferencesPurposeSchema).describe('Array of purpose consent settings'),\n confirmed: z.boolean().optional().describe('Whether consent was explicitly confirmed'),\n});\nexport type UpsertPreferencesRecordInput = z.infer<typeof UpsertPreferencesRecordSchema>;\n\nexport const UpsertPreferencesSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n records: z.array(UpsertPreferencesRecordSchema).describe('Array of preference records to upsert'),\n});\nexport type UpsertPreferencesInput = z.infer<typeof UpsertPreferencesSchema>;\n\nexport function createPreferencesUpsertTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_upsert',\n description: 'Batch upsert consent preference records for multiple users',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Creates or updates preference records for users',\n annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },\n zodSchema: UpsertPreferencesSchema,\n handler: async ({ partition, records }) => {\n const result = await rest.upsertPreferences({\n partition,\n records: records.map((record) => ({\n identifier: record.identifier,\n identifierType: record.identifierType,\n purposes: record.purposes.map((p) => ({\n purpose: p.purpose,\n enabled: p.enabled,\n })),\n confirmed: record.confirmed,\n })),\n });\n\n return createToolResult(true, {\n ...result,\n recordsProcessed: records.length,\n message: `Successfully upserted ${result.count} preference records`,\n });\n },\n });\n}\n","import type { ToolDefinition, ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { createPreferencesAppendIdentifiersTool } from './preferences_append_identifiers.js';\nimport { createPreferencesDeleteTool } from './preferences_delete.js';\nimport { createPreferencesDeleteIdentifiersTool } from './preferences_delete_identifiers.js';\nimport { createPreferencesQueryTool } from './preferences_query.js';\nimport { createPreferencesUpdateIdentifiersTool } from './preferences_update_identifiers.js';\nimport { createPreferencesUpsertTool } from './preferences_upsert.js';\n\nexport function getPreferenceTools(clients: ToolClients): ToolDefinition[] {\n return [\n createPreferencesQueryTool(clients),\n createPreferencesUpsertTool(clients),\n createPreferencesDeleteTool(clients),\n createPreferencesAppendIdentifiersTool(clients),\n createPreferencesUpdateIdentifiersTool(clients),\n createPreferencesDeleteIdentifiersTool(clients),\n ];\n}\n","import { ScopeName } from '@transcend-io/privacy-types';\n\n/** OAuth scopes required for Preference MCP tools (offline_access added by base). */\nexport const PREFERENCE_OAUTH_SCOPES = [\n ScopeName.ViewPrivacyCenter,\n ScopeName.ManagePrivacyCenter,\n] as const;\n"],"mappings":";;;AAEA,MAAa,mBAAmB,EAAE,OAAO;CACvC,OAAO,EAAE,QAAQ,CAAC,SAAS,mBAAmB;CAC9C,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,6BAA6B;CACnE,CAAC;AAGF,MAAa,yBAAyB,EAAE,OAAO;CAC7C,WAAW,EAAE,QAAQ,CAAC,SAAS,iCAAiC;CAChE,aAAa,EAAE,MAAM,iBAAiB,CAAC,SAAS,uCAAuC;CACxF,CAAC;AAGF,SAAgB,2BAA2B,SAAsB;CAC/D,MAAM,EAAE,SAAS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M,EAAE,SAAS;AACjB,QAAO,WAAW;EAChB,MAAM;EACN,aAAa;EACb,UAAU;EACV,UAAU;EACV,kBAAkB;EAClB,aAAa;GAAE,cAAc;GAAO,iBAAiB;GAAO,gBAAgB;GAAM;EAClF,WAAW;EACX,SAAS,OAAO,EAAE,WAAW,cAAc;GACzC,MAAM,SAAS,MAAM,KAAK,kBAAkB;IAC1C;IACA,SAAS,QAAQ,KAAK,YAAY;KAChC,YAAY,OAAO;KACnB,gBAAgB,OAAO;KACvB,UAAU,OAAO,SAAS,KAAK,OAAO;MACpC,SAAS,EAAE;MACX,SAAS,EAAE;MACZ,EAAE;KACH,WAAW,OAAO;KACnB,EAAE;IACJ,CAAC;AAEF,UAAO,iBAAiB,MAAM;IAC5B,GAAG;IACH,kBAAkB,QAAQ;IAC1B,SAAS,yBAAyB,OAAO,MAAM;IAChD,CAAC;;EAEL,CAAC;;;;AC3CJ,SAAgB,mBAAmB,SAAwC;AACzE,QAAO;EACL,2BAA2B,QAAQ;EACnC,4BAA4B,QAAQ;EACpC,4BAA4B,QAAQ;EACpC,uCAAuC,QAAQ;EAC/C,uCAAuC,QAAQ;EAC/C,uCAAuC,QAAQ;EAChD;;;;;ACdH,MAAa,0BAA0B,CACrC,UAAU,mBACV,UAAU,oBACX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transcend-io/mcp-server-preferences",
3
- "version": "0.3.6",
3
+ "version": "0.4.1",
4
4
  "description": "Transcend MCP Server — Preference Management tools.",
5
5
  "homepage": "https://github.com/transcend-io/tools/tree/main/packages/mcp/mcp-server-preferences",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,8 @@
32
32
  "dependencies": {
33
33
  "@modelcontextprotocol/sdk": "^1.29.0",
34
34
  "zod": "^4.3.6",
35
- "@transcend-io/mcp-server-base": "0.4.5"
35
+ "@transcend-io/mcp-server-base": "0.5.0",
36
+ "@transcend-io/privacy-types": "5.4.0"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@arethetypeswrong/cli": "^0.18.2",
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools-b51SJyJn.mjs","names":[],"sources":["../src/tools/preferences_query.ts","../src/tools/preferences_append_identifiers.ts","../src/tools/preferences_delete.ts","../src/tools/preferences_delete_identifiers.ts","../src/tools/preferences_update_identifiers.ts","../src/tools/preferences_upsert.ts","../src/tools/index.ts"],"sourcesContent":["import { createListResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nexport const IdentifierSchema = z.object({\n value: z.string().describe('Identifier value'),\n type: z.string().optional().describe('Identifier type (optional)'),\n});\nexport type IdentifierInput = z.infer<typeof IdentifierSchema>;\n\nexport const QueryPreferencesSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to query'),\n});\nexport type QueryPreferencesInput = z.infer<typeof QueryPreferencesSchema>;\n\nexport function createPreferencesQueryTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_query',\n description: 'Query consent preferences for multiple users by their identifiers',\n category: 'Preference Management',\n readOnly: true,\n annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true },\n zodSchema: QueryPreferencesSchema,\n handler: async ({ partition, identifiers }) => {\n const result = await rest.queryPreferences({\n partition,\n identifiers: identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n });\n\n return createListResult(result, {\n totalCount: result.length,\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { IdentifierSchema } from './preferences_query.js';\n\nexport const AppendIdentifiersSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n user_id: z.string().describe('User ID to append identifiers to'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to append'),\n});\nexport type AppendIdentifiersInput = z.infer<typeof AppendIdentifiersSchema>;\n\nexport function createPreferencesAppendIdentifiersTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_append_identifiers',\n description: 'Append additional identifiers to an existing user preference record',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Appends identifiers to the user preference record',\n annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false },\n zodSchema: AppendIdentifiersSchema,\n handler: async ({ partition, user_id, identifiers }) => {\n const result = await rest.appendIdentifiers(\n partition,\n user_id,\n identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n identifiersAdded: identifiers.length,\n message: 'Identifiers appended successfully',\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { IdentifierSchema } from './preferences_query.js';\n\nexport const DeletePreferencesSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to delete'),\n});\nexport type DeletePreferencesInput = z.infer<typeof DeletePreferencesSchema>;\n\nexport function createPreferencesDeleteTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_delete',\n description: 'Delete consent preferences for specified users',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Deletes preference data for the identifiers',\n annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },\n zodSchema: DeletePreferencesSchema,\n handler: async ({ partition, identifiers }) => {\n const result = await rest.deletePreferences(\n partition,\n identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n message: `Successfully deleted ${result.count} preference records`,\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { IdentifierSchema } from './preferences_query.js';\n\nexport const DeleteIdentifiersSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n user_id: z.string().describe('User ID to delete identifiers from'),\n identifiers: z.array(IdentifierSchema).describe('Array of identifier objects to delete'),\n});\nexport type DeleteIdentifiersInput = z.infer<typeof DeleteIdentifiersSchema>;\n\nexport function createPreferencesDeleteIdentifiersTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_delete_identifiers',\n description: 'Delete specific identifiers from a user preference record',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Deletes identifiers from the user preference record',\n annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: false },\n zodSchema: DeleteIdentifiersSchema,\n handler: async ({ partition, user_id, identifiers }) => {\n const result = await rest.deleteIdentifiers(\n partition,\n user_id,\n identifiers.map((id) => ({\n value: id.value,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n identifiersDeleted: identifiers.length,\n message: 'Identifiers deleted successfully',\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nexport const UpdateIdentifiersItemSchema = z.object({\n oldValue: z.string().describe('Old identifier value'),\n newValue: z.string().describe('New identifier value'),\n type: z.string().optional().describe('Identifier type (optional)'),\n});\nexport type UpdateIdentifiersItemInput = z.infer<typeof UpdateIdentifiersItemSchema>;\n\nexport const UpdateIdentifiersSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n user_id: z.string().describe('User ID to update identifiers for'),\n identifiers: z\n .array(UpdateIdentifiersItemSchema)\n .describe('Array of identifier update objects with old and new values'),\n});\nexport type UpdateIdentifiersInput = z.infer<typeof UpdateIdentifiersSchema>;\n\nexport function createPreferencesUpdateIdentifiersTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_update_identifiers',\n description: 'Update existing identifiers for a user (e.g., when email changes)',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Updates identifiers for the user preference record',\n annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },\n zodSchema: UpdateIdentifiersSchema,\n handler: async ({ partition, user_id, identifiers }) => {\n const result = await rest.updateIdentifiers(\n partition,\n user_id,\n identifiers.map((id) => ({\n oldValue: id.oldValue,\n newValue: id.newValue,\n type: id.type,\n })),\n );\n\n return createToolResult(true, {\n ...result,\n identifiersUpdated: identifiers.length,\n message: 'Identifiers updated successfully',\n });\n },\n });\n}\n","import { createToolResult, defineTool, z, type ToolClients } from '@transcend-io/mcp-server-base';\n\nexport const UpsertPreferencesPurposeSchema = z.object({\n purpose: z.string().describe('Purpose slug'),\n enabled: z.boolean().describe('Whether consent is granted'),\n});\nexport type UpsertPreferencesPurposeInput = z.infer<typeof UpsertPreferencesPurposeSchema>;\n\nexport const UpsertPreferencesRecordSchema = z.object({\n identifier: z.string().describe('User identifier'),\n identifierType: z.string().optional().describe('Identifier type (optional)'),\n purposes: z.array(UpsertPreferencesPurposeSchema).describe('Array of purpose consent settings'),\n confirmed: z.boolean().optional().describe('Whether consent was explicitly confirmed'),\n});\nexport type UpsertPreferencesRecordInput = z.infer<typeof UpsertPreferencesRecordSchema>;\n\nexport const UpsertPreferencesSchema = z.object({\n partition: z.string().describe('Partition/organization context'),\n records: z.array(UpsertPreferencesRecordSchema).describe('Array of preference records to upsert'),\n});\nexport type UpsertPreferencesInput = z.infer<typeof UpsertPreferencesSchema>;\n\nexport function createPreferencesUpsertTool(clients: ToolClients) {\n const { rest } = clients;\n return defineTool({\n name: 'preferences_upsert',\n description: 'Batch upsert consent preference records for multiple users',\n category: 'Preference Management',\n readOnly: false,\n confirmationHint: 'Creates or updates preference records for users',\n annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true },\n zodSchema: UpsertPreferencesSchema,\n handler: async ({ partition, records }) => {\n const result = await rest.upsertPreferences({\n partition,\n records: records.map((record) => ({\n identifier: record.identifier,\n identifierType: record.identifierType,\n purposes: record.purposes.map((p) => ({\n purpose: p.purpose,\n enabled: p.enabled,\n })),\n confirmed: record.confirmed,\n })),\n });\n\n return createToolResult(true, {\n ...result,\n recordsProcessed: records.length,\n message: `Successfully upserted ${result.count} preference records`,\n });\n },\n });\n}\n","import type { ToolDefinition, ToolClients } from '@transcend-io/mcp-server-base';\n\nimport { createPreferencesAppendIdentifiersTool } from './preferences_append_identifiers.js';\nimport { createPreferencesDeleteTool } from './preferences_delete.js';\nimport { createPreferencesDeleteIdentifiersTool } from './preferences_delete_identifiers.js';\nimport { createPreferencesQueryTool } from './preferences_query.js';\nimport { createPreferencesUpdateIdentifiersTool } from './preferences_update_identifiers.js';\nimport { createPreferencesUpsertTool } from './preferences_upsert.js';\n\nexport function getPreferenceTools(clients: ToolClients): ToolDefinition[] {\n return [\n createPreferencesQueryTool(clients),\n createPreferencesUpsertTool(clients),\n createPreferencesDeleteTool(clients),\n createPreferencesAppendIdentifiersTool(clients),\n createPreferencesUpdateIdentifiersTool(clients),\n createPreferencesDeleteIdentifiersTool(clients),\n ];\n}\n"],"mappings":";;AAEA,MAAa,mBAAmB,EAAE,OAAO;CACvC,OAAO,EAAE,QAAQ,CAAC,SAAS,mBAAmB;CAC9C,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,6BAA6B;CACnE,CAAC;AAGF,MAAa,yBAAyB,EAAE,OAAO;CAC7C,WAAW,EAAE,QAAQ,CAAC,SAAS,iCAAiC;CAChE,aAAa,EAAE,MAAM,iBAAiB,CAAC,SAAS,uCAAuC;CACxF,CAAC;AAGF,SAAgB,2BAA2B,SAAsB;CAC/D,MAAM,EAAE,SAAS;AACjB,QAAO,WAAW;EAChB,MAAM;EACN,aAAa;EACb,UAAU;EACV,UAAU;EACV,aAAa;GAAE,cAAc;GAAM,iBAAiB;GAAO,gBAAgB;GAAM;EACjF,WAAW;EACX,SAAS,OAAO,EAAE,WAAW,kBAAkB;GAC7C,MAAM,SAAS,MAAM,KAAK,iBAAiB;IACzC;IACA,aAAa,YAAY,KAAK,QAAQ;KACpC,OAAO,GAAG;KACV,MAAM,GAAG;KACV,EAAE;IACJ,CAAC;AAEF,UAAO,iBAAiB,QAAQ,EAC9B,YAAY,OAAO,QACpB,CAAC;;EAEL,CAAC;;;;AChCJ,MAAa,0BAA0B,EAAE,OAAO;CAC9C,WAAW,EAAE,QAAQ,CAAC,SAAS,iCAAiC;CAChE,SAAS,EAA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