Skip to content

loveholidays/mcp-html-share

Repository files navigation

MCP HTML Share

A Go-based MCP (Model Context Protocol) server that shares HTML content via Google Cloud Storage. Upload HTML and get back a public URL.

Usage Example

An LLM can use this tool to create and share web content:

User: "Create a data visualization showing monthly sales trends and share the URL"

Assistant: "I'll create an interactive chart and upload it for you"

{
  "tool": "share-html",
  "arguments": {
    "html_content": "<html>... chart content ...</html>",
    "short_name": "sales-trends-2024"
  }
}

Result: https://storage.cloud.google.com/your-bucket/sales-trends-2024-a1b2c3d4.html

Quick Start

Using Docker

docker run -p 8080:8080 -p 9090:9090 \
  -e GOOGLE_APPLICATION_CREDENTIALS=/creds/credentials.json \
  -v /path/to/credentials.json:/creds/credentials.json \
  ghcr.io/loveholidays/mcp-html-share:latest \
  --bucket=your-bucket-name

Using Pre-built Binary

Download from releases or install via Homebrew:

brew tap loveholidays/tap
brew install mcp-html-share

Run the server:

mcp-html-share --bucket=your-bucket-name --transport=http

Configuration

Required Setup

  1. Create a GCS bucket:

    gcloud storage buckets create gs://your-bucket-name --location=US
  2. For public URLs (default):

    gcloud storage buckets add-iam-policy-binding gs://your-bucket-name \
      --member=allUsers \
      --role=roles/storage.objectViewer
  3. Set up authentication (choose one):

    • Service Account: export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
    • Application Default: gcloud auth application-default login

Command Line Flags

  • --bucket (required): GCS bucket name
  • --transport: http (default in Docker) or stdio (for Claude Desktop)
  • --http-port: HTTP port (default: "8080")
  • --health-port: Health/metrics port (default: "9090")
  • --public-url: Return public URLs (default: true) or signed URLs (false)

MCP Tools

share-html

Upload HTML content and get a public URL.

Request:

{
  "tool": "share-html",
  "arguments": {
    "html_content": "<html><body><h1>Hello World</h1></body></html>",
    "short_name": "hello-world"
  }
}

Response:

{
  "url": "https://storage.cloud.google.com/your-bucket/hello-world-12345678.html"
}

Using with Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "html-share": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://your-mcp-html-share-server.example.com"
      ]
    }
  }
}

For local development with stdio:

{
  "mcpServers": {
    "html-share": {
      "command": "mcp-html-share",
      "args": ["--bucket", "your-bucket-name", "--transport", "stdio"]
    }
  }
}

Endpoints

  • MCP Server: http://localhost:8080 (when using --transport=http)
  • Health: GET http://localhost:9090/livez
  • Metrics: GET http://localhost:9090/metrics (Prometheus format)

Development

# Clone and build
git clone https://github.com/loveholidays/mcp-html-share
cd mcp-html-share
make build

# Run tests
make test

# Run locally
make run-http BUCKET=your-bucket-name

License

LGPL-3.0 - see LICENSE file.

About

MCP server to share html via GCS

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors