@uidbai/mcp-server 0.1.0

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.
Files changed (111) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/dist/cli.d.ts +13 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +117 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/core/api-client.d.ts +45 -0
  8. package/dist/core/api-client.d.ts.map +1 -0
  9. package/dist/core/api-client.js +98 -0
  10. package/dist/core/api-client.js.map +1 -0
  11. package/dist/core/auth.d.ts +42 -0
  12. package/dist/core/auth.d.ts.map +1 -0
  13. package/dist/core/auth.js +198 -0
  14. package/dist/core/auth.js.map +1 -0
  15. package/dist/core/errors.d.ts +32 -0
  16. package/dist/core/errors.d.ts.map +1 -0
  17. package/dist/core/errors.js +72 -0
  18. package/dist/core/errors.js.map +1 -0
  19. package/dist/core/index.d.ts +10 -0
  20. package/dist/core/index.d.ts.map +1 -0
  21. package/dist/core/index.js +10 -0
  22. package/dist/core/index.js.map +1 -0
  23. package/dist/core/types.d.ts +124 -0
  24. package/dist/core/types.d.ts.map +1 -0
  25. package/dist/core/types.js +52 -0
  26. package/dist/core/types.js.map +1 -0
  27. package/dist/index.d.ts +15 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +20 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/prompts/component-guidance.d.ts +16 -0
  32. package/dist/prompts/component-guidance.d.ts.map +1 -0
  33. package/dist/prompts/component-guidance.js +98 -0
  34. package/dist/prompts/component-guidance.js.map +1 -0
  35. package/dist/prompts/index.d.ts +6 -0
  36. package/dist/prompts/index.d.ts.map +1 -0
  37. package/dist/prompts/index.js +6 -0
  38. package/dist/prompts/index.js.map +1 -0
  39. package/dist/prompts/registry.d.ts +37 -0
  40. package/dist/prompts/registry.d.ts.map +1 -0
  41. package/dist/prompts/registry.js +40 -0
  42. package/dist/prompts/registry.js.map +1 -0
  43. package/dist/resources/index.d.ts +6 -0
  44. package/dist/resources/index.d.ts.map +1 -0
  45. package/dist/resources/index.js +6 -0
  46. package/dist/resources/index.js.map +1 -0
  47. package/dist/resources/project-config.d.ts +33 -0
  48. package/dist/resources/project-config.d.ts.map +1 -0
  49. package/dist/resources/project-config.js +146 -0
  50. package/dist/resources/project-config.js.map +1 -0
  51. package/dist/resources/registry.d.ts +20 -0
  52. package/dist/resources/registry.d.ts.map +1 -0
  53. package/dist/resources/registry.js +45 -0
  54. package/dist/resources/registry.js.map +1 -0
  55. package/dist/server.d.ts +9 -0
  56. package/dist/server.d.ts.map +1 -0
  57. package/dist/server.js +111 -0
  58. package/dist/server.js.map +1 -0
  59. package/dist/tools/ask-intent.d.ts +35 -0
  60. package/dist/tools/ask-intent.d.ts.map +1 -0
  61. package/dist/tools/ask-intent.js +50 -0
  62. package/dist/tools/ask-intent.js.map +1 -0
  63. package/dist/tools/ask-question.d.ts +40 -0
  64. package/dist/tools/ask-question.d.ts.map +1 -0
  65. package/dist/tools/ask-question.js +58 -0
  66. package/dist/tools/ask-question.js.map +1 -0
  67. package/dist/tools/detect-pattern.d.ts +48 -0
  68. package/dist/tools/detect-pattern.d.ts.map +1 -0
  69. package/dist/tools/detect-pattern.js +64 -0
  70. package/dist/tools/detect-pattern.js.map +1 -0
  71. package/dist/tools/finalize.d.ts +35 -0
  72. package/dist/tools/finalize.d.ts.map +1 -0
  73. package/dist/tools/finalize.js +51 -0
  74. package/dist/tools/finalize.js.map +1 -0
  75. package/dist/tools/get-config.d.ts +28 -0
  76. package/dist/tools/get-config.d.ts.map +1 -0
  77. package/dist/tools/get-config.js +48 -0
  78. package/dist/tools/get-config.js.map +1 -0
  79. package/dist/tools/index.d.ts +18 -0
  80. package/dist/tools/index.d.ts.map +1 -0
  81. package/dist/tools/index.js +19 -0
  82. package/dist/tools/index.js.map +1 -0
  83. package/dist/tools/list-components.d.ts +28 -0
  84. package/dist/tools/list-components.d.ts.map +1 -0
  85. package/dist/tools/list-components.js +44 -0
  86. package/dist/tools/list-components.js.map +1 -0
  87. package/dist/tools/list-patterns.d.ts +28 -0
  88. package/dist/tools/list-patterns.d.ts.map +1 -0
  89. package/dist/tools/list-patterns.js +44 -0
  90. package/dist/tools/list-patterns.js.map +1 -0
  91. package/dist/tools/login.d.ts +35 -0
  92. package/dist/tools/login.d.ts.map +1 -0
  93. package/dist/tools/login.js +100 -0
  94. package/dist/tools/login.js.map +1 -0
  95. package/dist/tools/registry.d.ts +50 -0
  96. package/dist/tools/registry.d.ts.map +1 -0
  97. package/dist/tools/registry.js +75 -0
  98. package/dist/tools/registry.js.map +1 -0
  99. package/dist/tools/status.d.ts +28 -0
  100. package/dist/tools/status.d.ts.map +1 -0
  101. package/dist/tools/status.js +88 -0
  102. package/dist/tools/status.js.map +1 -0
  103. package/dist/tools/submit-pattern.d.ts +67 -0
  104. package/dist/tools/submit-pattern.d.ts.map +1 -0
  105. package/dist/tools/submit-pattern.js +94 -0
  106. package/dist/tools/submit-pattern.js.map +1 -0
  107. package/dist/tools/update-config.d.ts +48 -0
  108. package/dist/tools/update-config.d.ts.map +1 -0
  109. package/dist/tools/update-config.js +94 -0
  110. package/dist/tools/update-config.js.map +1 -0
  111. package/package.json +68 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-patterns.d.ts","sourceRoot":"","sources":["../../src/tools/list-patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;CAsC5B,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * UIDB MCP Tool: uidb_list_patterns
