From 23c08d944bbb3cb32ad40953dc566c54066504d8 Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:03:08 +0800 Subject: [PATCH 1/3] Add Dockerfile --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6810347 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file From ecc258a23682cd6c995c3826793f3dde586f99ce Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:03:09 +0800 Subject: [PATCH 2/3] Add Smithery configuration --- smithery.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 smithery.yaml diff --git a/smithery.yaml b/smithery.yaml new file mode 100644 index 0000000..6cebcd6 --- /dev/null +++ b/smithery.yaml @@ -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 || [])] }; } \ No newline at end of file From 6caee09f73347e620dc275d4f19325d02c8f2c71 Mon Sep 17 00:00:00 2001 From: Henry Mao <1828968+calclavia@users.noreply.github.com> Date: Wed, 29 Jan 2025 02:03:10 +0800 Subject: [PATCH 3/3] Update README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 3995a89..98a252a 100644 --- a/README.md +++ b/README.md @@ -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! @@ -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: