@goonnguyen/human-mcp 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +81 -0
- package/CHANGELOG.md +14 -0
- package/CLAUDE.md +1 -1
- package/DEPLOYMENT.md +329 -0
- package/Dockerfile +36 -12
- package/README.md +388 -14
- package/bun.lock +49 -4
- package/dist/index.js +27887 -1473
- package/docker-compose.yaml +128 -0
- package/package.json +11 -4
- package/plans/001-streamable-http-transport-plan.md +905 -0
- package/src/index.ts +44 -2
- package/src/transports/http/middleware.ts +46 -0
- package/src/transports/http/routes.ts +136 -0
- package/src/transports/http/server.ts +66 -0
- package/src/transports/http/session.ts +85 -0
- package/src/transports/index.ts +31 -0
- package/src/transports/stdio.ts +7 -0
- package/src/transports/types.ts +37 -0
- package/src/utils/config.ts +46 -0
package/.dockerignore
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Node modules
|
|
2
|
+
node_modules
|
|
3
|
+
npm-debug.log*
|
|
4
|
+
yarn-debug.log*
|
|
5
|
+
yarn-error.log*
|
|
6
|
+
|
|
7
|
+
# Build output
|
|
8
|
+
dist
|
|
9
|
+
|
|
10
|
+
# Environment files
|
|
11
|
+
.env
|
|
12
|
+
.env.*
|
|
13
|
+
!.env.production
|
|
14
|
+
|
|
15
|
+
# Git files
|
|
16
|
+
.git
|
|
17
|
+
.gitignore
|
|
18
|
+
|
|
19
|
+
# IDE files
|
|
20
|
+
.vscode
|
|
21
|
+
.idea
|
|
22
|
+
*.swp
|
|
23
|
+
*.swo
|
|
24
|
+
*~
|
|
25
|
+
|
|
26
|
+
# OS files
|
|
27
|
+
.DS_Store
|
|
28
|
+
Thumbs.db
|
|
29
|
+
|
|
30
|
+
# Logs
|
|
31
|
+
logs
|
|
32
|
+
*.log
|
|
33
|
+
|
|
34
|
+
# Runtime data
|
|
35
|
+
pids
|
|
36
|
+
*.pid
|
|
37
|
+
*.seed
|
|
38
|
+
*.pid.lock
|
|
39
|
+
|
|
40
|
+
# Dependency directories
|
|
41
|
+
jspm_packages/
|
|
42
|
+
|
|
43
|
+
# Optional npm cache directory
|
|
44
|
+
.npm
|
|
45
|
+
|
|
46
|
+
# Optional REPL history
|
|
47
|
+
.node_repl_history
|
|
48
|
+
|
|
49
|
+
# Output of 'npm pack'
|
|
50
|
+
*.tgz
|
|
51
|
+
|
|
52
|
+
# Yarn Integrity file
|
|
53
|
+
.yarn-integrity
|
|
54
|
+
|
|
55
|
+
# Coverage directory used by tools like istanbul
|
|
56
|
+
coverage/
|
|
57
|
+
.nyc_output
|
|
58
|
+
|
|
59
|
+
# Backup files
|
|
60
|
+
*.backup
|
|
61
|
+
*.bak
|
|
62
|
+
|
|
63
|
+
# Test files
|
|
64
|
+
test/
|
|
65
|
+
tests/
|
|
66
|
+
__tests__/
|
|
67
|
+
*.test.*
|
|
68
|
+
*.spec.*
|
|
69
|
+
|
|
70
|
+
# Documentation (except deployment guide)
|
|
71
|
+
README.md
|
|
72
|
+
!DEPLOYMENT.md
|
|
73
|
+
|
|
74
|
+
# Development files
|
|
75
|
+
docker-compose.override.yml
|
|
76
|
+
.serena/
|
|
77
|
+
.claude/
|
|
78
|
+
|
|
79
|
+
# Data directories
|
|
80
|
+
data/
|
|
81
|
+
letsencrypt/
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [1.2.0](https://github.com/mrgoonie/human-mcp/compare/v1.1.0...v1.2.0) (2025-09-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* make HTTP transport config options configurable via config object ([d9da0f1](https://github.com/mrgoonie/human-mcp/commit/d9da0f1ec01b53dd21ace64e781d6bec269bd763))
|
|
7
|
+
|
|
8
|
+
# [1.1.0](https://github.com/mrgoonie/human-mcp/compare/v1.0.2...v1.1.0) (2025-09-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add HTTP transport with Docker deployment ([971af50](https://github.com/mrgoonie/human-mcp/commit/971af50cae5ccb50b83a70c29099e4c801b8fcad))
|
|
14
|
+
|
|
1
15
|
## [1.0.2](https://github.com/mrgoonie/human-mcp/compare/v1.0.1...v1.0.2) (2025-09-08)
|
|
2
16
|
|
|
3
17
|
|
package/CLAUDE.md
CHANGED
|
@@ -120,7 +120,7 @@ This launches a web interface for testing tool functionality interactively.
|
|
|
120
120
|
- Use `senera` mcp tools for semantic retrieval and editing capabilities
|
|
121
121
|
|
|
122
122
|
### Code Quality Guidelines
|
|
123
|
-
- Read and follow codebase structure and code standards in `./docs`
|
|
123
|
+
- Read and follow strictly codebase structure and code standards in `./docs`
|
|
124
124
|
- Don't be too harsh on code linting, but make sure there are no syntax errors and code are compilable
|
|
125
125
|
- Prioritize functionality and readability over strict style enforcement and code formatting
|
|
126
126
|
- Use reasonable code quality standards that enhance developer productivity
|
package/DEPLOYMENT.md
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# Human MCP Server - VPS Deployment Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to deploy the Human MCP Server on a VPS using Docker and Docker Compose.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- VPS with Docker and Docker Compose installed
|
|
8
|
+
- Domain name (optional, for SSL/HTTPS)
|
|
9
|
+
- Google Gemini API key
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### 1. Clone the Repository
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone <your-repo-url>
|
|
17
|
+
cd human-mcp
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. Configure Environment
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Copy the production environment template
|
|
24
|
+
cp .env.production .env
|
|
25
|
+
|
|
26
|
+
# Edit the configuration
|
|
27
|
+
nano .env
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Required Configuration:**
|
|
31
|
+
- Set your `GOOGLE_GEMINI_API_KEY`
|
|
32
|
+
- Update `DOMAIN` if using Traefik with SSL
|
|
33
|
+
- Set `ACME_EMAIL` for Let's Encrypt certificates
|
|
34
|
+
|
|
35
|
+
### 3. Deploy with Docker Compose
|
|
36
|
+
|
|
37
|
+
#### Basic Deployment (HTTP only)
|
|
38
|
+
```bash
|
|
39
|
+
docker-compose up -d human-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### Production Deployment (with HTTPS and Traefik)
|
|
43
|
+
```bash
|
|
44
|
+
# Create necessary directories
|
|
45
|
+
mkdir -p data letsencrypt
|
|
46
|
+
|
|
47
|
+
# Deploy with Traefik reverse proxy
|
|
48
|
+
docker-compose --profile proxy up -d
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
#### With Redis (for session scaling)
|
|
52
|
+
```bash
|
|
53
|
+
docker-compose --profile redis --profile proxy up -d
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Deployment Options
|
|
57
|
+
|
|
58
|
+
### Option 1: Basic HTTP Deployment
|
|
59
|
+
|
|
60
|
+
Suitable for development or internal networks.
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Just the MCP server
|
|
64
|
+
docker-compose up -d human-mcp
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Access: `http://your-server-ip:3000`
|
|
68
|
+
|
|
69
|
+
### Option 2: Production HTTPS Deployment
|
|
70
|
+
|
|
71
|
+
Includes Traefik reverse proxy with automatic SSL certificates.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Full production stack
|
|
75
|
+
docker-compose --profile proxy up -d
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Access: `https://your-domain.com`
|
|
79
|
+
|
|
80
|
+
### Option 3: Scalable Deployment
|
|
81
|
+
|
|
82
|
+
Adds Redis for session storage (enables horizontal scaling).
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Production with Redis
|
|
86
|
+
docker-compose --profile redis --profile proxy up -d
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Configuration Guide
|
|
90
|
+
|
|
91
|
+
### Environment Variables
|
|
92
|
+
|
|
93
|
+
Key environment variables in `.env`:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# Core
|
|
97
|
+
GOOGLE_GEMINI_API_KEY=your_api_key_here
|
|
98
|
+
DOMAIN=your-domain.com
|
|
99
|
+
ACME_EMAIL=admin@your-domain.com
|
|
100
|
+
|
|
101
|
+
# Security
|
|
102
|
+
HTTP_CORS_ORIGINS=https://your-domain.com
|
|
103
|
+
HTTP_ALLOWED_HOSTS=127.0.0.1,localhost,your-domain.com
|
|
104
|
+
HTTP_SECRET=your_secret_token_here
|
|
105
|
+
|
|
106
|
+
# Performance
|
|
107
|
+
HTTP_ENABLE_RATE_LIMITING=true
|
|
108
|
+
RATE_LIMIT_REQUESTS=100
|
|
109
|
+
LOG_LEVEL=warn
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Security Recommendations
|
|
113
|
+
|
|
114
|
+
1. **Set Authentication Secret**
|
|
115
|
+
```bash
|
|
116
|
+
HTTP_SECRET=your_strong_secret_here
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
2. **Limit CORS Origins**
|
|
120
|
+
```bash
|
|
121
|
+
HTTP_CORS_ORIGINS=https://your-domain.com,https://app.your-domain.com
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
3. **Configure Allowed Hosts**
|
|
125
|
+
```bash
|
|
126
|
+
HTTP_ALLOWED_HOSTS=127.0.0.1,localhost,your-domain.com
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
4. **Enable Rate Limiting**
|
|
130
|
+
```bash
|
|
131
|
+
HTTP_ENABLE_RATE_LIMITING=true
|
|
132
|
+
RATE_LIMIT_REQUESTS=100
|
|
133
|
+
RATE_LIMIT_WINDOW=60000
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Server Management
|
|
137
|
+
|
|
138
|
+
### Start Services
|
|
139
|
+
```bash
|
|
140
|
+
docker-compose up -d
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Stop Services
|
|
144
|
+
```bash
|
|
145
|
+
docker-compose down
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### View Logs
|
|
149
|
+
```bash
|
|
150
|
+
# All services
|
|
151
|
+
docker-compose logs -f
|
|
152
|
+
|
|
153
|
+
# Specific service
|
|
154
|
+
docker-compose logs -f human-mcp
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Update Deployment
|
|
158
|
+
```bash
|
|
159
|
+
# Rebuild and restart
|
|
160
|
+
docker-compose down
|
|
161
|
+
docker-compose build --no-cache
|
|
162
|
+
docker-compose up -d
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Health Check
|
|
166
|
+
```bash
|
|
167
|
+
# Check service health
|
|
168
|
+
curl http://localhost:3000/health
|
|
169
|
+
|
|
170
|
+
# Or with domain
|
|
171
|
+
curl https://your-domain.com/health
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## API Usage
|
|
175
|
+
|
|
176
|
+
### Initialize Session
|
|
177
|
+
```bash
|
|
178
|
+
curl -X POST https://your-domain.com/mcp \
|
|
179
|
+
-H "Content-Type: application/json" \
|
|
180
|
+
-H "Accept: application/json, text/event-stream" \
|
|
181
|
+
-d '{
|
|
182
|
+
"jsonrpc": "2.0",
|
|
183
|
+
"method": "initialize",
|
|
184
|
+
"params": {
|
|
185
|
+
"protocolVersion": "2025-03-26",
|
|
186
|
+
"capabilities": {},
|
|
187
|
+
"clientInfo": {
|
|
188
|
+
"name": "your-client",
|
|
189
|
+
"version": "1.0.0"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"id": 1
|
|
193
|
+
}'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### List Available Tools
|
|
197
|
+
```bash
|
|
198
|
+
curl -X POST https://your-domain.com/mcp \
|
|
199
|
+
-H "Content-Type: application/json" \
|
|
200
|
+
-H "Mcp-Session-Id: YOUR_SESSION_ID" \
|
|
201
|
+
-d '{
|
|
202
|
+
"jsonrpc": "2.0",
|
|
203
|
+
"method": "tools/list",
|
|
204
|
+
"params": {},
|
|
205
|
+
"id": 2
|
|
206
|
+
}'
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Monitoring
|
|
210
|
+
|
|
211
|
+
### Resource Usage
|
|
212
|
+
```bash
|
|
213
|
+
# Check container stats
|
|
214
|
+
docker stats human-mcp-server
|
|
215
|
+
|
|
216
|
+
# Check logs for errors
|
|
217
|
+
docker-compose logs human-mcp | grep ERROR
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Health Monitoring
|
|
221
|
+
The service includes health checks accessible at `/health`:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Check health
|
|
225
|
+
curl https://your-domain.com/health
|
|
226
|
+
|
|
227
|
+
# Expected response
|
|
228
|
+
{
|
|
229
|
+
"status": "healthy",
|
|
230
|
+
"transport": "streamable-http"
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Troubleshooting
|
|
235
|
+
|
|
236
|
+
### Common Issues
|
|
237
|
+
|
|
238
|
+
1. **Container won't start**
|
|
239
|
+
```bash
|
|
240
|
+
# Check logs
|
|
241
|
+
docker-compose logs human-mcp
|
|
242
|
+
|
|
243
|
+
# Verify configuration
|
|
244
|
+
docker-compose config
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
2. **SSL certificate issues**
|
|
248
|
+
```bash
|
|
249
|
+
# Check Traefik logs
|
|
250
|
+
docker-compose logs traefik
|
|
251
|
+
|
|
252
|
+
# Verify domain DNS points to server
|
|
253
|
+
nslookup your-domain.com
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
3. **API requests failing**
|
|
257
|
+
```bash
|
|
258
|
+
# Check CORS and allowed hosts
|
|
259
|
+
# Verify API key is set correctly
|
|
260
|
+
# Check rate limiting settings
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Service Restart
|
|
264
|
+
```bash
|
|
265
|
+
# Restart specific service
|
|
266
|
+
docker-compose restart human-mcp
|
|
267
|
+
|
|
268
|
+
# Restart all services
|
|
269
|
+
docker-compose restart
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Clean Deployment
|
|
273
|
+
```bash
|
|
274
|
+
# Stop and remove containers
|
|
275
|
+
docker-compose down -v
|
|
276
|
+
|
|
277
|
+
# Remove images
|
|
278
|
+
docker-compose down --rmi all
|
|
279
|
+
|
|
280
|
+
# Fresh deployment
|
|
281
|
+
docker-compose up -d --build
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Performance Tuning
|
|
285
|
+
|
|
286
|
+
### Resource Limits
|
|
287
|
+
Adjust in `docker-compose.yaml`:
|
|
288
|
+
|
|
289
|
+
```yaml
|
|
290
|
+
deploy:
|
|
291
|
+
resources:
|
|
292
|
+
limits:
|
|
293
|
+
cpus: '2.0'
|
|
294
|
+
memory: 2G
|
|
295
|
+
reservations:
|
|
296
|
+
cpus: '1.0'
|
|
297
|
+
memory: 1G
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Scaling
|
|
301
|
+
For high traffic, consider:
|
|
302
|
+
|
|
303
|
+
1. Enable Redis for session storage
|
|
304
|
+
2. Use multiple MCP server instances
|
|
305
|
+
3. Configure load balancing in Traefik
|
|
306
|
+
4. Monitor resource usage and scale accordingly
|
|
307
|
+
|
|
308
|
+
## Backup
|
|
309
|
+
|
|
310
|
+
### Important Data
|
|
311
|
+
- Environment configuration (`.env`)
|
|
312
|
+
- SSL certificates (`letsencrypt/`)
|
|
313
|
+
- Application data (`data/`)
|
|
314
|
+
|
|
315
|
+
### Backup Commands
|
|
316
|
+
```bash
|
|
317
|
+
# Create backup
|
|
318
|
+
tar -czf human-mcp-backup-$(date +%Y%m%d).tar.gz .env letsencrypt/ data/
|
|
319
|
+
|
|
320
|
+
# Restore backup
|
|
321
|
+
tar -xzf human-mcp-backup-YYYYMMDD.tar.gz
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## Support
|
|
325
|
+
|
|
326
|
+
- Check application logs for errors
|
|
327
|
+
- Verify environment configuration
|
|
328
|
+
- Ensure all required services are running
|
|
329
|
+
- Test health endpoint accessibility
|
package/Dockerfile
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
# Human MCP Server - Production Dockerfile
|
|
2
|
+
FROM oven/bun:1-alpine AS base
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
# Install system dependencies needed for video processing
|
|
5
|
+
RUN apk add --no-cache \
|
|
6
|
+
ffmpeg \
|
|
7
|
+
ca-certificates \
|
|
8
|
+
dumb-init \
|
|
9
|
+
wget
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
RUN apk add --no-cache ffmpeg
|
|
11
|
+
WORKDIR /app
|
|
7
12
|
|
|
8
13
|
# Copy package files
|
|
9
|
-
COPY package.json bun.
|
|
14
|
+
COPY package.json bun.lock ./
|
|
10
15
|
|
|
11
|
-
# Install dependencies
|
|
12
|
-
RUN bun install --frozen-lockfile
|
|
16
|
+
# Install dependencies (production only)
|
|
17
|
+
RUN bun install --frozen-lockfile --production
|
|
13
18
|
|
|
14
19
|
# Copy source code
|
|
15
20
|
COPY . .
|
|
@@ -17,12 +22,31 @@ COPY . .
|
|
|
17
22
|
# Build the application
|
|
18
23
|
RUN bun run build
|
|
19
24
|
|
|
20
|
-
#
|
|
25
|
+
# Create a non-root user for security
|
|
26
|
+
RUN addgroup -g 1001 -S nodejs && \
|
|
27
|
+
adduser -S mcp -u 1001
|
|
28
|
+
|
|
29
|
+
# Change ownership of the app directory
|
|
30
|
+
RUN chown -R mcp:nodejs /app
|
|
31
|
+
USER mcp
|
|
32
|
+
|
|
33
|
+
# Set production environment variables
|
|
34
|
+
ENV NODE_ENV=production
|
|
35
|
+
ENV TRANSPORT_TYPE=http
|
|
36
|
+
ENV HTTP_PORT=3000
|
|
37
|
+
ENV HTTP_HOST=0.0.0.0
|
|
38
|
+
ENV HTTP_SESSION_MODE=stateful
|
|
39
|
+
ENV HTTP_CORS_ENABLED=true
|
|
40
|
+
|
|
41
|
+
# Expose the port
|
|
21
42
|
EXPOSE 3000
|
|
22
43
|
|
|
23
|
-
# Health check
|
|
24
|
-
HEALTHCHECK --interval=30s --timeout=
|
|
25
|
-
|
|
44
|
+
# Health check using the /health endpoint
|
|
45
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
|
|
46
|
+
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
|
47
|
+
|
|
48
|
+
# Use dumb-init to handle signals properly
|
|
49
|
+
ENTRYPOINT ["dumb-init", "--"]
|
|
26
50
|
|
|
27
|
-
#
|
|
51
|
+
# Start the server
|
|
28
52
|
CMD ["bun", "run", "dist/index.js"]
|