3
+ *
4
+ * List all documented patterns in the design system.
5
+ */
6
+ import { apiClient } from "../core/api-client.js";
7
+ import { formatErrorResponse } from "../core/errors.js";
8
+ export const listPatternsTool = {
9
+ name: "uidb_list_patterns",
10
+ description: `List all documented UI patterns in the UIDB design system.
11
+
12
+ Patterns are reusable UI compositions (3+ components) that have been documented.
13
+ Use existing patterns when building similar UIs to maintain consistency.`,
14
+ inputSchema: {
15
+ type: "object",
16
+ properties: {},
17
+ required: [],
18
+ },
19
+ async execute() {
20
+ try {
21
+ const response = await apiClient.get("/api/pattern/list");
22
+ return {
23
+ content: [
24
+ {
25
+ type: "text",
26
+ text: JSON.stringify(response, null, 2),
27
+ },
28
+ ],
29
+ };
30
+ }
31
+ catch (error) {
32
+ return {
33
+ content: [
34
+ {
35
+ type: "text",
36
+ text: formatErrorResponse(error),
37
+ },
38
+ ],
39
+ isError: true,
40
+ };
41
+ }
42
+ },
43
+ };
44
+ //# sourceMappingURL=list-patterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-patterns.js","sourceRoot":"","sources":["../../src/tools/list-patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAOxD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE;;;yEAG0D;IAEvE,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;KACb;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,MAAM,QAAQ,GACZ,MAAM,SAAS,CAAC,GAAG,CAAuB,mBAAmB,CAAC,CAAC;YAEjE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;qBACxC;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC;qBACjC;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * UIDB MCP Tool: uidb_login
3
+ *
4
+ * Authenticate with UIDB using a one-time token from the portal.
5
+ */
6
+ export declare const loginTool: {
7
+ name: string;
8
+ description: string;
9
+ inputSchema: {
10
+ type: "object";
11
+ properties: {
12
+ token: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ };
17
+ required: never[];
18
+ };
19
+ execute(args: {
20
+ token?: string;
21
+ }): Promise<{
22
+ content: {
23
+ type: "text";
24
+ text: string;
25
+ }[];
26
+ isError?: undefined;
27
+ } | {
28
+ content: {
29
+ type: "text";
30
+ text: string;
31
+ }[];
32
+ isError: boolean;
33
+ }>;
34
+ };
35
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/tools/login.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,eAAO,MAAM,SAAS;;;;;;;;;;;;;kBAsBA;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;;CAsFvC,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * UIDB MCP Tool: uidb_login
3
+ *
4
+ * Authenticate with UIDB using a one-time token from the portal.
5
+ */
6
+ import { exchangeToken, isAuthenticated, getAuthStatus } from "../core/auth.js";
7
+ import { formatErrorResponse } from "../core/errors.js";
8
+ export const loginTool = {
9
+ name: "uidb_login",
10
+ description: `Authenticate with UIDB using a one-time token.
11
+
12
+ Get your token from the UIDB portal:
13
+ 1. Go to portal.uidb.ai → Your Project → Connect
14
+ 2. Copy the login command with the embedded token
15
+ 3. Run: npx @uidbai/mcp-server login --token=YOUR_TOKEN
16
+
17
+ If already authenticated, this will show your current connection status.`,
18
+ inputSchema: {
19
+ type: "object",
20
+ properties: {
21
+ token: {
22
+ type: "string",
23
+ description: "One-time authentication token from UIDB portal",
24
+ },
25
+ },
26
+ required: [],
27
+ },
28
+ async execute(args) {
29
+ try {
30
+ // If no token provided, check current status
31
+ if (!args.token) {
32
+ const authenticated = await isAuthenticated();
33
+ if (authenticated) {
34
+ const status = await getAuthStatus();
35
+ return {
36
+ content: [
37
+ {
38
+ type: "text",
39
+ text: JSON.stringify({
40
+ status: "authenticated",
41
+ project: status.projectSlug,
42
+ user: status.userEmail,
43
+ expiresAt: status.expiresAt,
44
+ message: "Already authenticated. Use a new token to switch projects.",
45
+ }, null, 2),
46
+ },
47
+ ],
48
+ };
49
+ }
50
+ else {
51
+ return {
52
+ content: [
53
+ {
54
+ type: "text",
55
+ text: JSON.stringify({
56
+ status: "not_authenticated",
57
+ message: "Not authenticated. Get a token from portal.uidb.ai → Your Project → Connect",
58
+ instructions: [
59
+ "1. Go to portal.uidb.ai",
60
+ "2. Select your project",
61
+ "3. Click 'Connect'",
62
+ "4. Copy the login command",
63
+ "5. Run: npx @uidbai/mcp-server login --token=YOUR_TOKEN",
64
+ ],
65
+ }, null, 2),
66
+ },
67
+ ],
68
+ };
69
+ }
70
+ }
71
+ // Exchange token for credentials
72
+ const credentials = await exchangeToken(args.token);
73
+ return {
74
+ content: [
75
+ {
76
+ type: "text",
77
+ text: JSON.stringify({
78
+ status: "success",
79
+ message: `Successfully authenticated as ${credentials.userEmail}`,
80
+ project: credentials.projectSlug,
81
+ expiresAt: credentials.expiresAt,
82
+ }, null, 2),
83
+ },
84
+ ],
85
+ };
86
+ }
87
+ catch (error) {
88
+ return {
89
+ content: [
90
+ {
91
+ type: "text",
92
+ text: formatErrorResponse(error),
93
+ },
94
+ ],
95
+ isError: true,
96
+ };
97
+ }
98
+ },
99
+ };
100
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/tools/login.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,a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AI,EACJ,CAAC,CACF;6BACF;yBACF;qBACF,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,iCAAiC;YACjC,MAAM,WAAW,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAEpD,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;4BACE,MAAM,EAAE,SAAS;4BACjB,OAAO,EAAE,iCAAiC,WAAW,CAAC,SAAS,EAAE;4BACjE,OAAO,EAAE,WAAW,CAAC,WAAW;4BAChC,SAAS,EAAE,WAAW,CAAC,SAAS;yBACjC,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC;qBACjC;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * UIDB MCP Server - Tool Registry
3
+ *
4
+ * Central registry for all MCP tools.
5
+ * Adding a new tool: import it and add to the tools array.
6
+ */
7
+ export interface MCPTool {
8
+ name: string;
9
+ description: string;
10
+ inputSchema: {
11
+ type: "object";
12
+ properties: Record<string, unknown>;
13
+ required: string[];
14
+ };
15
+ execute: (args: any) => Promise<{
16
+ content: Array<{
17
+ type: "text";
18
+ text: string;
19
+ }>;
20
+ isError?: boolean;
21
+ }>;
22
+ }
23
+ export declare const tools: MCPTool[];
24
+ /**
25
+ * Get a tool by name
26
+ */
27
+ export declare function getTool(name: string): MCPTool | undefined;
28
+ /**
29
+ * Get all tool definitions for MCP ListTools response
30
+ */
31
+ export declare function getToolDefinitions(): {
32
+ name: string;
33
+ description: string;
34
+ inputSchema: {
35
+ type: "object";
36
+ properties: Record<string, unknown>;
37
+ required: string[];
38
+ };
39
+ }[];
40
+ /**
41
+ * Execute a tool by name
42
+ */
43
+ export declare function executeTool(name: string, args: unknown): Promise<{
44
+ content: Array<{
45
+ type: "text";
46
+ text: string;
47
+ }>;
48
+ isError?: boolean;
49
+ }>;
50
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAkBH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;QAC9B,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,CAAC,CAAC;CACJ;AAMD,eAAO,MAAM,KAAK,EAAE,OAAO,EAmB1B,CAAC;AAEF;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAEzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB;;;;cA7CxB,QAAQ;oBACF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;kBACzB,MAAM,EAAE;;IAiDrB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;aAnDhD,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;cACpC,OAAO;GAyEpB"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * UIDB MCP Server - Tool Registry
3
+ *
4
+ * Central registry for all MCP tools.
5
+ * Adding a new tool: import it and add to the tools array.
6
+ */
7
+ import { askIntentTool } from "./ask-intent.js";
8
+ import { askQuestionTool } from "./ask-question.js";
9
+ import { finalizeTool } from "./finalize.js";
10
+ import { listComponentsTool } from "./list-components.js";
11
+ import { detectPatternTool } from "./detect-pattern.js";
12
+ import { submitPatternTool } from "./submit-pattern.js";
13
+ import { listPatternsTool } from "./list-patterns.js";
14
+ import { getConfigTool } from "./get-config.js";
15
+ import { updateConfigTool } from "./update-config.js";
16
+ import { loginTool } from "./login.js";
17
+ import { statusTool } from "./status.js";
18
+ // ============================================================================
19
+ // Tool Registry
20
+ // ============================================================================
21
+ export const tools = [
22
+ // Component guidance tools
23
+ askIntentTool,
24
+ askQuestionTool,
25
+ finalizeTool,
26
+ listComponentsTool,
27
+ // Pattern tools
28
+ detectPatternTool,
29
+ submitPatternTool,
30
+ listPatternsTool,
31
+ // Config tools
32
+ getConfigTool,
33
+ updateConfigTool,
34
+ // Auth tools
35
+ loginTool,
36
+ statusTool,
37
+ ];
38
+ /**
39
+ * Get a tool by name
40
+ */
41
+ export function getTool(name) {
42
+ return tools.find((tool) => tool.name === name);
43
+ }
44
+ /**
45
+ * Get all tool definitions for MCP ListTools response
46
+ */
47
+ export function getToolDefinitions() {
48
+ return tools.map((tool) => ({
49
+ name: tool.name,
50
+ description: tool.description,
51
+ inputSchema: tool.inputSchema,
52
+ }));
53
+ }
54
+ /**
55
+ * Execute a tool by name
56
+ */
57
+ export async function executeTool(name, args) {
58
+ const tool = getTool(name);
59
+ if (!tool) {
60
+ return {
61
+ content: [
62
+ {
63
+ type: "text",
64
+ text: JSON.stringify({
65
+ error: "TOOL_NOT_FOUND",
66
+ message: `Unknown tool: ${name}`,
67
+ }, null, 2),
68
+ },
69
+ ],
70
+ isError: true,
71
+ };
72
+ }
73
+ return tool.execute(args);
74
+ }
75
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAoBzC,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,KAAK,GAAc;IAC9B,2BAA2B;IAC3B,aAAa;IACb,eAAe;IACf,YAAY;IACZ,kBAAkB;IAElB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;IAEhB,eAAe;IACf,aAAa;IACb,gBAAgB;IAEhB,aAAa;IACb,SAAS;IACT,UAAU;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;KAC9B,CAAC,CAAC,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,IAAa;IAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,KAAK,EAAE,gBAAgB;wBACvB,OAAO,EAAE,iBAAiB,IAAI,EAAE;qBACjC,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * UIDB MCP Tool: uidb_status
3
+ *
4
+ * Check the current UIDB connection status.
5
+ */
6
+ export declare const statusTool: {
7
+ name: string;
8
+ description: string;
9
+ inputSchema: {
10
+ type: "object";
11
+ properties: {};
12
+ required: never[];
13
+ };
14
+ execute(): Promise<{
15
+ content: {
16
+ type: "text";
17
+ text: string;
18
+ }[];
19
+ isError?: undefined;
20
+ } | {
21
+ content: {
22
+ type: "text";
23
+ text: string;
24
+ }[];
25
+ isError: boolean;
26
+ }>;
27
+ };
28
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CA8FtB,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * UIDB MCP Tool: uidb_status
3
+ *
4
+ * Check the current UIDB connection status.
5
+ */
6
+ import { getAuthStatus, loadCredentials } from "../core/auth.js";
7
+ import { apiClient } from "../core/api-client.js";
8
+ import { formatErrorResponse } from "../core/errors.js";
9
+ export const statusTool = {
10
+ name: "uidb_status",
11
+ description: `Check the current UIDB connection status.
12
+
13
+ Shows:
14
+ - Authentication status
15
+ - Connected project
16
+ - User email
17
+ - Token expiration
18
+ - API health`,
19
+ inputSchema: {
20
+ type: "object",
21
+ properties: {},
22
+ required: [],
23
+ },
24
+ async execute() {
25
+ try {
26
+ const authStatus = await getAuthStatus();
27
+ if (!authStatus.authenticated) {
28
+ return {
29
+ content: [
30
+ {
31
+ type: "text",
32
+ text: JSON.stringify({
33
+ authenticated: false,
34
+ message: "Not connected to UIDB",
35
+ action: "Run 'npx @uidbai/mcp-server login --token=YOUR_TOKEN' to connect",
36
+ }, null, 2),
37
+ },
38
+ ],
39
+ };
40
+ }
41
+ // Try to verify API connection
42
+ let apiHealthy = false;
43
+ let projectInfo = null;
44
+ try {
45
+ const credentials = await loadCredentials();
46
+ if (credentials) {
47
+ const response = await apiClient.get("/api/health");
48
+ apiHealthy = response.status === "ok";
49
+ // Get project info
50
+ projectInfo = await apiClient.get(`/api/integration/project/${credentials.projectSlug}`);
51
+ }
52
+ }
53
+ catch {
54
+ // API check failed, but auth is still valid
55
+ }
56
+ const statusResponse = {
57
+ authenticated: true,
58
+ project: authStatus.projectSlug,
59
+ user: authStatus.userEmail,
60
+ expiresAt: authStatus.expiresAt,
61
+ apiHealthy,
62
+ };
63
+ if (projectInfo) {
64
+ statusResponse.projectDetails = projectInfo;
65
+ }
66
+ return {
67
+ content: [
68
+ {
69
+ type: "text",
70
+ text: JSON.stringify(statusResponse, null, 2),
71
+ },
72
+ ],
73
+ };
74
+ }
75
+ catch (error) {
76
+ return {
77
+ content: [
78
+ {
79
+ type: "text",
80
+ text: formatErrorResponse(error),
81
+ },
82
+ ],
83
+ isError: true,
84
+ };
85
+ }
86
+ },
87
+ };
88
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/tools/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE;;;;;;;aAOF;IAEX,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;KACb;IAED,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,aAAa,EAAE,CAAC;YAEzC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE,CAAC;gBAC9B,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;gCACE,aAAa,EAAE,KAAK;gCACpB,OAAO,EAAE,uBAAuB;gCAChC,MAAM,EACJ,kEAAkE;6BACrE,EACD,IAAI,EACJ,CAAC,CACF;yBACF;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,+BAA+B;YAC/B,IAAI,UAAU,GAAG,KAAK,CAAC;YACvB,IAAI,WAAW,GAAG,IAAI,CAAC;YAEvB,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,MAAM,eAAe,EAAE,CAAC;gBAC5C,IAAI,WAAW,EAAE,CAAC;oBAChB,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,GAAG,CAClC,aAAa,CACd,CAAC;oBACF,UAAU,GAAG,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC;oBAEtC,mBAAmB;oBACnB,WAAW,GAAG,MAAM,SAAS,CAAC,GAAG,CAC/B,4BAA4B,WAAW,CAAC,WAAW,EAAE,CACtD,CAAC;gBACJ,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,4CAA4C;YAC9C,CAAC;YAED,MAAM,cAAc,GAA4B;gBAC9C,aAAa,EAAE,IAAI;gBACnB,OAAO,EAAE,UAAU,CAAC,WAAW;gBAC/B,IAAI,EAAE,UAAU,CAAC,SAAS;gBAC1B,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,UAAU;aACX,CAAC;YAEF,IAAI,WAAW,EAAE,CAAC;gBAChB,cAAc,CAAC,cAAc,GAAG,WAAW,CAAC;YAC9C,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;qBAC9C;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,mBAAmB,CAAC,KAAK,CAAC;qBACjC;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * UIDB MCP Tool: uidb_submit_pattern
3
+ *
4
+ * Submit a new reusable pattern to the design system.
5
+ */
6
+ export declare const submitPatternTool: {
7
+ name: string;
8
+ description: string;
9
+ inputSchema: {
10
+ type: "object";
11
+ properties: {
12
+ name: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ description: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ components: {
21
+ type: string;
22
+ items: {
23
+ type: string;
24
+ };
25
+ description: string;
26
+ };
27
+ code_template: {
28
+ type: string;
29
+ description: string;
30
+ };
31
+ category: {
32
+ type: string;
33
+ enum: string[];
34
+ description: string;
35
+ };
36
+ use_cases: {
37
+ type: string;
38
+ items: {
39
+ type: string;
40
+ };
41
+ description: string;
42
+ };
43
+ };
44
+ required: string[];
45
+ };
46
+ execute(args: {
47
+ name: string;
48
+ description: string;
49
+ components: string[];
50
+ code_template: string;
51
+ category: string;
52
+ use_cases?: string[];
53
+ }): Promise<{
54
+ content: {
55
+ type: "text";
56
+ text: string;
57
+ }[];
58
+ isError?: undefined;
59
+ } | {
60
+ content: {
61
+ type: "text";
62
+ text: string;
63
+ }[];
64
+ isError: boolean;
65
+ }>;
66
+ };
67
+ //# sourceMappingURL=submit-pattern.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit-pattern.d.ts","sourceRoot":"","sources":["../../src/tools/submit-pattern.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyDR;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;KACtB;;;;;;;;;;;;;CAkCF,CAAC"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * UIDB MCP Tool: uidb_submit_pattern
3
+ *
4
+ * Submit a new reusable pattern to the design system.
5
+ */
6
+ import { apiClient } from "../core/api-client.js";
7
+ import { formatErrorResponse } from "../core/errors.js";
8
+ export const submitPatternTool = {
9
+ name: "uidb_submit_pattern",
10
+ description: `Submit a new reusable pattern to the UIDB design system.
11
+
12
+ Use this after uidb_detect_pattern confirms that your UI composition is a pattern.
13
+ Patterns help maintain consistency across the project by documenting common UI compositions.
14
+
15
+ Categories: identity, navigation, data-display, feedback, layout, forms`,
16
+ inputSchema: {
17
+ type: "object",
18
+ properties: {
19
+ name: {
20
+ type: "string",
21
+ description: "Pattern name (e.g., 'Profile Card', 'Navigation Header')",
22
+ },
23
+ description: {
24
+ type: "string",
25
+ description: "What this pattern does and when to use it",
26
+ },
27
+ components: {
28
+ type: "array",
29
+ items: { type: "string" },
30
+ description: "List of component names used in this pattern",
31
+ },
32
+ code_template: {
33
+ type: "string",
34
+ description: "The JSX/TSX code template for this pattern",
35
+ },
36
+ category: {
37
+ type: "string",
38
+ enum: [
39
+ "identity",
40
+ "navigation",
41
+ "data-display",
42
+ "feedback",
43
+ "layout",
44
+ "forms",
45
+ ],
46
+ description: "Pattern category",
47
+ },
48
+ use_cases: {
49
+ type: "array",
50
+ items: { type: "string" },
51
+ description: "Where this pattern should be used (e.g., ['Dropdown menus', 'Sidebars'])",
52
+ },
53
+ },
54
+ required: [
55
+ "name",
56
+ "description",
57
+ "components",
58
+ "code_template",
59
+ "category",
60
+ ],
61
+ },
62
+ async execute(args) {
63
+ try {
64
+ const response = await apiClient.post("/api/pattern/submit", {
65
+ name: args.name,
66
+ description: args.description,
67
+ components: args.components,
68
+ code_template: args.code_template,
69
+ category: args.category,
70
+ ...(args.use_cases && { use_cases: args.use_cases }),
71
+ });
72
+ return {
73
+ content: [
74
+ {
75
+ type: "text",
76
+ text: JSON.stringify(response, null, 2),
77
+ },
78
+ ],
79
+ };
80
+ }
81
+ catch (error) {
82
+ return {
83
+ content: [
84
+ {
85
+ type: "text",
86
+ text: formatErrorResponse(error),
87
+ },
88
+ ],
89
+ isError: true,
90
+ };
91
+ }
92
+ },
93
+ };
94
+ //# sourceMappingURL=submit-pattern.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit-pattern.js","sourceRoot":"","sources":["../../src/tools/submit-pattern.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,MAAM,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