sonance-brand-mcp 1.1.1 → 1.1.4

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 (2) hide show
  1. package/dist/index.js +155 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -109,6 +109,161 @@ if (process.argv.includes("--init") || process.argv.includes("init")) {
109
109
  runInstaller();
110
110
  process.exit(0);
111
111
  }
112
+ /**
113
+ * Run the installer for Claude Code (creates .mcp.json in current directory)
114
+ */
115
+ function runClaudeCodeInstaller() {
116
+ console.log("");
117
+ console.log(" ┌─────────────────────────────────────────────────┐");
118
+ console.log(" │ │");
119
+ console.log(" │ 🎨 Sonance Brand MCP - Claude Code Setup │");
120
+ console.log(" │ │");
121
+ console.log(" └─────────────────────────────────────────────────┘");
122
+ console.log("");
123
+ const configPath = path.join(process.cwd(), ".mcp.json");
124
+ console.log(` 📍 Config file: ${configPath}`);
125
+ console.log("");
126
+ // Read existing config or create new one
127
+ let config = {};
128
+ if (fs.existsSync(configPath)) {
129
+ try {
130
+ const content = fs.readFileSync(configPath, "utf-8");
131
+ config = JSON.parse(content);
132
+ console.log(" 📄 Found existing .mcp.json");
133
+ }
134
+ catch {
135
+ console.log(" ⚠️ Could not parse existing .mcp.json, creating new one");
136
+ }
137
+ }
138
+ else {
139
+ console.log(" 📄 Creating new .mcp.json");
140
+ }
141
+ // Initialize mcpServers if not present
142
+ if (!config.mcpServers) {
143
+ config.mcpServers = {};
144
+ }
145
+ // Check if already installed
146
+ if (config.mcpServers["sonance-brand"]) {
147
+ console.log(" ✅ sonance-brand is already configured!");
148
+ console.log("");
149
+ console.log(" To use it:");
150
+ console.log(" 1. Start Claude Code in this directory: claude");
151
+ console.log(" 2. The MCP tools will be available automatically");
152
+ console.log("");
153
+ return;
154
+ }
155
+ // Add Sonance server config (using npx for auto-updates)
156
+ config.mcpServers["sonance-brand"] = {
157
+ command: "npx",
158
+ args: ["-y", "sonance-brand-mcp"],
159
+ };
160
+ // Write updated config
161
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
162
+ console.log("");
163
+ console.log(" ✅ Sonance Brand MCP installed successfully!");
164
+ console.log("");
165
+ console.log(" ┌─────────────────────────────────────────────────┐");
166
+ console.log(" │ Next steps: │");
167
+ console.log(" │ │");
168
+ console.log(" │ 1. Start Claude Code in this directory: │");
169
+ console.log(" │ $ claude │");
170
+ console.log(" │ │");
171
+ console.log(" │ 2. The MCP tools will load automatically │");
172
+ console.log(" │ │");
173
+ console.log(" └─────────────────────────────────────────────────┘");
174
+ console.log("");
175
+ console.log(" Try asking Claude:");
176
+ console.log(" \"What are the official Sonance brand colors?\"");
177
+ console.log("");
178
+ }
179
+ // Check for --init-code flag BEFORE starting MCP server
180
+ if (process.argv.includes("--init-code") || process.argv.includes("init-code")) {
181
+ runClaudeCodeInstaller();
182
+ process.exit(0);
183
+ }
184
+ /**
185
+ * Run the installer for Cursor IDE (creates .cursor/mcp.json in current directory)
186
+ */
187
+ function runCursorInstaller() {
188
+ console.log("");
189
+ console.log(" ┌─────────────────────────────────────────────────┐");
190
+ console.log(" │ │");
191
+ console.log(" │ 🎨 Sonance Brand MCP - Cursor IDE Setup │");
192
+ console.log(" │ │");
193
+ console.log(" └─────────────────────────────────────────────────┘");
194
+ console.log("");
195
+ const cursorDir = path.join(process.cwd(), ".cursor");
196
+ const configPath = path.join(cursorDir, "mcp.json");
197
+ console.log(` 📍 Config file: ${configPath}`);
198
+ console.log("");
199
+ // Create .cursor directory if it doesn't exist
200
+ if (!fs.existsSync(cursorDir)) {
201
+ console.log(" 📁 Creating .cursor directory...");
202
+ fs.mkdirSync(cursorDir, { recursive: true });
203
+ }
204
+ // Read existing config or create new one
205
+ let config = {};
206
+ if (fs.existsSync(configPath)) {
207
+ try {
208
+ const content = fs.readFileSync(configPath, "utf-8");
209
+ config = JSON.parse(content);
210
+ console.log(" 📄 Found existing .cursor/mcp.json");
211
+ }
212
+ catch {
213
+ console.log(" ⚠️ Could not parse existing mcp.json, creating new one");
214
+ }
215
+ }
216
+ else {
217
+ console.log(" 📄 Creating new .cursor/mcp.json");
218
+ }
219
+ // Initialize mcpServers if not present
220
+ if (!config.mcpServers) {
221
+ config.mcpServers = {};
222
+ }
223
+ // Check if already installed
224
+ if (config.mcpServers["sonance-brand"]) {
225
+ console.log(" ✅ sonance-brand is already configured!");
226
+ console.log("");
227
+ console.log(" To use it:");
228
+ console.log(" 1. Restart Cursor (Cmd+Q / Alt+F4, then reopen)");
229
+ console.log(" 2. Open this project in Cursor");
230
+ console.log(" 3. The MCP tools will be available in Agent mode");
231
+ console.log("");
232
+ return;
233
+ }
234
+ // Add Sonance server config (using npx for auto-updates)
235
+ config.mcpServers["sonance-brand"] = {
236
+ command: "npx",
237
+ args: ["-y", "sonance-brand-mcp"],
238
+ };
239
+ // Write updated config
240
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
241
+ console.log("");
242
+ console.log(" ✅ Sonance Brand MCP installed successfully!");
243
+ console.log("");
244
+ console.log(" ┌─────────────────────────────────────────────────┐");
245
+ console.log(" │ Next steps: │");
246
+ console.log(" │ │");
247
+ console.log(" │ 1. Restart Cursor │");
248
+ console.log(" │ • Mac: Press Cmd+Q, then reopen │");
249
+ console.log(" │ • Windows: Press Alt+F4, then reopen │");
250
+ console.log(" │ │");
251
+ console.log(" │ 2. Open this project in Cursor │");
252
+ console.log(" │ │");
253
+ console.log(" │ 3. Use Agent mode (not Ask mode) to access │");
254
+ console.log(" │ MCP tools │");
255
+ console.log(" │ │");
256
+ console.log(" └─────────────────────────────────────────────────┘");
257
+ console.log("");
258
+ console.log(" Try asking Cursor:");
259
+ console.log(" \"What are the official Sonance brand colors?\"");
260
+ console.log("");
261
+ }
262
+ // Check for --init-cursor flag BEFORE starting MCP server
263
+ if (process.argv.includes("--init-cursor") || process.argv.includes("init-cursor")) {
264
+ runCursorInstaller();
265
+ process.exit(0);
266
+ }
112
267
  // ============================================
113
268
  // PATH RESOLUTION
114
269
  // ============================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonance-brand-mcp",
3
- "version": "1.1.1",
3
+ "version": "1.1.4",
4
4
  "description": "MCP Server for Sonance Brand Guidelines and Component Library - gives Claude instant access to brand colors, typography, and UI components.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",