@atomixstudio/mcp 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.
@@ -0,0 +1,73 @@
1
+ {
2
+ "tenantId": "default",
3
+ "createdAt": "2025-12-13T12:00:00.000Z",
4
+ "updatedAt": "2025-12-16T12:00:00.000Z",
5
+
6
+ "governance": {
7
+ "semanticOnlyConsumption": true,
8
+ "blockPrimitiveTokens": true,
9
+ "blockHardcodedValues": true,
10
+ "requireFoundationsFirst": true,
11
+
12
+ "violationResponse": {
13
+ "action": "block_and_suggest",
14
+ "options": [
15
+ "Add token to Foundations first, then consume it",
16
+ "Use an existing semantic token from the available options",
17
+ "Defer this feature until a proper semantic token exists"
18
+ ]
19
+ },
20
+
21
+ "allowedTokenCategories": [
22
+ "SEMANTIC_TEXT_COLOR_OPTIONS",
23
+ "SEMANTIC_BACKGROUND_COLOR_OPTIONS",
24
+ "SEMANTIC_ACTION_COLOR_OPTIONS",
25
+ "SEMANTIC_BORDER_COLOR_OPTIONS",
26
+ "SEMANTIC_ON_COLOR_OPTIONS"
27
+ ],
28
+
29
+ "forbiddenPatterns": [
30
+ "static-*",
31
+ "scales.*",
32
+ "#[0-9A-Fa-f]{3,8}",
33
+ "rgb\\(",
34
+ "rgba\\(",
35
+ "hsl\\(",
36
+ "\\d+px",
37
+ "\\d+rem"
38
+ ]
39
+ },
40
+
41
+ "componentDefaults": {
42
+ "button": {
43
+ "variants": {
44
+ "inverse": {
45
+ "_status": "blocked",
46
+ "_reason": "Uses primitive token 'static-black'. Requires 'action-inverse' in Foundations.",
47
+ "_suggestedAction": "Add 'action-inverse' to Foundations, then update bgColor to 'action-inverse'",
48
+ "bgColor": "action-inverse",
49
+ "textColor": "text-brand",
50
+ "interaction": "subtle"
51
+ }
52
+ }
53
+ }
54
+ },
55
+
56
+ "lockedTokens": [
57
+ "button.variants.primary.bgColor",
58
+ "card.variants.*.shadow"
59
+ ],
60
+
61
+ "tokenOverrides": {},
62
+
63
+ "pendingFoundationRequests": [
64
+ {
65
+ "tokenId": "action-inverse",
66
+ "category": "colors.modes.*.actionInverse",
67
+ "requestedBy": "AI variant creation",
68
+ "requestedFor": "button.variants.inverse.bgColor",
69
+ "suggestedValue": "scales.neutral[100] (black)",
70
+ "status": "pending_human_approval"
71
+ }
72
+ ]
73
+ }
@@ -0,0 +1,202 @@
1
+ /**
2
+ * User Tokens Fetcher
3
+ * -------------------
4
+ * Fetches user-specific design system tokens from Atomix API.
5
+ *
6
+ * Used when MCP server is run with --ds-id flag to serve a user's
7
+ * custom design system instead of Atomix's internal tokens.
8
+ */
9
+ interface UserDesignSystem {
10
+ id: string;
11
+ name: string;
12
+ tokens: Record<string, unknown>;
13
+ governance?: {
14
+ rules: string[];
15
+ categories?: Record<string, string[]>;
16
+ };
17
+ }
18
+ interface FetchUserDSOptions {
19
+ /** User's design system ID */
20
+ dsId: string;
21
+ /** API key for authentication */
22
+ apiKey?: string;
23
+ /** Base URL for the Atomix API (default: https://atomix.design) */
24
+ baseUrl?: string;
25
+ }
26
+ interface UserDSMeta {
27
+ id: string;
28
+ name: string;
29
+ publishedAt?: number;
30
+ updatedAt?: number;
31
+ version?: number;
32
+ }
33
+ interface UserDSResponse {
34
+ success: boolean;
35
+ tokens?: Record<string, unknown>;
36
+ governance?: UserDesignSystem['governance'];
37
+ meta?: UserDSMeta;
38
+ error?: string;
39
+ }
40
+ /**
41
+ * Fetch user's design system tokens from Atomix API
42
+ *
43
+ * @param options - Fetch options including dsId and apiKey
44
+ * @returns User's tokens and governance rules
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const { tokens, governance } = await fetchUserDesignSystem({
49
+ * dsId: 'abc123',
50
+ * apiKey: 'user-api-key'
51
+ * });
52
+ * ```
53
+ */
54
+ declare function fetchUserDesignSystem(options: FetchUserDSOptions): Promise<UserDSResponse>;
55
+ interface CLIArgs {
56
+ /** User's design system ID */
57
+ dsId?: string;
58
+ /** API key for authentication */
59
+ apiKey?: string;
60
+ /** Tenant ID (legacy, mapped to dsId) */
61
+ tenant?: string;
62
+ /** Base URL for the Atomix API */
63
+ baseUrl?: string;
64
+ }
65
+ /**
66
+ * Parse command line arguments for user DS mode
67
+ *
68
+ * Supported args:
69
+ * - --ds-id <id>: User's design system ID
70
+ * - --api-key <key>: API key for authentication
71
+ * - --tenant <id>: Legacy tenant ID (mapped to dsId)
72
+ * - --base-url <url>: Custom API base URL
73
+ *
74
+ * @param argv - Command line arguments (default: process.argv)
75
+ * @returns Parsed CLI arguments
76
+ */
77
+ declare function parseCLIArgs(argv?: string[]): CLIArgs;
78
+ /**
79
+ * Check if CLI args indicate user DS mode
80
+ */
81
+ declare function isUserDSMode(args: CLIArgs): boolean;
82
+ /**
83
+ * Transform user DS tokens to match the structure expected by MCP server.
84
+ *
85
+ * User DS tokens come in the StoredDesignSystem format from InstantDB.
86
+ * This transforms them to the flat primitives structure used by MCP tools.
87
+ *
88
+ * @param userTokens - User's tokens from InstantDB
89
+ * @returns Tokens in MCP-compatible format
90
+ */
91
+ declare function transformUserTokens(userTokens: Record<string, unknown>): Record<string, unknown>;
92
+
93
+ /**
94
+ * AI Rules Generator
95
+ *
96
+ * Generates project-specific rules and MCP configurations for AI coding tools
97
+ * using the Atomix design system.
98
+ *
99
+ * SUPPORTED MCP CLIENTS (from modelcontextprotocol.io/clients):
100
+ *
101
+ * IDE/Editors:
102
+ * - Cursor (.cursorrules)
103
+ * - VS Code + GitHub Copilot (.github/copilot-instructions.md)
104
+ * - Windsurf (.windsurfrules)
105
+ * - Zed (MCP native)
106
+ * - Continue (.continuerules)
107
+ * - Cline (.clinerules)
108
+ * - CodeGPT (MCP native)
109
+ * - Amazon Q IDE (MCP native)
110
+ * - Augment Code (MCP native)
111
+ * - VT Code (MCP native)
112
+ *
113
+ * Desktop Apps:
114
+ * - Claude Desktop (MCP native)
115
+ * - BoltAI (MCP native)
116
+ * - Chatbox (MCP native)
117
+ * - ChatGPT (MCP native)
118
+ *
119
+ * CLI/Terminal:
120
+ * - Warp (.warp/workflows or MCP)
121
+ * - Amazon Q CLI (MCP native)
122
+ * - goose (MCP native)
123
+ *
124
+ * Frameworks/Libraries:
125
+ * - Genkit (MCP native)
126
+ * - LangChain (MCP native)
127
+ * - fast-agent (MCP native)
128
+ */
129
+ type AIToolId = "cursor" | "copilot" | "windsurf" | "cline" | "continue" | "zed" | "claude-desktop" | "generic";
130
+ interface AIToolConfig {
131
+ id: AIToolId;
132
+ name: string;
133
+ rulesFilename: string;
134
+ rulesPath: string;
135
+ mcpConfigPath?: string;
136
+ supportsMarkdown: boolean;
137
+ supportsMCP: boolean;
138
+ description: string;
139
+ }
140
+ /**
141
+ * Registry of supported AI coding tools and their rules file conventions
142
+ */
143
+ declare const AI_TOOLS: Record<AIToolId, AIToolConfig>;
144
+ type MCPConfigToolId = "cursor" | "claude-desktop" | "windsurf" | "continue" | "vscode";
145
+ interface MCPConfigOptions {
146
+ /** Path to the MCP server (default: npx @atomixstudio/mcp) */
147
+ serverPath?: string;
148
+ /** Use npx to run the server */
149
+ useNpx?: boolean;
150
+ /** Design system ID for per-user MCP mode */
151
+ dsId?: string;
152
+ /** API key for authentication (required for per-user mode) */
153
+ apiKey?: string;
154
+ /** @deprecated Use dsId instead. Tenant ID for backwards compatibility */
155
+ tenantId?: string;
156
+ /** Project name for identification */
157
+ projectName?: string;
158
+ }
159
+ interface MCPConfig {
160
+ tool: MCPConfigToolId;
161
+ filename: string;
162
+ path: string;
163
+ content: string;
164
+ instructions: string;
165
+ }
166
+ /**
167
+ * Generate MCP configuration file for a specific AI tool
168
+ */
169
+ declare function generateMCPConfig(tool: MCPConfigToolId, options?: MCPConfigOptions): MCPConfig;
170
+ /**
171
+ * Generate MCP configs for all supported tools
172
+ */
173
+ declare function generateAllMCPConfigs(options?: MCPConfigOptions): MCPConfig[];
174
+ /**
175
+ * Get detailed setup instructions for a specific AI tool
176
+ */
177
+ declare function getSetupInstructions(toolId: AIToolId): string;
178
+ declare function generateCursorRules(projectName: string, strict: boolean): string;
179
+ interface GeneratedRulesFile {
180
+ tool: AIToolConfig;
181
+ filename: string;
182
+ path: string;
183
+ content: string;
184
+ }
185
+ /**
186
+ * Generate rules for a specific AI tool
187
+ */
188
+ declare function generateRulesForTool(toolId: AIToolId, projectName: string, strict: boolean): GeneratedRulesFile;
189
+ /**
190
+ * Generate rules for ALL supported AI tools at once
191
+ */
192
+ declare function generateRulesForAllTools(projectName: string, strict: boolean): GeneratedRulesFile[];
193
+ /**
194
+ * Get list of all supported AI tools
195
+ */
196
+ declare function getSupportedAITools(): AIToolConfig[];
197
+ /**
198
+ * Generate a summary of which files to create for full AI tool support
199
+ */
200
+ declare function generateToolSetupGuide(projectName: string): string;
201
+
202
+ export { type AIToolId, AI_TOOLS, type MCPConfigToolId, fetchUserDesignSystem, generateAllMCPConfigs, generateCursorRules, generateMCPConfig, generateRulesForAllTools, generateRulesForTool, generateToolSetupGuide, getSetupInstructions, getSupportedAITools, isUserDSMode, parseCLIArgs, transformUserTokens };