spex-mcp
Version:
MCP server for Figma SpeX plugin and Cursor AI integration
92 lines (73 loc) ⢠4.93 kB
Markdown
This directory contains the **Local Development Mode** implementation for SpeX MCP server, restored from stable version **1.5.0** (commit `d1536d965cb4b02262b8a659611375dfb4a4acc7`).
**Best for**: Individual development, local testing, direct plugin connections
```
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Local Development Mode ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā āāāāāāāāāāāāāāā stdio āāāāāāāāāāāāāāā WebSocket ā
ā ā Cursor AI āāāāāāāāāāāāāāāŗā MCP Server āāāāāāāāāāāāā ā
ā ā ā ā (Local) ā ā ā
ā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā ā ā
ā ā ā ā
ā ā localhost:8080 ā ā
ā ā¼ ā ā
ā āāāāāāāāāāāāāāā ā ā
ā ā WebSocket āāāāāāāāāāāāā ā
ā ā Server ā ā
ā ā (Stateless) ā ā
ā āāāāāāāāāāāāāāā ā
ā ā ā
ā ā passthrough ā
ā ā¼ ā
ā āāāāāāāāāāāāāāā ā
ā ā SpeX Plugin ā ā
ā ā (Figma) ā ā
ā āāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
```
- **`index.js`** - Main server entry point with MCP and WebSocket server setup
- **`figma-functions.js`** - WebSocket server and Figma plugin communication manager
- **`mcp-tools.js`** - MCP tools handler for Cursor AI integration
```json
"spex-npm-local": {
"command": "npx",
"args": [
"-y",
"spex-mcp",
"--mode",
"local",
"--port",
"8080",
"--force"
]
}
```
Note:
- port: specify custom port of websocket server that plugin connect to
- force: force using port
```
`Cursor AI ā MCP Server ā Local WebSocket Server ā SpeX Plugin`
1. **`hello-world`** - Returns a simple hello world message
2. **`get-specs-readme`** - Fetches README.md from SpeX plugin
3. **`get-spec-files-manifest`** - Fetches manifest.yaml file
4. **`get-a-spec-file`** - Fetches specific spec file by filename
5. **`get-page-thumbnail`** - Fetches page thumbnail image
6. **`generate-compose-ui`** - šÆ **Prompt Template Tool** - Generates a structured 6-step workflow prompt for creating Jetpack Compose UI code from Figma design specs. Takes a `source_code_file` parameter and provides step-by-step guidance for the design-to-code process. See [Generate Compose UI Tool Documentation](docs/GENERATE_COMPOSE_UI_TOOL.md) for details.
- **Direct Plugin Connection**: WebSocket server runs locally on port 8080 (default)
- **MCP Protocol**: Full support for Cursor AI integration via stdio transport
- **File Upload Support**: Binary file transfer handling with progress tracking
- **Image Support**: Base64 image injection for Cursor AI
- **Port Management**: Automatic port conflict resolution with `--force` option
- **Graceful Shutdown**: Proper cleanup of connections and resources
This implementation was restored from commit `d1536d965cb4b02262b8a659611375dfb4a4acc7` which represents the stable **version 1.5.0** of the SpeX MCP server. The code has been placed in the `@/local` folder as requested.
The local mode provides the most direct and reliable connection between Cursor AI and the Figma SpeX plugin, making it ideal for development and testing scenarios.