Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Ignore files and directories not needed in the image
node_modules
npm-debug.log
yarn-debug.log
yarn-error.log
.git
.github
.vscode
coverage
dist
tests
docs
*.md
!README.md
.env
.env.example
*.log
.DS_Store
Dockerfile
.dockerignore
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Build stage
FROM node:20.17.0-slim AS builder

# Set working directory
WORKDIR /app

# Install pnpm globally
RUN npm install -g pnpm

# Copy package files first
COPY package.json pnpm-lock.yaml* ./

# Install all dependencies
RUN pnpm install --ignore-scripts

# Copy the rest of the project files
COPY . .

# Use the existing script prepare that already includes build and chmod
RUN pnpm run prepare

# Production stage - much lighter image
FROM node:20.17.0-alpine AS production

# Set working directory
WORKDIR /app

# Install pnpm in production image (only what's needed)
RUN npm install -g pnpm

# Copy only package.json and pnpm-lock.yaml for installing production dependencies
COPY package.json pnpm-lock.yaml* ./

# Install only production dependencies
RUN pnpm install --prod --ignore-scripts

# Copy compiled code from build stage
COPY --from=builder /app/dist /app/dist

# Expose port defined in environment variables (default 3333)
EXPOSE 3333

# Command to start the application
CMD ["pnpm", "start:http"]
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,48 @@ This MCP server is specifically designed for use with Cursor. Before responding

Reducing the amount of context provided to the model helps make the AI more accurate and the responses more relevant.

## Docker Setup

### Using Docker Compose

The easiest way to run this server with Docker is using Docker Compose:

```bash
# Copy the example .env file and add your Figma API key
cp .env.example .env
# Edit the .env file with your Figma API key
nano .env # or use your preferred text editor

# Start the server with Docker Compose
docker-compose up -d
```

The server will be available at http://localhost:3333.

### Using Docker Directly

You can also build and run the Docker container manually:

```bash
# Build the Docker image
docker build -t figma-developer-mcp .

# Run the container
docker run -p 3333:3333 \
-e FIGMA_API_KEY=your_figma_api_key_here \
-e NODE_ENV=production \
--name figma-developer-mcp \
figma-developer-mcp
```

### Configuration Options

The Docker container respects the same environment variables as the regular installation:

- `FIGMA_API_KEY`: Your Figma API key (required)
- `PORT`: The port to run the server on (default: 3333)
- `NODE_ENV`: Environment mode (default: production)

## Installation

### Running the server quickly with NPM
Expand Down
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
figma-developer-mcp:
build:
context: .
dockerfile: Dockerfile
container_name: figma-developer-mcp
restart: unless-stopped
ports:
- "3333:3333"
environment:
- NODE_ENV=production
- PORT=3333
# We don't include FIGMA_API_KEY here for security reasons, it should be provided when starting the container
volumes:
# Mount the .env file from the root project directory
- ./.env:/app/.env:ro
# Alternative commands for different execution modes
# command: ["pnpm", "start:cli"] # For CLI mode
# command: ["pnpm", "start:http"] # For HTTP mode (default)