Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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.

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=127.0.0.1 --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://127.0.0.1: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=127.0.0.1 --monitoringServerPort=8080 \
--monitoringServerFeatures=health-check,metrics
```

- `--monitoringServerHost` (default: `<not set>`): Host to bind the monitoring server to.
- `--monitoringServerPort` (default: `<not set>`): 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:
Expand Down