Compare commits
3 Commits
v0.1.2
...
smithery/c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5c01ad83a | ||
|
|
190915214d | ||
|
|
905339fb67 |
27
Dockerfile
27
Dockerfile
@@ -1,9 +1,12 @@
|
||||
# Use Bun as the base image with specific platform for better optimization
|
||||
FROM --platform=linux/amd64 oven/bun:1.2.2-slim as builder
|
||||
# Use Node.js as base for building
|
||||
FROM node:20-slim as builder
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install bun
|
||||
RUN npm install -g bun@1.0.25
|
||||
|
||||
# Install only the minimal dependencies needed and clean up in the same layer
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
@@ -14,30 +17,28 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
# Set build-time environment variables
|
||||
ENV NODE_ENV=production \
|
||||
NODE_OPTIONS="--max-old-space-size=2048" \
|
||||
BUN_INSTALL_CACHE=false \
|
||||
BUN_INSTALL_VERBOSE=true
|
||||
NODE_OPTIONS="--max-old-space-size=2048"
|
||||
|
||||
# Copy only package files first
|
||||
COPY package.json ./
|
||||
COPY tsconfig*.json ./
|
||||
|
||||
# Install ALL dependencies (including devDependencies) for build
|
||||
RUN bun install --no-cache \
|
||||
--no-progress \
|
||||
&& rm -rf ~/.bun/install/cache
|
||||
# Install dependencies without lockfile
|
||||
RUN bun install --no-cache
|
||||
|
||||
# Copy source files and build
|
||||
COPY src ./src
|
||||
COPY tsconfig*.json ./
|
||||
RUN bun build ./src/index.ts --target=bun --minify --outdir=./dist
|
||||
|
||||
# Create a smaller production image
|
||||
FROM --platform=linux/amd64 oven/bun:1.2.2-slim as runner
|
||||
FROM node:20-slim as runner
|
||||
|
||||
# Install bun in production image
|
||||
RUN npm install -g bun@1.0.25
|
||||
|
||||
# Set production environment variables
|
||||
ENV NODE_ENV=production \
|
||||
NODE_OPTIONS="--max-old-space-size=1024" \
|
||||
BUN_INSTALL_CACHE=false
|
||||
NODE_OPTIONS="--max-old-space-size=1024"
|
||||
|
||||
# Create a non-root user
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
|
||||
10
README.md
10
README.md
@@ -122,6 +122,14 @@ For further technical details, check out our [Documentation Index](docs/index.md
|
||||
|
||||
## Installation 🛠
|
||||
|
||||
### Installing via Smithery
|
||||
|
||||
To install Home Assistant MCP Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@jango-blockchained/advanced-homeassistant-mcp):
|
||||
|
||||
```bash
|
||||
npx -y @smithery/cli install @jango-blockchained/advanced-homeassistant-mcp --client claude
|
||||
```
|
||||
|
||||
### 🐳 Docker Setup (Recommended)
|
||||
|
||||
For a hassle-free, containerized deployment:
|
||||
@@ -285,4 +293,4 @@ This project is licensed under the MIT License. See [LICENSE](LICENSE) for full
|
||||
|
||||
---
|
||||
|
||||
🔋 Batteries included.
|
||||
🔋 Batteries included.
|
||||
|
||||
@@ -28,9 +28,12 @@ CPU_QUOTA=$(( CPU_COUNT * 50000 )) # Allow 50% CPU usage per core
|
||||
|
||||
echo "Building with ${BUILD_MEM}MB memory limit and CPU quota ${CPU_QUOTA}"
|
||||
|
||||
# Remove any existing lockfile
|
||||
rm -f bun.lockb
|
||||
|
||||
# Build with resource limits, optimizations, and timeout
|
||||
echo "Building Docker image..."
|
||||
timeout 15m docker build \
|
||||
DOCKER_BUILDKIT=1 docker build \
|
||||
--memory="${BUILD_MEM}m" \
|
||||
--memory-swap="${BUILD_MEM}m" \
|
||||
--cpu-quota="${CPU_QUOTA}" \
|
||||
|
||||
21
smithery.yaml
Normal file
21
smithery.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# 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:
|
||||
- hassToken
|
||||
properties:
|
||||
hassToken:
|
||||
type: string
|
||||
description: The token for connecting to Home Assistant API.
|
||||
port:
|
||||
type: number
|
||||
default: 4000
|
||||
description: The port on which the MCP server will run.
|
||||
commandFunction:
|
||||
# A function that produces the CLI command to start the MCP on stdio.
|
||||
|-
|
||||
config => ({command: 'bun', args: ['--smol', 'run', 'start'], env: { HASS_TOKEN: config.hassToken, PORT: config.port.toString() }})
|
||||
Reference in New Issue
Block a user