Skip to content

Deployment: Dockerfile and Smithery config #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
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
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use an official Node runtime as a parent image
FROM node:18-alpine AS builder

# Set the working directory in the container
WORKDIR /app

# Copy the package.json and package-lock.json files to the container
COPY package*.json ./

# Install any needed packages
RUN npm install

# Copy the current directory contents into the container at /app
COPY . .

# Build the app
RUN npm run build

# Use a lighter weight image for production
FROM node:18-alpine AS runner

# Set the working directory in the container
WORKDIR /app

# Copy the build artifacts and node_modules from the builder stage
COPY --from=builder /app/build /app/build
COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/package.json /app/package.json

# Set environment variables for MCP server
# ENV MCP_HF_WORK_DIR=/your_directory
# ENV HF_TOKEN=hf_your_token

# Make port 3000 available to the world outside this container
EXPOSE 3000

# Run the application
ENTRYPOINT ["node", "build/index.js"]

# Command to run the MCP server with default HuggingFace spaces
# CMD ["--work-dir=/your_directory", "evalstate/FLUX.1-schnell"]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# mcp-hfspace MCP Server 🤗

[![smithery badge](https://smithery.ai/badge/@llmindset/mcp-hfspace)](https://smithery.ai/server/@llmindset/mcp-hfspace)

Read the introduction here [llmindset.co.uk/resources/mcp-hfspace/](https://llmindset.co.uk/resources/mcp-hfspace/)

Connect to [Hugging Face Spaces](https://huggingface.co/spaces) with minimal setup needed - simply add your spaces and go!
Expand All @@ -10,6 +12,14 @@ By default, it connects to `evalstate/FLUX.1-schnell` providing Image Generation

## Installation

### Installing via Smithery

To install mcp-hfspace CLI for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@llmindset/mcp-hfspace):

```bash
npx -y @smithery/cli install @llmindset/mcp-hfspace --client claude
```

NPM Package is `@llmindset/mcp-hfspsace`.

Install a recent version of [NodeJS](https://nodejs.org/en/download) for your platform, then add the following to the `mcpServers` section of your `claude_desktop_config.json` file:
Expand Down
24 changes: 24 additions & 0 deletions smithery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Smithery configuration file: https://smithery.ai/docs/config#smitheryyaml

startCommand:
type: stdio
configSchema:
# JSON Schema defining the configuration options for the MCP.
type: object
required: []
properties:
workingDirectory:
type: string
description: The working directory for handling file uploads/downloads.
huggingFaceToken:
type: string
description: The token for accessing private Hugging Face spaces.
spaces:
type: array
items:
type: string
description: List of Hugging Face spaces to connect to.
commandFunction:
# A function that produces the CLI command to start the MCP on stdio.
|-
(config) => { return { command: 'node', args: ['build/index.js', ...(config.workingDirectory ? ['--work-dir=' + config.workingDirectory] : []), ...(config.huggingFaceToken ? ['--hf-token=' + config.huggingFaceToken] : []), ...(config.spaces || [])] }; }