-
Notifications
You must be signed in to change notification settings - Fork 324
Add Custom MCP Gateway example + servers (brave, wikipedia, postgres) and CI #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
f0b7d54
c17c57e
560fd68
7b95c1b
43c0dda
f93332c
60b8c5d
a282bb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "**" ] | ||
| pull_request: | ||
| branches: [ "**" ] | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint Markdown and YAML | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Markdown Lint | ||
| uses: avto-dev/markdown-lint@v1 | ||
| with: | ||
| config: .markdownlint.yaml | ||
| args: | | ||
| **/*.md | ||
|
|
||
| - name: YAML Lint | ||
| uses: ibiqlik/action-yamllint@v3 | ||
| with: | ||
| file_or_dir: . | ||
| config_file: .yamllint | ||
| strict: true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Compose CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "**" ] | ||
| pull_request: | ||
| branches: [ "**" ] | ||
|
|
||
| jobs: | ||
| compose-validate: | ||
| name: Compose config validation (custom-mcp) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Docker version | ||
| run: docker version | ||
| - name: Compose config | ||
| run: | | ||
| docker compose -f custom-mcp/compose.yaml -f custom-mcp/compose.ci.yaml config | ||
| working-directory: agents/compose-for-agents | ||
|
|
||
| e2e-health: | ||
| name: E2E health check (custom-mcp) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Start stack | ||
| run: | | ||
| docker compose -f custom-mcp/compose.yaml -f custom-mcp/compose.ci.yaml up -d | ||
| working-directory: agents/compose-for-agents | ||
| - name: Wait for health | ||
| run: | | ||
| for i in $(seq 1 30); do | ||
| if curl -fsS http://localhost:8811/health; then | ||
| exit 0 | ||
| fi | ||
| sleep 2 | ||
| done | ||
| echo "Gateway health check failed" >&2 | ||
| docker compose -f custom-mcp/compose.yaml -f custom-mcp/compose.ci.yaml logs || true | ||
| exit 1 | ||
| working-directory: agents/compose-for-agents | ||
| - name: Teardown | ||
| if: always() | ||
| run: docker compose -f custom-mcp/compose.yaml -f custom-mcp/compose.ci.yaml down -v --remove-orphans | ||
| working-directory: agents/compose-for-agents |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,5 @@ | |
| /.cursor/ | ||
| **/init-secrets.sh | ||
| **/secret.openai-api-key | ||
| **/.mcp.env | ||
| **/postgres_url | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||
| # Custom MCP Gateway Stack | ||||||
|
|
||||||
| This example wires a Docker MCP Gateway with a flexible set of MCP servers and secrets loaded from a `.mcp.env` file. | ||||||
|
|
||||||
| Prerequisites | ||||||
|
||||||
| - Docker Desktop 4.43+ or Docker Engine with Compose v2.38.1+ | ||||||
| - Optional: Docker Model Runner if you plan to use local models | ||||||
|
|
||||||
| Setup | ||||||
|
||||||
| 1. cd custom-mcp | ||||||
| 2. cp mcp.env.example .mcp.env | ||||||
| 3. Fill in required secrets (e.g., GITHUB_TOKEN for `github-official`). | ||||||
|
|
||||||
| Run | ||||||
|
||||||
| Run | |
| ## Run |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section header should use a level 2 markdown heading (##) for proper document structure.
| Modify servers | |
| ## Modify servers |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section header should use a level 2 markdown heading (##) for proper document structure.
| Included servers & secrets | |
| ## Included servers & secrets |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section header should use a level 2 markdown heading (##) for proper document structure.
| Notes | |
| ## Notes |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| version: "3" | ||
|
|
||
| tasks: | ||
| up: | ||
| desc: Start custom MCP stack | ||
| cmds: | ||
| - docker compose up --build | ||
| dir: . | ||
|
|
||
| down: | ||
| desc: Stop and remove containers | ||
| cmds: | ||
| - docker compose down -v --remove-orphans | ||
| dir: . | ||
|
|
||
| build: | ||
| desc: Build images | ||
| cmds: | ||
| - docker compose build | ||
| dir: . | ||
|
|
||
| clean: | ||
| desc: Clean everything | ||
| cmds: | ||
| - docker compose down -v --remove-orphans | ||
| - docker builder prune -f | ||
| dir: . |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| services: | ||
| mcp-gateway: | ||
| # In CI, avoid using Docker API socket and any external secrets. | ||
| # Only enable servers that require no credentials. | ||
| use_api_socket: false | ||
| ports: | ||
| - "8811:8811" | ||
| command: | ||
| - --transport=sse | ||
| - --servers=duckduckgo | ||
| - --servers=wikipedia-mcp | ||
| secrets: [] |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||||||
| services: | ||||||||||
| # Minimal test client to verify the MCP Gateway is reachable. | ||||||||||
| mcp-client: | ||||||||||
| image: curlimages/curl:8.11.1 | ||||||||||
| depends_on: | ||||||||||
| - mcp-gateway | ||||||||||
| command: ["/bin/sh", "-lc", "curl -sS http://mcp-gateway:8811/health || sleep 3600"] | ||||||||||
|
|
||||||||||
| mcp-gateway: | ||||||||||
| # Secures and launches MCP servers via the Docker API socket | ||||||||||
| image: docker/mcp-gateway:latest | ||||||||||
| use_api_socket: true | ||||||||||
| ports: | ||||||||||
| - "8811:8811" | ||||||||||
| command: | ||||||||||
| # switch between streaming or sse depending on your agent | ||||||||||
| - --transport=sse | ||||||||||
| # secrets can be provided multiple times and referenced per server | ||||||||||
| - --secrets=docker-desktop:/run/secrets/mcp_secret | ||||||||||
| # For Postgres DSN | ||||||||||
| - --secrets=/run/secrets/database-url | ||||||||||
|
||||||||||
| - --secrets=/run/secrets/database-url | |
| - --secrets=docker-desktop:/run/secrets/database-url |
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The postgres server is enabled by default but requires the database-url secret file to exist. Since this file doesn't exist by default and may not be needed by all users, consider adding a comment here noting that users can remove or comment out the postgres server and related secret references (lines 29-30, 33, 46-47) if they don't need postgres functionality.
Copilot
AI
Dec 11, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database-url secret references './postgres_url' file which doesn't exist in the repository and isn't created by default. This will cause the compose stack to fail to start unless the user manually creates this file. Consider either making this secret optional, documenting the requirement more prominently in the compose file, or providing an example postgres_url.example file similar to the mcp.env.example pattern.
| database-url: | |
| database-url: | |
| # IMPORTANT: You must create the './postgres_url' file containing your Postgres DSN. | |
| # See 'postgres_url.example' for a template/example. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Copy this file to .mcp.env and fill in the values you need | ||
| # Common MCP servers | ||
| GITHUB_TOKEN= | ||
| DUCKDUCKGO_APP_NAME=docker-compose-for-agents | ||
| BRAVE_API_KEY= | ||
|
|
||
| # Postgres DSN is read from a separate secret file named "postgres_url" in this directory. | ||
| # Example content: | ||
| # postgres://user:password@host:5432/dbname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The MCPs column lists "duckduckgo, github-official (extensible)" but the actual compose.yaml includes additional servers: brave, wikipedia-mcp, and postgres. Consider updating this to be more accurate, such as "duckduckgo, github-official, brave, wikipedia-mcp, postgres (extensible)" or "duckduckgo, github-official, brave, and more (extensible)".