@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,198 @@
1
+ /**
2
+ * UIDB MCP Server - Authentication
3
+ *
4
+ * Handles OAuth authentication and credential storage.
5
+ * Credentials are stored in ~/.uidb/credentials.json
6
+ */
7
+ import { homedir } from "node:os";
8
+ import { join } from "node:path";
9
+ import { readFile, writeFile, mkdir } from "node:fs/promises";
10
+ import { existsSync } from "node:fs";
11
+ import { UIDB_API_URL, UIDB_CREDENTIALS_PATH, } from "./types.js";
12
+ import { AuthenticationError, TokenExpiredError, APIError, NetworkError, } from "./errors.js";
13
+ // ============================================================================
14
+ // Credential Storage
15
+ // ============================================================================
16
+ function getCredentialsPath() {
17
+ return join(homedir(), UIDB_CREDENTIALS_PATH);
18
+ }
19
+ function getCredentialsDir() {
20
+ return join(homedir(), ".uidb");
21
+ }
22
+ /**
23
+ * Load credentials from disk
24
+ */
25
+ export async function loadCredentials() {
26
+ const credentialsPath = getCredentialsPath();
27
+ if (!existsSync(credentialsPath)) {
28
+ return null;
29
+ }
30
+ try {
31
+ const content = await readFile(credentialsPath, "utf-8");
32
+ const credentials = JSON.parse(content);
33
+ // Check if token is expired
34
+ if (new Date(credentials.expiresAt) < new Date()) {
35
+ // Token expired - try to refresh if we have a refresh token
36
+ if (credentials.refreshToken) {
37
+ return await refreshCredentials(credentials);
38
+ }
39
+ throw new TokenExpiredError();
40
+ }
41
+ return credentials;
42
+ }
43
+ catch (error) {
44
+ if (error instanceof TokenExpiredError) {
45
+ throw error;
46
+ }
47
+ // Invalid credentials file - return null
48
+ return null;
49
+ }
50
+ }
51
+ /**
52
+ * Save credentials to disk
53
+ */
54
+ export async function saveCredentials(credentials) {
55
+ const credentialsDir = getCredentialsDir();
56
+ const credentialsPath = getCredentialsPath();
57
+ // Ensure directory exists
58
+ if (!existsSync(credentialsDir)) {
59
+ await mkdir(credentialsDir, { recursive: true, mode: 0o700 });
60
+ }
61
+ // Write credentials with restricted permissions
62
+ await writeFile(credentialsPath, JSON.stringify(credentials, null, 2), {
63
+ mode: 0o600,
64
+ });
65
+ }
66
+ /**
67
+ * Delete credentials from disk
68
+ */
69
+ export async function deleteCredentials() {
70
+ const credentialsPath = getCredentialsPath();
71
+ if (existsSync(credentialsPath)) {
72
+ const { unlink } = await import("node:fs/promises");
73
+ await unlink(credentialsPath);
74
+ }
75
+ }
76
+ // ============================================================================
77
+ // OAuth Flow
78
+ // ============================================================================
79
+ /**
80
+ * Exchange one-time token for access credentials
81
+ * Called by CLI: npx @uidbai/mcp-server login --token=xxx
82
+ */
83
+ export async function exchangeToken(oneTimeToken) {
84
+ try {
85
+ const response = await fetch(`${UIDB_API_URL}/api/auth/mcp/exchange`, {
86
+ method: "POST",
87
+ headers: {
88
+ "Content-Type": "application/json",
89
+ },
90
+ body: JSON.stringify({ token: oneTimeToken }),
91
+ });
92
+ if (!response.ok) {
93
+ const error = await response.json().catch(() => ({}));
94
+ throw new APIError(error.message || `Token exchange failed: ${response.status}`, response.status);
95
+ }
96
+ const data = await response.json();
97
+ const credentials = {
98
+ accessToken: data.accessToken,
99
+ refreshToken: data.refreshToken,
100
+ projectId: data.projectId,
101
+ projectSlug: data.projectSlug,
102
+ userEmail: data.userEmail,
103
+ expiresAt: data.expiresAt,
104
+ };
105
+ // Save credentials to disk
106
+ await saveCredentials(credentials);
107
+ return credentials;
108
+ }
109
+ catch (error) {
110
+ if (error instanceof APIError) {
111
+ throw error;
112
+ }
113
+ throw new NetworkError();
114
+ }
115
+ }
116
+ /**
117
+ * Refresh expired access token using refresh token
118
+ */
119
+ async function refreshCredentials(credentials) {
120
+ if (!credentials.refreshToken) {
121
+ throw new TokenExpiredError();
122
+ }
123
+ try {
124
+ const response = await fetch(`${UIDB_API_URL}/api/auth/mcp/refresh`, {
125
+ method: "POST",
126
+ headers: {
127
+ "Content-Type": "application/json",
128
+ },
129
+ body: JSON.stringify({ refreshToken: credentials.refreshToken }),
130
+ });
131
+ if (!response.ok) {
132
+ // Refresh failed - user needs to re-authenticate
133
+ await deleteCredentials();
134
+ throw new TokenExpiredError();
135
+ }
136
+ const data = await response.json();
137
+ const newCredentials = {
138
+ ...credentials,
139
+ accessToken: data.accessToken,
140
+ expiresAt: data.expiresAt,
141
+ ...(data.refreshToken && { refreshToken: data.refreshToken }),
142
+ };
143
+ await saveCredentials(newCredentials);
144
+ return newCredentials;
145
+ }
146
+ catch (error) {
147
+ if (error instanceof TokenExpiredError) {
148
+ throw error;
149
+ }
150
+ throw new NetworkError();
151
+ }
152
+ }
153
+ // ============================================================================
154
+ // Authentication Helpers
155
+ // ============================================================================
156
+ /**
157
+ * Get current credentials or throw if not authenticated
158
+ */
159
+ export async function requireCredentials() {
160
+ const credentials = await loadCredentials();
161
+ if (!credentials) {
162
+ throw new AuthenticationError();
163
+ }
164
+ return credentials;
165
+ }
166
+ /**
167
+ * Check if user is authenticated
168
+ */
169
+ export async function isAuthenticated() {
170
+ try {
171
+ const credentials = await loadCredentials();
172
+ return credentials !== null;
173
+ }
174
+ catch {
175
+ return false;
176
+ }
177
+ }
178
+ /**
179
+ * Get authentication status info
180
+ */
181
+ export async function getAuthStatus() {
182
+ try {
183
+ const credentials = await loadCredentials();
184
+ if (!credentials) {
185
+ return { authenticated: false };
186
+ }
187
+ return {
188
+ authenticated: true,
189
+ projectSlug: credentials.projectSlug,
190
+ userEmail: credentials.userEmail,
191
+ expiresAt: credentials.expiresAt,
192
+ };
193
+ }
194
+ catch {
195
+ return { authenticated: false };
196
+ }
197
+ }
198
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/core/auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAEL,YAAY,EACZ,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,SAAS,kBAAkB;IACzB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,qBAAqB,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,MAAM,eAAe,GAAG,kBA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: string;
6
+ statusCode?: number | undefined;
7
+ constructor(message: string, code: string, statusCode?: number | undefined);
8
+ }
9
+ export declare class AuthenticationError extends UIDBError {
10
+ constructor(message?: string);
11
+ }
12
+ export declare class TokenExpiredError extends UIDBError {
13
+ constructor(message?: string);
14
+ }
15
+ export declare class APIError extends UIDBError {
16
+ constructor(message: string, statusCode?: number);
17
+ }
18
+ export declare class ValidationError extends UIDBError {
19
+ constructor(message: string);
20
+ }
21
+ export declare class NetworkError extends UIDBError {
22
+ constructor(message?: string);
23
+ }
24
+ /**
25
+ * Format error for MCP tool response
26
+ */
27
+ export declare function formatErrorResponse(error: unknown): string;
28
+ /**
29
+ * Check if error is an authentication error
30
+ */
31
+ export declare function isAuthError(error: unknown): boolean;
32
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,SAAU,SAAQ,KAAK;IAGzB,IAAI,EAAE,MAAM;IACZ,UAAU,CAAC,EAAE,MAAM;gBAF1B,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,YAAA;CAK7B;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBAE9C,OAAO,GAAE,MAA4E;CAKxF;AAED,qBAAa,iBAAkB,SAAQ,SAAS;gBAE5C,OAAO,GAAE,MAA6F;CAKzG;AAED,qBAAa,QAAS,SAAQ,SAAS;gBACzB,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,MAAY;CAItD;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,YAAa,SAAQ,SAAS;gBAEvC,OAAO,GAAE,MAAyE;CAKrF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAgC1D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAInD"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * UIDB MCP Server - Error Handling
3
+ */
4
+ export class UIDBError extends Error {
5
+ code;
6
+ statusCode;
7
+ constructor(message, code, statusCode) {
8
+ super(message);
9
+ this.code = code;
10
+ this.statusCode = statusCode;
11
+ this.name = "UIDBError";
12
+ }
13
+ }
14
+ export class AuthenticationError extends UIDBError {
15
+ constructor(message = "Not authenticated. Run 'npx @uidbai/mcp-server login' to connect.") {
16
+ super(message, "AUTH_ERROR", 401);
17
+ this.name = "AuthenticationError";
18
+ }
19
+ }
20
+ export class TokenExpiredError extends UIDBError {
21
+ constructor(message = "Authentication token has expired. Run 'npx @uidbai/mcp-server login' to reconnect.") {
22
+ super(message, "TOKEN_EXPIRED", 401);
23
+ this.name = "TokenExpiredError";
24
+ }
25
+ }
26
+ export class APIError extends UIDBError {
27
+ constructor(message, statusCode = 500) {
28
+ super(message, "API_ERROR", statusCode);
29
+ this.name = "APIError";
30
+ }
31
+ }
32
+ export class ValidationError extends UIDBError {
33
+ constructor(message) {
34
+ super(message, "VALIDATION_ERROR", 400);
35
+ this.name = "ValidationError";
36
+ }
37
+ }
38
+ export class NetworkError extends UIDBError {
39
+ constructor(message = "Failed to connect to UIDB API. Check your internet connection.") {
40
+ super(message, "NETWORK_ERROR");
41
+ this.name = "NetworkError";
42
+ }
43
+ }
44
+ /**
45
+ * Format error for MCP tool response
46
+ */
47
+ export function formatErrorResponse(error) {
48
+ if (error instanceof UIDBError) {
49
+ return JSON.stringify({
50
+ error: error.code,
51
+ message: error.message,
52
+ ...(error.statusCode && { statusCode: error.statusCode }),
53
+ }, null, 2);
54
+ }
55
+ if (error instanceof Error) {
56
+ return JSON.stringify({
57
+ error: "UNKNOWN_ERROR",
58
+ message: error.message,
59
+ }, null, 2);
60
+ }
61
+ return JSON.stringify({
62
+ error: "UNKNOWN_ERROR",
63
+ message: String(error),
64
+ }, null, 2);
65
+ }
66
+ /**
67
+ * Check if error is an authentication error
68
+ */
69
+ export function isAuthError(error) {
70
+ return (error instanceof AuthenticationError || error instanceof TokenExpiredError);
71
+ }
72
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAGzB;IACA;IAHT,YACE,OAAe,EACR,IAAY,EACZ,UAAmB;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAS;QAG1B,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,YACE,UAAkB,mEAAmE;QAErF,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC9C,YACE,UAAkB,oFAAoF;QAEtG,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,SAAS;IACrC,YAAY,OAAe,EAAE,aAAqB,GAAG;QACnD,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,YACE,UAAkB,gEAAgE;QAElF,KAAK,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,SAAS,CACnB;YACE,KAAK,EAAE,KAAK,CAAC,IAAI;YACjB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;SAC1D,EACD,IAAI,EACJ,CAAC,CACF,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,SAAS,CACnB;YACE,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,EACD,IAAI,EACJ,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CACnB;QACE,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;KACvB,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,CACL,KAAK,YAAY,mBAAmB,IAAI,KAAK,YAAY,iBAAiB,CAC3E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * UIDB MCP Server - Core Module
3
+ *
4
+ * Re-exports all core functionality.
5
+ */
6
+ export * from "./types.js";
7
+ export * from "./errors.js";
8
+ export * from "./auth.js";
9
+ export * from "./api-client.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * UIDB MCP Server - Core Module
3
+ *
4
+ * Re-exports all core functionality.
5
+ */
6
+ export * from "./types.js";
7
+ export * from "./errors.js";
8
+ export * from "./auth.js";
9
+ export * from "./api-client.js";
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * UIDB MCP Server - Shared Types
3
+ */
4
+ export interface UIDBCredentials {
5
+ accessToken: string;
6
+ refreshToken?: string;
7
+ projectId: string;
8
+ projectSlug: string;
9
+ userEmail: string;
10
+ expiresAt: string;
11
+ }
12
+ export interface OneTimeToken {
13
+ token: string;
14
+ projectId: string;
15
+ projectSlug: string;
16
+ userEmail: string;
17
+ expiresAt: string;
18
+ }
19
+ export interface APIResponse<T> {
20
+ data?: T;
21
+ error?: string;
22
+ message?: string;
23
+ }
24
+ export interface ComponentInfo {
25
+ id: string;
26
+ name: string;
27
+ category: string;
28
+ description: string;
29
+ variants?: string[];
30
+ sizes?: string[];
31
+ }
32
+ export interface ComponentSession {
33
+ session_id: string;
34
+ type: "existing_component" | "build_your_own";
35
+ component_type?: string;
36
+ interpretation: string;
37
+ next_question?: string;
38
+ options?: string[];
39
+ step?: string;
40
+ }
41
+ export interface ComponentAnswer {
42
+ session_id: string;
43
+ next_question?: string;
44
+ options?: string[];
45
+ step?: string;
46
+ complete?: boolean;
47
+ }
48
+ export interface ComponentResult {
49
+ component: string;
50
+ decisions: Record<string, string>;
51
+ code: string;
52
+ accessibility?: {
53
+ compliant: boolean;
54
+ notes: string[];
55
+ };
56
+ }
57
+ export interface PatternInfo {
58
+ id: string;
59
+ name: string;
60
+ description: string;
61
+ category: string;
62
+ components: string[];
63
+ code_template: string;
64
+ use_cases?: string[];
65
+ }
66
+ export interface PatternDetection {
67
+ is_pattern: boolean;
68
+ confidence: "high" | "medium" | "low";
69
+ suggested_name?: string;
70
+ suggested_category?: string;
71
+ reason?: string;
72
+ }
73
+ export interface ProjectConfig {
74
+ accentColor: string;
75
+ grayColor: string;
76
+ radius: string;
77
+ scaling?: string;
78
+ }
79
+ export interface ProjectInfo {
80
+ id: string;
81
+ slug: string;
82
+ name: string;
83
+ config: ProjectConfig;
84
+ }
85
+ export interface AskIntentInput {
86
+ description: string;
87
+ }
88
+ export interface AskQuestionInput {
89
+ session_id: string;
90
+ answer: string;
91
+ }
92
+ export interface FinalizeInput {
93
+ session_id: string;
94
+ }
95
+ export interface DetectPatternInput {
96
+ description: string;
97
+ components_used: string[];
98
+ context?: string;
99
+ }
100
+ export interface SubmitPatternInput {
101
+ name: string;
102
+ description: string;
103
+ components: string[];
104
+ code_template: string;
105
+ category: string;
106
+ use_cases?: string[];
107
+ }
108
+ export interface UpdateConfigInput {
109
+ accentColor?: string;
110
+ grayColor?: string;
111
+ radius?: string;
112
+ }
113
+ export interface LoginInput {
114
+ token?: string;
115
+ }
116
+ export declare const UIDB_API_URL = "https://api.uidb.ai";
117
+ export declare const UIDB_CREDENTIALS_PATH = ".uidb/credentials.json";
118
+ export declare const VALID_ACCENT_COLORS: readonly ["gray", "gold", "bronze", "brown", "yellow", "amber", "orange", "tomato", "red", "ruby", "crimson", "pink", "plum", "purple", "violet", "iris", "indigo", "blue", "cyan", "teal", "jade", "green", "grass", "lime", "mint", "sky"];
119
+ export declare const VALID_GRAY_COLORS: readonly ["gray", "mauve", "slate", "sage", "olive", "sand"];
120
+ export declare const VALID_RADIUS_VALUES: readonly ["none", "small", "medium", "large", "full"];
121
+ export type AccentColor = (typeof VALID_ACCENT_COLORS)[number];
122
+ export type GrayColor = (typeof VALID_GRAY_COLORS)[number];
123
+ export type RadiusValue = (typeof VALID_RADIUS_VALUES)[number];
124
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAMD,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,oBAAoB,GAAG,gBAAgB,CAAC;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,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CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * UIDB MCP Server - Shared Types
3
+ */
4
+ // ============================================================================
5
+ // Constants
6
+ // ============================================================================
7
+ export const UIDB_API_URL = "https://api.uidb.ai";
8
+ export const UIDB_CREDENTIALS_PATH = ".uidb/credentials.json";
9
+ export const VALID_ACCENT_COLORS = [
10
+ "gray",
11
+ "gold",
12
+ "bronze",
13
+ "brown",
14
+ "yellow",
15
+ "amber",
16
+ "orange",
17
+ "tomato",
18
+ "red",
19
+ "ruby",
20
+ "crimson",
21
+ "pink",
22
+ "plum",
23
+ "purple",
24
+ "violet",
25
+ "iris",
26
+ "indigo",
27
+ "blue",
28
+ "cyan",
29
+ "teal",
30
+ "jade",
31
+ "green",
32
+ "grass",
33
+ "lime",
34
+ "mint",
35
+ "sky",
36
+ ];
37
+ export const VALID_GRAY_COLORS = [
38
+ "gray",
39
+ "mauve",
40
+ "slate",
41
+ "sage",
42
+ "olive",
43
+ "sand",
44
+ ];
45
+ export const VALID_RADIUS_VALUES = [
46
+ "none",
47
+ "small",
48
+ "medium",
49
+ "large",
50
+ "full",
51
+ ];
52
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAmJH,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAC;AAClD,MAAM,CAAC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,KAAK;IACL,MAAM;IACN,SAAS;IACT,MAAM;IACN,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAC;AAEX,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;CACE,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,MAAM;CACE,CAAC"}
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * UIDB MCP Server
4
+ *
5
+ * Model Context Protocol server for the UIDB Design System.
6
+ * Provides tools, resources, and prompts for AI coding assistants.
7
+ *
8
+ * Usage:
9
+ * npx @uidbai/mcp-server # Start MCP server (for Cursor/Claude)
10
+ * npx @uidbai/mcp-server login # Authenticate
11
+ * npx @uidbai/mcp-server status # Check connection
12
+ * npx @uidbai/mcp-server logout # Remove credentials
13
+ */
14
+ export {};
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * UIDB MCP Server
4
+ *
5
+ * Model Context Protocol server for the UIDB Design System.
6
+ * Provides tools, resources, and prompts for AI coding assistants.
7
+ *
8
+ * Usage:
9
+ * npx @uidbai/mcp-server # Start MCP server (for Cursor/Claude)
10
+ * npx @uidbai/mcp-server login # Authenticate
11
+ * npx @uidbai/mcp-server status # Check connection
12
+ * npx @uidbai/mcp-server logout # Remove credentials
13
+ */
14
+ import { runServer } from "./server.js";
15
+ // Run the MCP server
16
+ runServer().catch((error) => {
17
+ console.error("Failed to start UIDB MCP server:", error);
18
+ process.exit(1);
19
+ });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAqB;AACrB,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1B,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * UIDB MCP Prompt: Component Guidance
3
+ *
4
+ * System prompt for guiding component selection.
5
+ */
6
+ export declare const componentGuidancePrompt: {
7
+ name: string;
8
+ description: string;
9
+ getPrompt(): string;
10
+ };
11
+ export declare const patternDetectionPrompt: {
12
+ name: string;
13
+ description: string;
14
+ getPrompt(): string;
15
+ };
16
+ //# sourceMappingURL=component-guidance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component-guidance.d.ts","sourceRoot":"","sources":["../../src/prompts/component-guidance.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,uBAAuB;;;iBAIrB,MAAM;CAiDpB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;iBAIpB,MAAM;CAmCpB,CAAC"}