Skip to content

🏃 Usage

You can run the server using Task, which simplifies the process, or with Docker Compose for a containerized environment.

🖥 Running the Server Locally

To run the FastAPI server on your local machine:

task run
AGENTS_LIBRARY_PATH="./agents-library" && ./venv/bin/python -m uvicorn app.server:app --host 0.0.0.0 --port 8080 --reload

The server will be available at http://0.0.0.0:8080. It will automatically reload when code changes are detected.

🐳 Running with Docker

To build the server in a Docker container:

task build
docker build -t nicholaswilde/mcp-server .

To run the server in a Docker container:

task docker-run
docker run -p 8080:8080 nicholaswilde/mcp-server

The server will be available at http://localhost:8080.

compose.yaml
---
services:
  mcp-server:
    build:
      context: .
      args:
        VERSION: ${GIT_TAG:-latest}
    image: nicholaswilde/mcp-server:${GIT_TAG:-latest}
    ports:
      - "8080:8080"
    volumes:
      - ./agents-library:/app/agents-library
    environment:
      - PUID=${PUID:-1000}
      - PGID=${PGID:-1000}
      - SERVER_PORT=${SERVER_PORT:-8080}
      - AGENTS_LIBRARY_PATH=${AGENTS_LIBRARY_PATH:-/app/agents-library}
      - MCP_SERVER_NAME=${MCP_SERVER_NAME:-mcp-server}
      - MCP_SERVER_STREAMABLE_HTTP_PATH=${MCP_SERVER_STREAMABLE_HTTP_PATH:-/}
      - MCP_SERVER_JSON_RESPONSE=${MCP_SERVER_JSON_RESPONSE:-true}
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 5s

📋 Available Tasks

task: Available tasks for this project:
* build:                    Build and push the Docker image for multiple architectures (amd64, arm64).
* compile:                  Compile requirements.in to update requirements.txt.
* default:                  List all available tasks.
* docker-run:               Run the Docker container.
* export:                   Export task  list
* gflash:                   Run Gemini with the gemini-2.5-flash model.
* glite:                    Run Gemini with the gemini-2.5-flash-lite model.
* gpro:                     Run Gemini with the gemini-2.5-pro model.
* install:                  Install Python dependencies using pip-sync.
* install-pre-commit:       Install pre-commit hooks for the repository.
* lint:                     Run linting and formatting checks using ruff.
* pre-commit-run:           Run all pre-commit hooks on all files.
* ruff:                     Run ruff checks and formatting.
* run:                      Run the FastAPI server locally.
* serve:                    Serve mkdocs-material
* test:                     Run Python unit tests using pytest.