Skip to content

refactor: deduplicate enums and replace inline strings with shared privacy-types#79

Merged
michaelfarrell76 merged 4 commits intomainfrom
fix/mcp-enum-audit
Apr 10, 2026
Merged

refactor: deduplicate enums and replace inline strings with shared privacy-types#79
michaelfarrell76 merged 4 commits intomainfrom
fix/mcp-enum-audit

Conversation

@michaelfarrell76
Copy link
Copy Markdown
Member

Summary

  • 5 new enums added to @transcend-io/privacy-types (consentManager.ts): CookieOrderField, DataFlowOrderField, DataFlowType, TriageAction, ConsentTrackerType
  • Deduplicated z.nativeEnum() wrappers by creating shared schemas.ts in mcp-server-consent and mcp-server-dsr (eliminates 6 duplicate definitions across tool files)
  • Replaced z.string() with proper enums in tool input schemas:
    • order_field in cookie/data flow list tools → CookieOrderField / DataFlowOrderField
    • scopes in admin_create_api_keyScopeName
    • identifierType / type in preferences tools → IdentifierType
    • status in assessments_create_templateAssessmentFormTemplateStatus
    • action / type in consent_bulk_triageTriageAction / ConsentTrackerType
  • Added @transcend-io/privacy-types dependency to mcp-server-admin and mcp-server-preferences

Test plan

  • All 5 affected MCP packages typecheck clean (tsc --noEmit)
  • Umbrella mcp-server package typechecks clean
  • Pre-commit hooks pass (format, lint, typecheck)
  • Pre-push hooks pass (tests)
  • Verify MCP tools work end-to-end with the new enum constraints

Made with Cursor

…ivacy-types

- Add CookieOrderField, DataFlowOrderField, DataFlowType, TriageAction,
  ConsentTrackerType to @transcend-io/privacy-types
- Create shared schemas.ts in mcp-server-consent and mcp-server-dsr to
  deduplicate z.nativeEnum wrappers (ConsentTrackerStatusEnum,
  OrderDirectionEnum, RequestTypeEnum)
- Replace z.string() with z.nativeEnum() for order_field params in
  consent_list_cookies and consent_list_data_flows
- Replace inline z.enum(['APPROVE','JUNK']) and z.enum(['cookie','data_flow'])
  with shared TriageAction and ConsentTrackerType enums
- Replace z.enum(['DRAFT','PUBLISHED']) with AssessmentFormTemplateStatus
- Replace z.array(z.string()) scopes with z.array(z.nativeEnum(ScopeName))
- Replace z.string() identifierType with z.nativeEnum(IdentifierType) in
  preferences tools
- Add @transcend-io/privacy-types dependency to mcp-server-admin and
  mcp-server-preferences
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 10, 2026

Open in StackBlitz

@transcend-io/cli

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/cli@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/cli@79.tgz

@transcend-io/privacy-types

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/privacy-types@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/privacy-types@79.tgz

@transcend-io/sdk

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/sdk@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/sdk@79.tgz

@transcend-io/utils

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/utils@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/utils@79.tgz

@transcend-io/mcp-server

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server@79.tgz

@transcend-io/mcp-server-admin

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-admin@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-admin@79.tgz

@transcend-io/mcp-server-assessments

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-assessments@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-assessments@79.tgz

@transcend-io/mcp-server-consent

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-consent@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-consent@79.tgz

@transcend-io/mcp-server-core

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-core@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-core@79.tgz

@transcend-io/mcp-server-discovery

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-discovery@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-discovery@79.tgz

@transcend-io/mcp-server-dsr

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-dsr@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-dsr@79.tgz

@transcend-io/mcp-server-inventory

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-inventory@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-inventory@79.tgz

@transcend-io/mcp-server-preferences

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-preferences@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-preferences@79.tgz

@transcend-io/mcp-server-workflows

pnpm add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-workflows@79
yarn add https://pkg.pr.new/transcend-io/tools/@transcend-io/mcp-server-workflows@79.tgz

commit: 7794900

…reate_api_key

- Remove schemas.ts from mcp-server-consent and mcp-server-dsr; inline
  z.nativeEnum() directly in each tool file
- Enrich admin_create_api_key tool description with TRANSCEND_SCOPES
  metadata (title, description, dependency info for every scope)
@michaelfarrell76 michaelfarrell76 requested review from TCJackwood, bencmbrook and dsklyar and removed request for bencmbrook April 10, 2026 00:09
@michaelfarrell76 michaelfarrell76 marked this pull request as ready for review April 10, 2026 00:09
@michaelfarrell76 michaelfarrell76 added this pull request to the merge queue Apr 10, 2026
@michaelfarrell76 michaelfarrell76 removed this pull request from the merge queue due to a manual request Apr 10, 2026
@michaelfarrell76 michaelfarrell76 merged commit 29868af into main Apr 10, 2026
4 checks passed
@michaelfarrell76 michaelfarrell76 deleted the fix/mcp-enum-audit branch April 10, 2026 00:12
michaelfarrell76 added a commit that referenced this pull request Apr 10, 2026
…ivacy-types (#79)

* refactor: deduplicate enums and replace inline strings with shared privacy-types

- Add CookieOrderField, DataFlowOrderField, DataFlowType, TriageAction,
  ConsentTrackerType to @transcend-io/privacy-types
- Create shared schemas.ts in mcp-server-consent and mcp-server-dsr to
  deduplicate z.nativeEnum wrappers (ConsentTrackerStatusEnum,
  OrderDirectionEnum, RequestTypeEnum)
- Replace z.string() with z.nativeEnum() for order_field params in
  consent_list_cookies and consent_list_data_flows
- Replace inline z.enum(['APPROVE','JUNK']) and z.enum(['cookie','data_flow'])
  with shared TriageAction and ConsentTrackerType enums
- Replace z.enum(['DRAFT','PUBLISHED']) with AssessmentFormTemplateStatus
- Replace z.array(z.string()) scopes with z.array(z.nativeEnum(ScopeName))
- Replace z.string() identifierType with z.nativeEnum(IdentifierType) in
  preferences tools
- Add @transcend-io/privacy-types dependency to mcp-server-admin and
  mcp-server-preferences

* chore: add changeset for privacy-types enum additions

* refactor: inline z.nativeEnum, remove shared schemas, enhance admin_create_api_key

- Remove schemas.ts from mcp-server-consent and mcp-server-dsr; inline
  z.nativeEnum() directly in each tool file
- Enrich admin_create_api_key tool description with TRANSCEND_SCOPES
  metadata (title, description, dependency info for every scope)

* revert: keep identifierType as z.string() in preferences tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants