Aktraiser
commited on
Commit
·
0f2b5e7
1
Parent(s):
cf5cfd2
probleme init
Browse files- app.py +8 -33
- tools/config.py +11 -1
app.py
CHANGED
@@ -29,31 +29,6 @@ except Exception as e:
|
|
29 |
def setup_demo():
|
30 |
"""Configure l'interface Gradio pour le serveur MCP"""
|
31 |
|
32 |
-
# Fonctions wrapper pour éviter les problèmes avec les lambdas
|
33 |
-
def test_file_info():
|
34 |
-
return get_figma_file_info()
|
35 |
-
|
36 |
-
def test_comments():
|
37 |
-
return get_figma_comments()
|
38 |
-
|
39 |
-
def test_user():
|
40 |
-
return get_figma_user_info()
|
41 |
-
|
42 |
-
def test_user_detailed():
|
43 |
-
return get_figma_user_detailed_info()
|
44 |
-
|
45 |
-
def test_user_teams():
|
46 |
-
return list_figma_user_teams()
|
47 |
-
|
48 |
-
def test_user_permissions():
|
49 |
-
return get_figma_current_user_permissions()
|
50 |
-
|
51 |
-
def test_workspace_stats():
|
52 |
-
return get_figma_workspace_usage_stats()
|
53 |
-
|
54 |
-
def test_api_limitations():
|
55 |
-
return get_figma_api_limitations_info()
|
56 |
-
|
57 |
with gr.Blocks(
|
58 |
title="🎨 Figma MCP Server",
|
59 |
theme=gr.themes.Soft(),
|
@@ -138,42 +113,42 @@ def setup_demo():
|
|
138 |
)
|
139 |
|
140 |
test_info_btn.click(
|
141 |
-
|
142 |
outputs=[status_output]
|
143 |
)
|
144 |
|
145 |
test_comments_btn.click(
|
146 |
-
|
147 |
outputs=[status_output]
|
148 |
)
|
149 |
|
150 |
test_user_btn.click(
|
151 |
-
|
152 |
outputs=[status_output]
|
153 |
)
|
154 |
|
155 |
test_user_detailed_btn.click(
|
156 |
-
|
157 |
outputs=[status_output]
|
158 |
)
|
159 |
|
160 |
test_teams_btn.click(
|
161 |
-
|
162 |
outputs=[status_output]
|
163 |
)
|
164 |
|
165 |
test_permissions_btn.click(
|
166 |
-
|
167 |
outputs=[status_output]
|
168 |
)
|
169 |
|
170 |
test_stats_btn.click(
|
171 |
-
|
172 |
outputs=[status_output]
|
173 |
)
|
174 |
|
175 |
test_limitations_btn.click(
|
176 |
-
|
177 |
outputs=[status_output]
|
178 |
)
|
179 |
|
|
|
29 |
def setup_demo():
|
30 |
"""Configure l'interface Gradio pour le serveur MCP"""
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
with gr.Blocks(
|
33 |
title="🎨 Figma MCP Server",
|
34 |
theme=gr.themes.Soft(),
|
|
|
113 |
)
|
114 |
|
115 |
test_info_btn.click(
|
116 |
+
get_figma_file_info,
|
117 |
outputs=[status_output]
|
118 |
)
|
119 |
|
120 |
test_comments_btn.click(
|
121 |
+
get_figma_comments,
|
122 |
outputs=[status_output]
|
123 |
)
|
124 |
|
125 |
test_user_btn.click(
|
126 |
+
get_figma_user_info,
|
127 |
outputs=[status_output]
|
128 |
)
|
129 |
|
130 |
test_user_detailed_btn.click(
|
131 |
+
get_figma_user_detailed_info,
|
132 |
outputs=[status_output]
|
133 |
)
|
134 |
|
135 |
test_teams_btn.click(
|
136 |
+
list_figma_user_teams,
|
137 |
outputs=[status_output]
|
138 |
)
|
139 |
|
140 |
test_permissions_btn.click(
|
141 |
+
get_figma_current_user_permissions,
|
142 |
outputs=[status_output]
|
143 |
)
|
144 |
|
145 |
test_stats_btn.click(
|
146 |
+
get_figma_workspace_usage_stats,
|
147 |
outputs=[status_output]
|
148 |
)
|
149 |
|
150 |
test_limitations_btn.click(
|
151 |
+
get_figma_api_limitations_info,
|
152 |
outputs=[status_output]
|
153 |
)
|
154 |
|
tools/config.py
CHANGED
@@ -19,7 +19,17 @@ figma_config = {
|
|
19 |
}
|
20 |
|
21 |
def make_figma_request(endpoint: str, method: str = "GET", data: Dict = None) -> Dict[str, Any]:
|
22 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
if not figma_config["token"]:
|
24 |
return {"error": "Token Figma non configuré"}
|
25 |
|
|
|
19 |
}
|
20 |
|
21 |
def make_figma_request(endpoint: str, method: str = "GET", data: Dict = None) -> Dict[str, Any]:
|
22 |
+
"""
|
23 |
+
Effectue une requête à l'API Figma.
|
24 |
+
|
25 |
+
Args:
|
26 |
+
endpoint (str): Point de terminaison de l'API Figma (sans l'URL de base)
|
27 |
+
method (str): Méthode HTTP à utiliser (défaut: GET)
|
28 |
+
data (Dict): Données à envoyer avec la requête (optionnel)
|
29 |
+
|
30 |
+
Returns:
|
31 |
+
Dict[str, Any]: Réponse de l'API ou dictionnaire d'erreur
|
32 |
+
"""
|
33 |
if not figma_config["token"]:
|
34 |
return {"error": "Token Figma non configuré"}
|
35 |
|