feat: add Docker dev support for the MCP server via ./dev.sh - #4132
Merged
Merged
Conversation
Contributor
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4132/ |
akira28
marked this pull request as ready for review
September 17, 2026 15:43
Contributor
There was a problem hiding this comment.
Requesting changes: MCP_SERVER_PROFILE is documented as configurable for serve-mcp, but the current compose service does not pass it into the container, so profile switching does not work.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
akira28
enabled auto-merge (squash)
September 17, 2026 16:00
Contributor
There was a problem hiding this comment.
Approved.
What is this? | From workflow: PR Review
Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.
akira28
disabled the stack merge
September 18, 2026 07:32
akira28
added this pull request to stack #4139
September 18, 2026 07:32
Extends the dev Docker setup introduced in c7c3ace to cover the MCP server. Running `./dev.sh serve-mcp` starts the MCP HTTP server at `http://localhost:8080/docs/_mcp` without requiring a local .NET SDK install. `./dev.sh build-mcp` builds only the MCP image; extra flags (e.g. `--progress=plain`, `--no-cache`) pass through to bake. The MCP server uses its own production Dockerfile at `src/api/Elastic.Documentation.Mcp.Remote/Dockerfile`. Three bugs in that file were fixed along the way: `npm` installed Node 18 from dnf while Playwright requires Node 20+, `DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1` was set in the build stage (causing the regex source generator to reject the `"en-US"` culture name), and the publish command hardcoded `linux-x64` regardless of the builder's native architecture. Node is now copied from `node:22-bookworm-slim`, the invariant flag moved to the runtime stage only, and a `PUBLISH_RID` build arg controls the target RID — defaulting to `linux-x64` for CI, falling back to `TARGETARCH` when empty (so Apple Silicon builds `linux-arm64` natively via bake). The OTel package bump in `Directory.Packages.props` is a forward-port of the fix from the `fix/otel-resources-host-vulnerability` branch: the MCP server's restore fails without it due to `NU1903` on `OpenTelemetry.Resources.Host` 1.15.1-beta.1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on.Api
Replace the custom PUBLISH_RID build arg and case-statement with the same
arch=$TARGETARCH / if amd64 → x64 / RID="${TARGETOS}-${arch}" pattern used
in src/api/Elastic.Documentation.Api/Dockerfile. Docker buildx always
populates TARGETARCH and TARGETOS correctly for both CI and local builds,
so the override arg was not needed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…file Match Elastic.Documentation.Api/Dockerfile exactly: drop the --output flag, introduce a RID variable, and cp from the standard artifacts path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…de image AL2023 ships nodejs22 and nodejs22-npm packages, so there is no need for a separate node:22-bookworm-slim stage and the COPY/symlink dance. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without explicit propagation, host env vars are ignored by Compose and the app always uses its default profile. The variable now defaults to "public" so the service behaves the same as before when the var is unset. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
akira28
force-pushed
the
feature/add-mcp-to-docker
branch
from
September 18, 2026 07:34
40452b9 to
51d2f1c
Compare
theletterf
approved these changes
Sep 18, 2026
reakaleek
approved these changes
Sep 18, 2026
| RUN curl -L https://dot.net/v1/dotnet-install.sh -o dotnet-install.sh | ||
| RUN chmod +x ./dotnet-install.sh | ||
| RUN ./dotnet-install.sh | ||
| RUN dnf update -y \ |
Member
There was a problem hiding this comment.
Thank you for reducing the layers 😺
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extends the dev Docker setup from #4076 to cover the MCP server. Running
./dev.sh serve-mcpstarts the MCP HTTP server athttp://localhost:8080/docs/_mcpwithout a local .NET SDK install../dev.sh build-mcpbuilds only the MCP image; extra flags (e.g.--progress=plain,--no-cache) pass through to bake.Affects: Dev tooling
Why
The MCP server is deployed as a separate service but had no dev workflow equivalent to
./dev.sh serve. Developers needed a local .NET SDK to run and test it.What
MCP bake target and compose service
A new
mcptarget indocker-bake.hclpoints at the production Dockerfile so there is no duplicated build logic. A matchingmcpservice andmcp-artifactsvolume are added todocker-compose.yml.dev.sh commands
build-mcp,serve-mcp,serve-mcp-detached, andstop-mcpfollow the same conventions as the existingbuild/serve/stopcommands. Extra arguments tobuild-mcppass through to bake.MCP Dockerfile — single AL2023 base image
The Dockerfile previously used a
node:22-bookworm-slimstage to copy Node binaries into the AL2023 build image. AL2023 shipsnodejs22andnodejs22-npmpackages, so the extra stage is gone and Node is now installed viadnfalongside the other build dependencies.MCP Dockerfile — build fixes
Three bugs in the production Dockerfile were fixed.
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1was set in the build stage, causing the regex source generator to reject"en-US"culture names (SYSLIB1042) — it now lives in the runtime stage only. The RID detection now uses the sameTARGETOS/TARGETARCH→RID="${TARGETOS}-${arch}"pattern asElastic.Documentation.Api/Dockerfileinstead of a customPUBLISH_RIDbuild arg. The publish output is read from the standard.artifacts/publish/…path rather than a custom--outputdirectory.Verify
./dev.sh build-mcp ./dev.sh serve-mcp # connect an MCP client to http://localhost:8080/docs/_mcp🤖 Generated with Claude Code