Skip to content

Commit 0097323

Browse files
committed
feat: add branding support for TalkToFigma, refactor deep link and server name usage
1 parent f131563 commit 0097323

10 files changed

Lines changed: 81 additions & 31 deletions

File tree

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
"productName": "TalkToFigma Desktop",
44
"version": "2.0.15",
55
"description": "Bridge between Figma and AI tools (Cursor, Claude Code) using Model Context Protocol",
6+
"branding": {
7+
"shortName": "TalkToFigma",
8+
"mcpServerName": "TalkToFigmaDesktop",
9+
"mcpServerDirName": "TalkToFigma",
10+
"deepLinkScheme": "talktofigma"
11+
},
612
"type": "module",
713
"main": ".vite/build/main.cjs",
814
"scripts": {

src/components/mcp/McpClientItem.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ConfigCodeBlock } from './ConfigCodeBlock'
1212
import type { McpClient } from '@/lib/mcp/client-configs'
1313
import { formatClientConfig } from '@/lib/mcp/client-configs'
1414
import { useToast } from '@/hooks/use-toast'
15+
import { BRANDING } from '@/shared/branding'
1516

1617
interface McpClientItemProps {
1718
client: McpClient
@@ -51,7 +52,7 @@ export function McpClientItem({ client }: McpClientItemProps) {
5152
const base64Config = btoa(configJson)
5253
console.log('Base64 Config:', base64Config)
5354

54-
const deepLink = `cursor://anysphere.cursor-deeplink/mcp/install?name=TalkToFigmaDesktop&config=${base64Config}`
55+
const deepLink = `cursor://anysphere.cursor-deeplink/mcp/install?name=${BRANDING.mcpServerName}&config=${base64Config}`
5556
console.log('Full DeepLink:', deepLink)
5657

5758
window.location.href = deepLink
@@ -66,7 +67,7 @@ export function McpClientItem({ client }: McpClientItemProps) {
6667
if (client.id === 'cursor' || client.id === 'vscode' || client.id === 'antigravity') {
6768
const config = {
6869
mcpServers: {
69-
TalkToFigmaDesktop: {
70+
[BRANDING.mcpServerName]: {
7071
command: 'node',
7172
args: [stdioPath]
7273
}
@@ -81,12 +82,12 @@ export function McpClientItem({ client }: McpClientItemProps) {
8182
if (client.id === 'claude-code') {
8283
// Wrap path in quotes if it contains spaces
8384
const quotedPath = stdioPath.includes(' ') ? `"${stdioPath}"` : stdioPath
84-
return `claude mcp add TalkToFigmaDesktop node ${quotedPath}`
85+
return `claude mcp add ${BRANDING.mcpServerName} node ${quotedPath}`
8586
}
8687
if (client.id === 'codex') {
8788
// Codex requires `--` before the executable command.
8889
const shellQuotedPath = `'${stdioPath.replace(/'/g, `'\\''`)}'`
89-
return `codex mcp add TalkToFigmaDesktop -- node ${shellQuotedPath}`
90+
return `codex mcp add ${BRANDING.mcpServerName} -- node ${shellQuotedPath}`
9091
}
9192
return client.cliCommand || ''
9293
}
@@ -101,7 +102,7 @@ export function McpClientItem({ client }: McpClientItemProps) {
101102
<Separator />
102103
<h4 className="text-sm font-semibold mb-2">Deep Link</h4>
103104
<p className="text-sm text-muted-foreground">
104-
Click the button to open Cursor and install TalkToFigmaDesktop
105+
Click the button to open Cursor and install {BRANDING.mcpServerName}
105106
</p>
106107
<Button
107108
onClick={handleDeepLink}

src/lib/mcp/client-configs.ts

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Defines all supported MCP clients and their configuration formats
55
*/
66

7+
import { BRANDING } from '@/shared/branding'
8+
79
export type InstallMethod = 'deeplink' | 'cli' | 'auto-config' | 'manual' | 'coming-soon'
810

911
export interface McpClient {
@@ -26,17 +28,17 @@ export const MCP_CLIENTS: Record<string, McpClient> = {
2628
id: 'cursor',
2729
displayName: 'Cursor',
2830
configFormat: 'deeplink',
29-
serverName: 'TalkToFigmaDesktop',
31+
serverName: BRANDING.mcpServerName,
3032
installMethod: 'deeplink',
3133
description: 'Use Cursor to install the MCP server',
32-
deepLink: 'cursor://anysphere.cursor-deeplink/mcp/install?name=TalkToFigmaDesktop&config=' +
34+
deepLink: `cursor://anysphere.cursor-deeplink/mcp/install?name=${BRANDING.mcpServerName}&config=` +
3335
encodeURIComponent(JSON.stringify({
3436
command: 'node',
3537
args: ['<STDIO_SERVER_PATH>'] // Will be replaced with actual path
3638
})),
3739
config: {
3840
mcpServers: {
39-
TalkToFigmaDesktop: {
41+
[BRANDING.mcpServerName]: {
4042
command: 'node',
4143
args: ['<STDIO_SERVER_PATH>'] // Replace with actual path to mcp-stdio-server.js
4244
}
@@ -47,18 +49,18 @@ export const MCP_CLIENTS: Record<string, McpClient> = {
4749
'The server path (~/.talktofigma/server) is automatically configured',
4850
'Cursor will open and show the MCP configuration dialog',
4951
'Click "Connect" to complete the installation',
50-
'TalkToFigmaDesktop will be added to your MCP servers'
52+
`${BRANDING.mcpServerName} will be added to your MCP servers`
5153
]
5254
},
5355

5456
claudeCode: {
5557
id: 'claude-code',
5658
displayName: 'Claude Code',
5759
configFormat: 'cli',
58-
serverName: 'TalkToFigmaDesktop',
60+
serverName: BRANDING.mcpServerName,
5961
installMethod: 'cli',
6062
description: 'Use Claude Code to install the MCP server',
61-
cliCommand: 'claude mcp add TalkToFigmaDesktop node <STDIO_SERVER_PATH>',
63+
cliCommand: `claude mcp add ${BRANDING.mcpServerName} node <STDIO_SERVER_PATH>`,
6264
instructions: [
6365
'Copy the command above (server path is pre-filled)',
6466
'Open your terminal',
@@ -72,16 +74,16 @@ export const MCP_CLIENTS: Record<string, McpClient> = {
7274
id: 'codex',
7375
displayName: 'Codex CLI',
7476
configFormat: 'cli',
75-
serverName: 'TalkToFigmaDesktop',
77+
serverName: BRANDING.mcpServerName,
7678
installMethod: 'cli',
7779
description: 'Use Codex CLI to install the MCP server',
78-
cliCommand: 'codex mcp add TalkToFigmaDesktop -- node <STDIO_SERVER_PATH>',
80+
cliCommand: `codex mcp add ${BRANDING.mcpServerName} -- node <STDIO_SERVER_PATH>`,
7981
instructions: [
8082
'Copy the command above (server path is pre-filled)',
8183
'Open your terminal',
8284
'Paste and run the command',
83-
'Use codex mcp list to verify TalkToFigmaDesktop is enabled',
84-
'If a malformed entry exists, run codex mcp remove TalkToFigmaDesktop and add it again'
85+
`Use codex mcp list to verify ${BRANDING.mcpServerName} is enabled`,
86+
`If a malformed entry exists, run codex mcp remove ${BRANDING.mcpServerName} and add it again`
8587
]
8688
},
8789

@@ -90,12 +92,12 @@ export const MCP_CLIENTS: Record<string, McpClient> = {
9092
displayName: 'VS Code',
9193
configPath: '~/.vscode/mcp.json', // Approximate - may vary
9294
configFormat: 'json',
93-
serverName: 'TalkToFigmaDesktop',
95+
serverName: BRANDING.mcpServerName,
9496
installMethod: 'manual',
9597
description: 'Use VS Code to install the MCP server',
9698
config: {
9799
mcpServers: {
98-
TalkToFigmaDesktop: {
100+
[BRANDING.mcpServerName]: {
99101
command: 'node',
100102
args: ['<STDIO_SERVER_PATH>'] // Replace with actual path to mcp-stdio-server.js
101103
}
@@ -115,12 +117,12 @@ export const MCP_CLIENTS: Record<string, McpClient> = {
115117
displayName: 'Antigravity',
116118
configPath: '~/Library/Application Support/Antigravity/mcp_config.json', // macOS
117119
configFormat: 'json',
118-
serverName: 'TalkToFigmaDesktop',
120+
serverName: BRANDING.mcpServerName,
119121
installMethod: 'manual',
120122
description: 'Google Antigravity AI editor',
121123
config: {
122124
mcpServers: {
123-
TalkToFigmaDesktop: {
125+
[BRANDING.mcpServerName]: {
124126
command: 'node',
125127
args: ['<STDIO_SERVER_PATH>'] // Replace with actual path to mcp-stdio-server.js
126128
}
@@ -139,7 +141,7 @@ export const MCP_CLIENTS: Record<string, McpClient> = {
139141
id: 'coming-soon',
140142
displayName: 'Other Clients',
141143
configFormat: 'unknown',
142-
serverName: 'TalkToFigmaDesktop',
144+
serverName: BRANDING.mcpServerName,
143145
installMethod: 'coming-soon',
144146
description: 'Support for additional MCP clients coming soon',
145147
instructions: [
@@ -201,7 +203,7 @@ export function getCursorDeepLink(): string {
201203
args: ['<STDIO_SERVER_PATH>']
202204
}
203205

204-
return `cursor://anysphere.cursor-deeplink/mcp/install?name=TalkToFigmaDesktop&config=${encodeURIComponent(JSON.stringify(config))}`
206+
return `cursor://anysphere.cursor-deeplink/mcp/install?name=${BRANDING.mcpServerName}&config=${encodeURIComponent(JSON.stringify(config))}`
205207
}
206208

207209
/**

src/main/server/TalkToFigmaMcpServer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { allPrompts, promptContents } from './prompts';
2424
import { allTools } from './tools';
2525
import { ServerStatus } from './TalkToFigmaWebSocketServer';
2626
import { isChannelNotRequired } from '../../shared/constants';
27+
import { BRANDING } from '../../shared/branding';
2728

2829
const logger = createLogger('MCP');
2930

@@ -91,7 +92,7 @@ export class TalkToFigmaMcpServer {
9192
// Create MCP server instance
9293
this.server = new Server(
9394
{
94-
name: 'TalkToFigmaDesktop',
95+
name: BRANDING.mcpServerName,
9596
version: '1.0.0',
9697
},
9798
{
@@ -367,7 +368,7 @@ export class TalkToFigmaMcpServer {
367368
prompts: {},
368369
},
369370
serverInfo: {
370-
name: 'TalkToFigmaDesktop',
371+
name: BRANDING.mcpServerName,
371372
version: '1.0.0',
372373
},
373374
};

src/main/server/TalkToFigmaMcpServerStdio.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const logger = {
2626
import { allPrompts, promptContents } from './shared/prompt-registry';
2727
import { allTools } from './shared/tool-registry';
2828
import { WebSocketClient } from './shared/websocket-client';
29+
import { BRANDING } from '../../shared/branding';
2930

3031
/**
3132
* MCP Server for stdio transport (spawned by MCP clients)
@@ -55,7 +56,7 @@ export class TalkToFigmaMcpServerStdio {
5556
// Create MCP server instance
5657
this.server = new Server(
5758
{
58-
name: 'TalkToFigmaDesktop',
59+
name: BRANDING.mcpServerName,
5960
version: '1.0.0',
6061
},
6162
{
@@ -137,7 +138,7 @@ export class TalkToFigmaMcpServerStdio {
137138
prompts: {},
138139
},
139140
serverInfo: {
140-
name: 'TalkToFigmaDesktop',
141+
name: BRANDING.mcpServerName,
141142
version: '1.0.0',
142143
},
143144
};

src/main/server/mcp-server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { createLogger } from '../utils/logger';
44
import { PORTS, TIMEOUTS } from '../../shared/constants';
55
import { getAllTools, initializeServices, ToolDefinition } from './services';
66
import { FigmaWebSocketServer } from './websocket-server';
7+
import { BRANDING } from '../../shared/branding';
78

89
const logger = createLogger('MCP');
910

@@ -309,7 +310,7 @@ export class McpSseServer {
309310
return {
310311
protocolVersion: '2024-11-05',
311312
serverInfo: {
312-
name: 'TalkToFigmaDesktop',
313+
name: BRANDING.mcpServerName,
313314
version: '1.0.0',
314315
},
315316
capabilities: {

src/main/utils/stdio-installer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import path from 'node:path';
99
import { existsSync, mkdirSync, copyFileSync } from 'node:fs';
1010
import os from 'node:os';
1111
import { createLogger } from './logger';
12+
import { BRANDING } from '@/shared/branding';
1213

1314
const logger = createLogger('stdio');
1415

@@ -24,11 +25,11 @@ export function getInstallPaths() {
2425
// Application Support location (works in all environments including sandboxed)
2526
let appSupportDir: string;
2627
if (platform === 'darwin') {
27-
appSupportDir = path.join(homeDir, 'Library', 'Application Support', 'TalkToFigma');
28+
appSupportDir = path.join(homeDir, 'Library', 'Application Support', BRANDING.mcpServerDirName);
2829
} else if (platform === 'win32') {
29-
appSupportDir = path.join(process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming'), 'TalkToFigma');
30+
appSupportDir = path.join(process.env.APPDATA || path.join(homeDir, 'AppData', 'Roaming'), BRANDING.mcpServerDirName);
3031
} else {
31-
throw new Error(`Unsupported platform: ${platform}. TalkToFigma Desktop supports macOS and Windows only.`);
32+
throw new Error(`Unsupported platform: ${platform}. ${BRANDING.productName} supports macOS and Windows only.`);
3233
}
3334

3435
const serverPath = path.join(appSupportDir, 'mcp-server.cjs');

src/main/utils/stdio-path.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import path from 'node:path';
99
import { existsSync } from 'node:fs';
1010
import { createLogger } from './logger';
1111
import { getInstalledServerPath, getInstallPaths } from './stdio-installer';
12+
import { BRANDING } from '@/shared/branding';
1213

1314
const logger = createLogger('stdio');
1415

@@ -83,7 +84,7 @@ export function getStdioServerConfig(): object {
8384

8485
return {
8586
mcpServers: {
86-
TalkToFigmaDesktop: {
87+
[BRANDING.mcpServerName]: {
8788
command: 'node',
8889
args: [stdioServerPath]
8990
},

src/shared/branding.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import packageJson from '../../package.json';
2+
3+
interface PackageBranding {
4+
shortName?: string;
5+
mcpServerName?: string;
6+
mcpServerDirName?: string;
7+
deepLinkScheme?: string;
8+
}
9+
10+
interface PackagedMetadata {
11+
productName?: string;
12+
branding?: PackageBranding;
13+
}
14+
15+
const packagedMetadata = packageJson as PackagedMetadata;
16+
const branding = packagedMetadata.branding ?? {};
17+
18+
function sanitizeServerName(value: string | undefined): string {
19+
const sanitized = (value ?? '').replace(/[^A-Za-z0-9]/g, '');
20+
return sanitized || 'TalkToFigmaDesktop';
21+
}
22+
23+
function sanitizeDeepLinkScheme(value: string | undefined): string {
24+
const sanitized = (value ?? '').toLowerCase().replace(/[^a-z0-9]/g, '');
25+
return sanitized || 'talktofigma';
26+
}
27+
28+
export const BRANDING = {
29+
productName: packagedMetadata.productName || 'TalkToFigma Desktop',
30+
shortName: branding.shortName || 'TalkToFigma',
31+
mcpServerName: sanitizeServerName(branding.mcpServerName),
32+
mcpServerDirName: branding.mcpServerDirName || 'TalkToFigma',
33+
deepLinkScheme: sanitizeDeepLinkScheme(branding.deepLinkScheme),
34+
} as const;

src/shared/constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
55
*/
66

7+
import { BRANDING } from './branding';
8+
79
// Shared constants across main and renderer processes
810

911
// Server ports
@@ -110,7 +112,7 @@ export const STORE_KEYS = {
110112

111113
// App metadata
112114
export const APP_INFO = {
113-
NAME: 'TalkToFigmaDesktop',
115+
NAME: BRANDING.mcpServerName,
114116
VERSION: '1.0.0',
115117
DESCRIPTION: 'Figma plugin to MCP server bridge',
116118
} as const;

0 commit comments

Comments
 (0)