From a8601bace0ac32c1fcef007f6a1d92a65d98126b Mon Sep 17 00:00:00 2001 From: Arek Borucki Date: Tue, 23 Jun 2026 19:06:57 +0200 Subject: [PATCH 1/2] docs: document monitoring server health and metrics endpoints --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index e45d1ebaf..22892d481 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,47 @@ npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --httpPort= > **Note:** The default transport is `stdio`, which is suitable for integration with most MCP clients. Use `http` transport if you need to interact with the server over HTTP. +##### Monitoring server (health check and metrics) + +When running with `--transport http`, you can optionally start a **separate** monitoring HTTP server that exposes a health-check endpoint and, optionally, a metrics endpoint. It listens on its own host and port, independent of the main MCP HTTP server, so you can keep it on an internal-only interface. + +The monitoring server is only started when **both** `--monitoringServerHost` and `--monitoringServerPort` are set (setting only one of them is rejected at startup). It is disabled by default. + +```shell +npx -y mongodb-mcp-server@latest --transport http \ + --httpHost=0.0.0.0 --httpPort=3000 \ + --monitoringServerHost=0.0.0.0 --monitoringServerPort=8080 +``` + +It exposes the following routes: + +| Route | Enabled by | Response | +| ---------- | -------------------------------- | ----------------------------------------------------------- | +| `/health` | `health-check` feature (default) | `200` with `{"status":"ok"}` | +| `/metrics` | `metrics` feature | `200` with `text/plain` metrics for scraping by a collector | + +Check the health endpoint: + +```shell +curl http://0.0.0.0:8080/health +# {"status":"ok"} +``` + +Use `--monitoringServerFeatures` (or `MDB_MCP_MONITORING_SERVER_FEATURES`) to control which routes are exposed. It accepts a comma-separated list and defaults to `health-check`. To expose both the health check and metrics: + +```shell +npx -y mongodb-mcp-server@latest --transport http \ + --httpHost=0.0.0.0 --httpPort=3000 \ + --monitoringServerHost=0.0.0.0 --monitoringServerPort=8080 \ + --monitoringServerFeatures=health-check,metrics +``` + +- `--monitoringServerHost` (default: ``): Host to bind the monitoring server to. +- `--monitoringServerPort` (default: ``): Port for the monitoring server. +- `--monitoringServerFeatures` (default: `health-check`): Comma-separated features to expose (`health-check`, `metrics`). + +> **Note:** The `--healthCheckHost` and `--healthCheckPort` options are deprecated aliases for `--monitoringServerHost` and `--monitoringServerPort`; prefer the `monitoringServer*` options. + #### Option 6: Copilot CLI You can use the Copilot CLI to interactively add the MCP server: From 8cd73a6b54eb3e00d42f08426c6db9a3026511dd Mon Sep 17 00:00:00 2001 From: Arek Borucki Date: Tue, 23 Jun 2026 19:10:43 +0200 Subject: [PATCH 2/2] docs: document monitoring server health and metrics endpoints --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 22892d481..97831d29d 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,7 @@ npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --httpPort= > **Note:** The default transport is `stdio`, which is suitable for integration with most MCP clients. Use `http` transport if you need to interact with the server over HTTP. -##### Monitoring server (health check and metrics) +##### Monitoring server health checks When running with `--transport http`, you can optionally start a **separate** monitoring HTTP server that exposes a health-check endpoint and, optionally, a metrics endpoint. It listens on its own host and port, independent of the main MCP HTTP server, so you can keep it on an internal-only interface. @@ -286,7 +286,7 @@ The monitoring server is only started when **both** `--monitoringServerHost` and ```shell npx -y mongodb-mcp-server@latest --transport http \ --httpHost=0.0.0.0 --httpPort=3000 \ - --monitoringServerHost=0.0.0.0 --monitoringServerPort=8080 + --monitoringServerHost=127.0.0.1 --monitoringServerPort=8080 ``` It exposes the following routes: @@ -299,7 +299,7 @@ It exposes the following routes: Check the health endpoint: ```shell -curl http://0.0.0.0:8080/health +curl http://127.0.0.1:8080/health # {"status":"ok"} ``` @@ -308,7 +308,7 @@ Use `--monitoringServerFeatures` (or `MDB_MCP_MONITORING_SERVER_FEATURES`) to co ```shell npx -y mongodb-mcp-server@latest --transport http \ --httpHost=0.0.0.0 --httpPort=3000 \ - --monitoringServerHost=0.0.0.0 --monitoringServerPort=8080 \ + --monitoringServerHost=127.0.0.1 --monitoringServerPort=8080 \ --monitoringServerFeatures=health-check,metrics ```