Skip to content

Commit 6fbf952

Browse files
committed
docs: document monitoring server health and metrics endpoints
1 parent 51d680f commit 6fbf952

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,47 @@ npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --httpPort=
277277

278278
> **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.
279279
280+
##### Monitoring server (health check and metrics)
281+
282+
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.
283+
284+
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.
285+
286+
```shell
287+
npx -y mongodb-mcp-server@latest --transport http \
288+
--httpHost=0.0.0.0 --httpPort=3000 \
289+
--monitoringServerHost=0.0.0.0 --monitoringServerPort=8080
290+
```
291+
292+
It exposes the following routes:
293+
294+
| Route | Enabled by | Response |
295+
| ---------- | -------------------------------- | ----------------------------------------------------------- |
296+
| `/health` | `health-check` feature (default) | `200` with `{"status":"ok"}` |
297+
| `/metrics` | `metrics` feature | `200` with `text/plain` metrics for scraping by a collector |
298+
299+
Check the health endpoint:
300+
301+
```shell
302+
curl http://0.0.0.0:8080/health
303+
# {"status":"ok"}
304+
```
305+
306+
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:
307+
308+
```shell
309+
npx -y mongodb-mcp-server@latest --transport http \
310+
--httpHost=0.0.0.0 --httpPort=3000 \
311+
--monitoringServerHost=0.0.0.0 --monitoringServerPort=8080 \
312+
--monitoringServerFeatures=health-check,metrics
313+
```
314+
315+
- `--monitoringServerHost` (default: `<not set>`): Host to bind the monitoring server to.
316+
- `--monitoringServerPort` (default: `<not set>`): Port for the monitoring server.
317+
- `--monitoringServerFeatures` (default: `health-check`): Comma-separated features to expose (`health-check`, `metrics`).
318+
319+
> **Note:** The `--healthCheckHost` and `--healthCheckPort` options are deprecated aliases for `--monitoringServerHost` and `--monitoringServerPort`; prefer the `monitoringServer*` options.
320+
280321
#### Option 6: Copilot CLI
281322

282323
You can use the Copilot CLI to interactively add the MCP server:

0 commit comments

Comments
 (0)