QW

Qwen Max MCP Server Implementation

Deploy a fast, secure MCP server for Qwen models to enable scalable model hosting, API access, and easy integration into production workflows.

Quick Install
npx -y @66julienmartin/MCP-server-Qwen_Max

Overview

This repository implements an MCP (Model Context Protocol) server tailored for hosting Qwen Max family models. It exposes a standardized, low-latency API for model inference and session management so you can integrate Qwen Max into production pipelines, internal services, or development environments without building a bespoke serving layer.

The server focuses on predictable performance and secure deployment patterns: containerized packaging for easy orchestration, environment-driven configuration for automation, and optional TLS / token-based authentication for controlled API access. The goal is to make it straightforward to move from a local experiment to a scalable hosting setup with monitoring and operational controls in place.

Features

  • Standard MCP-compatible HTTP API to send inputs and receive model responses
  • Container-friendly: Docker image and docker-compose examples for quick deployment
  • Environment-based configuration for model path, port, auth token, and logging
  • Health checks and observability endpoints for integration with orchestrators
  • Support for model file mounting and runtime hot-swap (when configured)
  • Simple token-based access control and TLS support for secure transports
  • Resource and concurrency knobs (workers, batch size) to tune for latency/throughput

Installation / Configuration

Prerequisites: Docker (recommended) or a Linux server where you can build and run the provided container.

  1. Clone the repository
git clone https://github.com/66julienmartin/MCP-server-Qwen_Max.git
cd MCP-server-Qwen_Max
  1. Build the Docker image (recommended)
docker build -t mcp-qwen-max:latest .
  1. Run the server (basic)
docker run -d \
  --name mcp-qwen-max \
  -p 8080:8080 \
  -v /host/models/qwen_max:/models/qwen_max \
  -e MODEL_PATH=/models/qwen_max \
  -e MCP_PORT=8080 \
  -e AUTH_TOKEN="replace-with-secret" \
  mcp-qwen-max:latest
  1. Example docker-compose.yml
version: "3.8"
services:
  mcp:
    image: mcp-qwen-max:latest
    ports:
      - "8080:8080"
    volumes:
      - ./models/qwen_max:/models/qwen_max:ro
    environment:
      MODEL_PATH: /models/qwen_max
      MCP_PORT: 8080
      AUTH_TOKEN: "replace-with-secret"
      LOG_LEVEL: info
    restart: unless-stopped

Configuration environment variables (common):

VariablePurposeExample
MODEL_PATHFilesystem path to the Qwen Max model bundle/models/qwen_max
MCP_PORTHTTP port the MCP server listens on8080
AUTH_TOKENStatic bearer token for basic API auths3cr3t
TLS_CERTPath to TLS certificate (optional)/tls/cert.pem
TLS_KEYPath to TLS private key (optional)/tls/key.pem
LOG_LEVELLogging level (debug/info/warn/error)info
MAX_BATCHMaximum inference batch size (tunes throughput)8
WORKERSNumber of worker threads/processes4

Systemd example (non-container)

[Unit]
Description=MCP Qwen Max Server
After=network.target

[Service]
User=svc_mcp
WorkingDirectory=/opt/mcp-qwen-max
ExecStart=/opt/mcp-qwen-max/bin/mcp-server --model-path /opt/models/qwen_max --port 8080
Restart=on-failure
Environment=AUTH_TOKEN=replace-with-secret

[Install]
WantedBy=multi-user.target

Available Resources

  • /health — simple liveness/ readiness check (HTTP 200 when ready)
  • /metrics — Prometheus-compatible metrics export (request counts, latency, resource usage)
  • /models — management listing of loaded models (if enabled)
  • /mcp/v1/predict (or /predict) — primary inference endpoint implementing MCP request/response payloads
  • Logs — structured logs to STDOUT for aggregator ingestion

The exact endpoint paths and JSON schema follow the MCP specification included in the repository; consult the repo docs or OpenAPI (if provided) for the precise contract.

Use Cases

  • Production model serving: Deploy behind a load balancer (NGINX, Envoy, or k8s Ingress) with TLS and token authentication. Autoscale replicas based on CPU/GPU usage and expose /metrics to a Prometheus stack.
  • CI / staging validation: Spin up a single container with a small test model bundle to validate integration and request/response formats in a CI job.
  • Local development: Run the server locally mounted to your model artifacts to iterate on prompts and integration code without cloud resources.
  • Edge inference: Use the lightweight container on dedicated inference hardware (on-prem or cloud VM) to keep data and compute close to the application.
  • Pipeline integration: Use the MCP HTTP API to embed model inference into microservices, batch jobs, or event-driven pipelines (e.g., queue consumer posts data and forwards predictions).

Quick example: inference via curl

Replace AUTH_TOKEN and endpoint as configured.

curl -X POST "