|
| 1 | +# Comprehensive Deployment Options |
| 2 | + |
| 3 | +LMStudio-MCP supports multiple deployment methods to suit different environments and preferences. This document outlines all available deployment options. |
| 4 | + |
| 5 | +## Quick Reference |
| 6 | + |
| 7 | +| Method | Best For | Complexity | Requirements | |
| 8 | +|--------|----------|------------|--------------| |
| 9 | +| **Direct Python** | Development, Testing | Low | Python 3.7+ | |
| 10 | +| **UVX (Recommended)** | Most Users | Low | Python/Node.js | |
| 11 | +| **Pip Install** | Python Developers | Low | Python 3.7+ | |
| 12 | +| **Docker** | Containers, Production | Medium | Docker | |
| 13 | +| **Docker Compose** | Local Development | Medium | Docker + Compose | |
| 14 | +| **Kubernetes** | Enterprise, Scale | High | K8s Cluster | |
| 15 | + |
| 16 | +## Method 1: UVX (Recommended) |
| 17 | + |
| 18 | +UVX is the simplest way to get started: |
| 19 | + |
| 20 | +```bash |
| 21 | +# Install and run directly from GitHub |
| 22 | +uvx https://github.com/infinitimeless/LMStudio-MCP |
| 23 | + |
| 24 | +# Claude MCP Configuration |
| 25 | +{ |
| 26 | + "lmstudio-mcp": { |
| 27 | + "command": "uvx", |
| 28 | + "args": ["https://github.com/infinitimeless/LMStudio-MCP"] |
| 29 | + } |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +## Method 2: Direct Python Installation |
| 34 | + |
| 35 | +For development or when you want to modify the code: |
| 36 | + |
| 37 | +```bash |
| 38 | +# Clone and setup |
| 39 | +git clone https://github.com/infinitimeless/LMStudio-MCP.git |
| 40 | +cd LMStudio-MCP |
| 41 | +pip install -r requirements.txt |
| 42 | + |
| 43 | +# Run |
| 44 | +python lmstudio_bridge.py |
| 45 | + |
| 46 | +# Claude MCP Configuration |
| 47 | +{ |
| 48 | + "lmstudio-mcp": { |
| 49 | + "command": "/bin/bash", |
| 50 | + "args": ["-c", "cd /path/to/LMStudio-MCP && python lmstudio_bridge.py"] |
| 51 | + } |
| 52 | +} |
| 53 | +``` |
| 54 | + |
| 55 | +## Method 3: Pip Installation |
| 56 | + |
| 57 | +Install as a Python package: |
| 58 | + |
| 59 | +```bash |
| 60 | +# Install from GitHub |
| 61 | +pip install git+https://github.com/infinitimeless/LMStudio-MCP.git |
| 62 | + |
| 63 | +# Or install locally |
| 64 | +pip install . |
| 65 | + |
| 66 | +# Run |
| 67 | +lmstudio-mcp |
| 68 | + |
| 69 | +# Claude MCP Configuration |
| 70 | +{ |
| 71 | + "lmstudio-mcp": { |
| 72 | + "command": "lmstudio-mcp", |
| 73 | + "args": [] |
| 74 | + } |
| 75 | +} |
| 76 | +``` |
| 77 | + |
| 78 | +## Method 4: Docker |
| 79 | + |
| 80 | +See [DOCKER.md](DOCKER.md) for comprehensive Docker deployment guide. |
| 81 | + |
| 82 | +### Quick Docker Start |
| 83 | + |
| 84 | +```bash |
| 85 | +# Build and run |
| 86 | +docker build -t lmstudio-mcp . |
| 87 | +docker run -it --network host lmstudio-mcp |
| 88 | + |
| 89 | +# Or use pre-built image |
| 90 | +docker run -it --network host ghcr.io/infinitimeless/lmstudio-mcp:latest |
| 91 | + |
| 92 | +# Claude MCP Configuration |
| 93 | +{ |
| 94 | + "lmstudio-mcp-docker": { |
| 95 | + "command": "docker", |
| 96 | + "args": ["run", "-i", "--rm", "--network=host", "lmstudio-mcp"] |
| 97 | + } |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +## Method 5: Docker Compose |
| 102 | + |
| 103 | +```bash |
| 104 | +# Start with compose |
| 105 | +docker-compose up -d |
| 106 | + |
| 107 | +# View logs |
| 108 | +docker-compose logs -f lmstudio-mcp |
| 109 | + |
| 110 | +# Claude MCP Configuration |
| 111 | +{ |
| 112 | + "lmstudio-mcp-compose": { |
| 113 | + "command": "docker-compose", |
| 114 | + "args": ["run", "--rm", "lmstudio-mcp"] |
| 115 | + } |
| 116 | +} |
| 117 | +``` |
| 118 | + |
| 119 | +## Method 6: Kubernetes |
| 120 | + |
| 121 | +For enterprise or scaled deployments: |
| 122 | + |
| 123 | +```bash |
| 124 | +# Apply manifests |
| 125 | +kubectl apply -f k8s/ |
| 126 | + |
| 127 | +# Check status |
| 128 | +kubectl get pods -l app=lmstudio-mcp |
| 129 | +``` |
| 130 | + |
| 131 | +## Method 7: Automated Installation Script |
| 132 | + |
| 133 | +Use the provided installation script: |
| 134 | + |
| 135 | +```bash |
| 136 | +# Download and run installer |
| 137 | +curl -fsSL https://raw.githubusercontent.com/infinitimeless/LMStudio-MCP/main/install.sh | bash |
| 138 | + |
| 139 | +# Or download first |
| 140 | +wget https://raw.githubusercontent.com/infinitimeless/LMStudio-MCP/main/install.sh |
| 141 | +chmod +x install.sh |
| 142 | +./install.sh |
| 143 | +``` |
| 144 | + |
| 145 | +The installer will: |
| 146 | +- Detect your environment |
| 147 | +- Install dependencies |
| 148 | +- Set up the bridge |
| 149 | +- Generate MCP configuration |
| 150 | +- Provide next steps |
| 151 | + |
| 152 | +## Environment Variables |
| 153 | + |
| 154 | +All deployment methods support these environment variables: |
| 155 | + |
| 156 | +| Variable | Default | Description | |
| 157 | +|----------|---------|-------------| |
| 158 | +| `LMSTUDIO_API_BASE` | `http://localhost:1234/v1` | LM Studio API endpoint | |
| 159 | +| `LOG_LEVEL` | `INFO` | Logging level (DEBUG, INFO, WARNING, ERROR) | |
| 160 | +| `TIMEOUT` | `30` | Request timeout in seconds | |
| 161 | + |
| 162 | +Example: |
| 163 | +```bash |
| 164 | +LMSTUDIO_API_BASE=http://127.0.0.1:1234/v1 python lmstudio_bridge.py |
| 165 | +``` |
| 166 | + |
| 167 | +## Troubleshooting |
| 168 | + |
| 169 | +### Common Issues |
| 170 | + |
| 171 | +1. **Connection refused**: Ensure LM Studio is running with a model loaded |
| 172 | +2. **404 errors**: Try using `127.0.0.1` instead of `localhost` |
| 173 | +3. **Permission denied**: Check file permissions and Docker access |
| 174 | +4. **Module not found**: Ensure all dependencies are installed |
| 175 | + |
| 176 | +### Platform-Specific Notes |
| 177 | + |
| 178 | +#### macOS |
| 179 | +- Use `localhost` or `127.0.0.1` for LM Studio URL |
| 180 | +- Docker Desktop may require host networking configuration |
| 181 | + |
| 182 | +#### Windows |
| 183 | +- Use Docker Desktop with WSL2 backend |
| 184 | +- Path separators in configuration should use forward slashes |
| 185 | + |
| 186 | +#### Linux |
| 187 | +- Docker may require `sudo` or adding user to docker group |
| 188 | +- Ensure LM Studio is accessible on the network interface |
| 189 | + |
| 190 | +## Performance Optimization |
| 191 | + |
| 192 | +### Resource Requirements |
| 193 | + |
| 194 | +| Deployment | RAM | CPU | Disk | |
| 195 | +|------------|-----|-----|------| |
| 196 | +| Python Direct | ~50MB | Low | Minimal | |
| 197 | +| Docker | ~100MB | Low | ~200MB | |
| 198 | +| Kubernetes | ~150MB | Low | ~300MB | |
| 199 | + |
| 200 | +### Optimization Tips |
| 201 | + |
| 202 | +1. **Use lightweight base images** (already implemented in Dockerfile) |
| 203 | +2. **Enable Docker BuildKit** for faster builds |
| 204 | +3. **Use multi-stage builds** for smaller images |
| 205 | +4. **Configure resource limits** in production |
| 206 | +5. **Use persistent volumes** for logs in container environments |
| 207 | + |
| 208 | +## Security Considerations |
| 209 | + |
| 210 | +### Network Security |
| 211 | +- Bridge requires access to LM Studio on localhost:1234 |
| 212 | +- Consider firewall rules for container deployments |
| 213 | +- Use network policies in Kubernetes |
| 214 | + |
| 215 | +### Container Security |
| 216 | +- Runs as non-root user by default |
| 217 | +- Minimal attack surface with slim base image |
| 218 | +- No sensitive data stored in container |
| 219 | + |
| 220 | +### Authentication |
| 221 | +- No authentication required between bridge and LM Studio |
| 222 | +- Claude MCP connection is handled by Claude's MCP framework |
| 223 | + |
| 224 | +## Next Steps |
| 225 | + |
| 226 | +1. Choose your preferred deployment method |
| 227 | +2. Ensure LM Studio is running with a model loaded |
| 228 | +3. Configure Claude MCP settings |
| 229 | +4. Test the connection with a simple prompt |
| 230 | +5. Explore advanced features and customization |
| 231 | + |
| 232 | +For detailed troubleshooting, see [TROUBLESHOOTING.md](TROUBLESHOOTING.md). |
| 233 | +For Docker-specific guidance, see [DOCKER.md](DOCKER.md). |
| 234 | +For contributing, see [CONTRIBUTING.md](CONTRIBUTING.md). |
0 commit comments