c9383788de
Co-authored-by: Copilot <copilot@github.com>
5.9 KiB
5.9 KiB
Deployment Guide - finn-eiendom MCP Server
This guide covers deploying the FINN Eiendom MCP server using Docker.
Quick Start
Prerequisites
- Docker and Docker Compose installed
- Remote server with port 8010 available
- (Optional) Reverse proxy (nginx/caddy) for HTTPS and load balancing
Build the Image
cd /root/projects/finn-mcp
docker build -t finn-mcp:latest .
Run Locally (Development)
docker-compose up -d
Verify the server is running:
curl http://localhost:8010
Deploy to Remote Server
-
Build and tag the image:
docker build -t your-registry/finn-mcp:latest . docker push your-registry/finn-mcp:latest -
On the remote server, create docker-compose.yml:
mkdir -p /opt/finn-mcp cd /opt/finn-mcp # Copy the docker-compose.yml and docker-compose.prod.yml files -
Start the service:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d -
Verify the service:
docker ps | grep finn-mcp docker logs finn-mcp-server
Configuration
Environment Variables
Set these via docker-compose.yml:
environment:
MCP_TRANSPORT: http # Transport protocol (http or stdio)
MCP_HOST: 0.0.0.0 # Bind address
MCP_PORT: 8010 # Port number
PYTHONUNBUFFERED: 1 # Immediate output logging
Port Configuration
Development (localhost only):
ports:
- "127.0.0.1:8010:8010"
Production (all interfaces):
ports:
- "8010:8010"
With reverse proxy (recommended):
ports:
- "127.0.0.1:8010:8010" # Only accessible via reverse proxy
Networking & Security
Option 1: Direct HTTP (Development Only)
# Not recommended for production
curl http://your-server:8010
Option 2: Reverse Proxy (Recommended)
Nginx example:
server {
listen 443 ssl http2;
server_name your-domain.com;
ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
location / {
proxy_pass http://localhost:8010;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 86400;
}
}
Caddy example:
your-domain.com {
reverse_proxy localhost:8010 {
header_up X-Forwarded-Proto {scheme}
header_up X-Forwarded-Host {host}
}
}
Monitoring
Check Container Health
# View logs
docker logs -f finn-mcp-server
# Check resource usage
docker stats finn-mcp-server
# View health status
docker inspect --format='{{.State.Health}}' finn-mcp-server
Log Aggregation
Logs are written to:
json-filedriver with 100MB max size, 10 file rotation- Structured JSON output for easy parsing
Forward to ELK/Splunk/Datadog if needed:
logging:
driver: "splunk"
options:
splunk-token: "your-token"
splunk-url: "https://your-instance.splunk.com"
Updates & Maintenance
Update the Image
# Pull latest code
git pull origin main
# Rebuild image
docker build -t finn-mcp:latest .
# Restart containers
docker-compose up -d
Database Backup
Cache database location: /app/cache.sqlite (inside container)
# Backup from host
docker exec finn-mcp-server cp /app/cache.sqlite /tmp/cache.sqlite.bak
docker cp finn-mcp-server:/tmp/cache.sqlite.bak ./cache.sqlite.bak
Troubleshooting
Server won't start
# Check logs
docker logs finn-mcp-server
# Verify port is available
lsof -i :8010
Health check failing
# Test connection
docker exec finn-mcp-server python -c "import socket; socket.create_connection(('localhost', 8010), timeout=5).close()"
High memory usage
# Check limits in docker-compose.yml
# Adjust memory limit if needed
deploy:
resources:
limits:
memory: 2G
Production Checklist
- Docker image built and tested locally
- Reverse proxy configured (nginx/caddy)
- SSL certificates installed
- Environment variables reviewed
- Resource limits appropriate for server
- Health checks enabled
- Logging configured (syslog/ELK/Datadog)
- Backups scheduled
- Monitoring alerts configured
- Failover/HA plan in place (if needed)
Integration with Copilot
Once the MCP server is running on your remote server, configure Copilot to connect:
On the machine running Copilot Desktop:
- Open Claude Desktop settings (or config file at
~/.config/claude-desktop/config.json) - Add HTTP transport configuration:
{
"mcpServers": {
"finn-eiendom": {
"type": "http",
"url": "http://your-server:8010"
}
}
}
Or with a reverse proxy:
{
"mcpServers": {
"finn-eiendom": {
"type": "http",
"url": "https://your-domain.com"
}
}
}
Support & Debugging
Test MCP Server Directly
# Test with stdio transport
cat > test_mcp.json << 'EOF'
{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}}
EOF
docker run -i finn-mcp:latest python -m finn_eiendom.mcp_server < test_mcp.json
List Available Tools
curl http://your-server:8010 -X POST -H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}'