sonance-brand-mcp 1.1.3 → 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 +83 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -181,6 +181,89 @@ if (process.argv.includes("--init-code") || process.argv.includes("init-code"))
181
181
  runClaudeCodeInstaller();
182
182
  process.exit(0);
183
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
+ }
184
267
  // ============================================
185
268
  // PATH RESOLUTION
186
269
  // ============================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonance-brand-mcp",
3
- "version": "1.1.3",
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",