figmanage 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.
- package/LICENSE +21 -0
- package/README.md +338 -0
- package/dist/auth/client.d.ts +15 -0
- package/dist/auth/client.js +29 -0
- package/dist/auth/health.d.ts +5 -0
- package/dist/auth/health.js +93 -0
- package/dist/clients/internal-api.d.ts +4 -0
- package/dist/clients/internal-api.js +50 -0
- package/dist/clients/public-api.d.ts +4 -0
- package/dist/clients/public-api.js +47 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +100 -0
- package/dist/setup.d.ts +3 -0
- package/dist/setup.js +565 -0
- package/dist/tools/analytics.d.ts +2 -0
- package/dist/tools/analytics.js +58 -0
- package/dist/tools/branching.d.ts +2 -0
- package/dist/tools/branching.js +103 -0
- package/dist/tools/comments.d.ts +2 -0
- package/dist/tools/comments.js +147 -0
- package/dist/tools/components.d.ts +2 -0
- package/dist/tools/components.js +104 -0
- package/dist/tools/compound.d.ts +2 -0
- package/dist/tools/compound.js +334 -0
- package/dist/tools/export.d.ts +2 -0
- package/dist/tools/export.js +70 -0
- package/dist/tools/files.d.ts +2 -0
- package/dist/tools/files.js +241 -0
- package/dist/tools/libraries.d.ts +2 -0
- package/dist/tools/libraries.js +31 -0
- package/dist/tools/navigate.d.ts +2 -0
- package/dist/tools/navigate.js +436 -0
- package/dist/tools/org.d.ts +2 -0
- package/dist/tools/org.js +311 -0
- package/dist/tools/permissions.d.ts +2 -0
- package/dist/tools/permissions.js +246 -0
- package/dist/tools/projects.d.ts +2 -0
- package/dist/tools/projects.js +160 -0
- package/dist/tools/reading.d.ts +2 -0
- package/dist/tools/reading.js +60 -0
- package/dist/tools/register.d.ts +32 -0
- package/dist/tools/register.js +76 -0
- package/dist/tools/teams.d.ts +2 -0
- package/dist/tools/teams.js +81 -0
- package/dist/tools/variables.d.ts +2 -0
- package/dist/tools/variables.js +102 -0
- package/dist/tools/versions.d.ts +2 -0
- package/dist/tools/versions.js +69 -0
- package/dist/tools/webhooks.d.ts +2 -0
- package/dist/tools/webhooks.js +126 -0
- package/dist/types/figma.d.ts +58 -0
- package/dist/types/figma.js +2 -0
- package/package.json +55 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { publicClient } from '../clients/public-api.js';
|
|
3
|
+
import { defineTool, toolResult, toolError, figmaId } from './register.js';
|
|
4
|
+
const eventTypeEnum = z.enum([
|
|
5
|
+
'FILE_UPDATE',
|
|
6
|
+
'FILE_DELETE',
|
|
7
|
+
'FILE_VERSION_UPDATE',
|
|
8
|
+
'LIBRARY_PUBLISH',
|
|
9
|
+
'FILE_COMMENT',
|
|
10
|
+
'PING',
|
|
11
|
+
]);
|
|
12
|
+
// -- list_webhooks --
|
|
13
|
+
defineTool({
|
|
14
|
+
toolset: 'webhooks',
|
|
15
|
+
auth: 'pat',
|
|
16
|
+
register(server, config) {
|
|
17
|
+
server.registerTool('list_webhooks', {
|
|
18
|
+
description: 'List webhooks for a team.',
|
|
19
|
+
inputSchema: {
|
|
20
|
+
team_id: figmaId.describe('Team ID'),
|
|
21
|
+
},
|
|
22
|
+
}, async ({ team_id }) => {
|
|
23
|
+
try {
|
|
24
|
+
const res = await publicClient(config).get(`/v2/teams/${team_id}/webhooks`);
|
|
25
|
+
const webhooks = res.data?.webhooks || [];
|
|
26
|
+
return toolResult(JSON.stringify(webhooks, null, 2));
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
return toolError(`Failed to list webhooks: ${e.response?.status || e.message}`);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
// -- create_webhook --
|
|
35
|
+
defineTool({
|
|
36
|
+
toolset: 'webhooks',
|
|
37
|
+
auth: 'pat',
|
|
38
|
+
mutates: true,
|
|
39
|
+
register(server, config) {
|
|
40
|
+
server.registerTool('create_webhook', {
|
|
41
|
+
description: 'Create a webhook subscription for a team.',
|
|
42
|
+
inputSchema: {
|
|
43
|
+
team_id: figmaId.describe('Team ID'),
|
|
44
|
+
event_type: eventTypeEnum.describe('Event type to subscribe to'),
|
|
45
|
+
endpoint: z.string().describe('URL to receive webhook payloads'),
|
|
46
|
+
passcode: z.string().describe('Secret for signature verification'),
|
|
47
|
+
description: z.string().optional().describe('Webhook description'),
|
|
48
|
+
},
|
|
49
|
+
}, async ({ team_id, event_type, endpoint, passcode, description }) => {
|
|
50
|
+
try {
|
|
51
|
+
const body = { team_id, event_type, endpoint, passcode };
|
|
52
|
+
if (description)
|
|
53
|
+
body.description = description;
|
|
54
|
+
const res = await publicClient(config).post('/v2/webhooks', body);
|
|
55
|
+
const { passcode: _, ...safe } = res.data || {};
|
|
56
|
+
return toolResult(JSON.stringify(safe, null, 2));
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
return toolError(`Failed to create webhook: ${e.response?.status || e.message}`);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
// -- update_webhook --
|
|
65
|
+
defineTool({
|
|
66
|
+
toolset: 'webhooks',
|
|
67
|
+
auth: 'pat',
|
|
68
|
+
mutates: true,
|
|
69
|
+
register(server, config) {
|
|
70
|
+
server.registerTool('update_webhook', {
|
|
71
|
+
description: 'Update a webhook.',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
webhook_id: figmaId.describe('Webhook ID'),
|
|
74
|
+
event_type: eventTypeEnum.optional().describe('Event type to subscribe to'),
|
|
75
|
+
endpoint: z.string().optional().describe('URL to receive webhook payloads'),
|
|
76
|
+
passcode: z.string().optional().describe('Secret for signature verification'),
|
|
77
|
+
description: z.string().optional().describe('Webhook description'),
|
|
78
|
+
status: z.enum(['ACTIVE', 'PAUSED']).optional().describe('Webhook status'),
|
|
79
|
+
},
|
|
80
|
+
}, async ({ webhook_id, event_type, endpoint, passcode, description, status }) => {
|
|
81
|
+
try {
|
|
82
|
+
const body = {};
|
|
83
|
+
if (event_type)
|
|
84
|
+
body.event_type = event_type;
|
|
85
|
+
if (endpoint)
|
|
86
|
+
body.endpoint = endpoint;
|
|
87
|
+
if (passcode)
|
|
88
|
+
body.passcode = passcode;
|
|
89
|
+
if (description)
|
|
90
|
+
body.description = description;
|
|
91
|
+
if (status)
|
|
92
|
+
body.status = status;
|
|
93
|
+
const res = await publicClient(config).put(`/v2/webhooks/${webhook_id}`, body);
|
|
94
|
+
const { passcode: _, ...safe } = res.data || {};
|
|
95
|
+
return toolResult(JSON.stringify(safe, null, 2));
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
return toolError(`Failed to update webhook: ${e.response?.status || e.message}`);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
// -- delete_webhook --
|
|
104
|
+
defineTool({
|
|
105
|
+
toolset: 'webhooks',
|
|
106
|
+
auth: 'pat',
|
|
107
|
+
mutates: true,
|
|
108
|
+
destructive: true,
|
|
109
|
+
register(server, config) {
|
|
110
|
+
server.registerTool('delete_webhook', {
|
|
111
|
+
description: 'Delete a webhook.',
|
|
112
|
+
inputSchema: {
|
|
113
|
+
webhook_id: figmaId.describe('Webhook ID'),
|
|
114
|
+
},
|
|
115
|
+
}, async ({ webhook_id }) => {
|
|
116
|
+
try {
|
|
117
|
+
await publicClient(config).delete(`/v2/webhooks/${webhook_id}`);
|
|
118
|
+
return toolResult(`Deleted webhook ${webhook_id}`);
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
return toolError(`Failed to delete webhook: ${e.response?.status || e.message}`);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface AuthStatus {
|
|
2
|
+
pat: {
|
|
3
|
+
valid: boolean;
|
|
4
|
+
user?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
};
|
|
7
|
+
cookie: {
|
|
8
|
+
valid: boolean;
|
|
9
|
+
user?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface FigmaTeam {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
export interface FigmaProject {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
team_id?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FigmaFile {
|
|
23
|
+
key: string;
|
|
24
|
+
name: string;
|
|
25
|
+
last_modified?: string;
|
|
26
|
+
thumbnail_url?: string;
|
|
27
|
+
editor_type?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface FigmaFileMeta {
|
|
30
|
+
key: string;
|
|
31
|
+
name: string;
|
|
32
|
+
last_modified: string;
|
|
33
|
+
thumbnail_url?: string;
|
|
34
|
+
editor_type?: string;
|
|
35
|
+
folder_id?: string;
|
|
36
|
+
team_id?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PaginatedResponse<T> {
|
|
39
|
+
items: T[];
|
|
40
|
+
total?: number;
|
|
41
|
+
has_more: boolean;
|
|
42
|
+
next_page_token?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface FigmaUser {
|
|
45
|
+
id: string;
|
|
46
|
+
handle: string;
|
|
47
|
+
email: string;
|
|
48
|
+
img_url?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface FigmaRole {
|
|
51
|
+
user_id: string;
|
|
52
|
+
role: string;
|
|
53
|
+
email?: string;
|
|
54
|
+
handle?: string;
|
|
55
|
+
}
|
|
56
|
+
export type EditorType = 'design' | 'whiteboard' | 'slides' | 'sites' | 'figmake';
|
|
57
|
+
export type Toolset = 'navigate' | 'files' | 'projects' | 'permissions' | 'org' | 'versions' | 'branching' | 'comments' | 'export' | 'analytics' | 'reading' | 'components' | 'webhooks' | 'variables' | 'compound' | 'teams' | 'libraries';
|
|
58
|
+
//# sourceMappingURL=figma.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "figmanage",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for managing your Figma workspace from the terminal.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"figmanage": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/**/*.js",
|
|
12
|
+
"dist/**/*.d.ts",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsc --watch",
|
|
19
|
+
"start": "node dist/index.js",
|
|
20
|
+
"setup": "node dist/setup.js",
|
|
21
|
+
"lint": "tsc --noEmit",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"figma",
|
|
27
|
+
"mcp",
|
|
28
|
+
"figmanage",
|
|
29
|
+
"workspace",
|
|
30
|
+
"admin",
|
|
31
|
+
"management",
|
|
32
|
+
"figma-manager"
|
|
33
|
+
],
|
|
34
|
+
"author": "Danny Keane",
|
|
35
|
+
"license": "MIT",
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/dannykeane/figmanage.git"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/dannykeane/figmanage#readme",
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@modelcontextprotocol/sdk": "^1.25.0",
|
|
43
|
+
"axios": "^1.7.0",
|
|
44
|
+
"axios-retry": "^4.4.0",
|
|
45
|
+
"zod": "^3.23.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"typescript": "^5.6.0",
|
|
50
|
+
"vitest": "^4.1.0"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=18"
|
|
54
|
+
}
|
|
55
|
+
}
|