> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devhelm.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Your First MCP Server Monitor

> Create your first DevHelm MCP server monitor to check AI tool server availability

By the end of this guide, you'll have an MCP server monitor verifying that your AI tool server starts, connects over the Model Context Protocol, and exposes the expected tools.

<Accordion title="Prerequisites">
  * DevHelm CLI installed or an API token for REST calls
  * An API token set as `DEVHELM_API_TOKEN` — see [Authentication](/authentication)
  * An MCP server package (e.g., published to npm) or a command that starts one
</Accordion>

## Create the monitor

<Steps>
  <Step title="Create the MCP server monitor">
    <CodeGroup>
      ```bash CLI theme={null}
      devhelm monitors create \
        --name "My MCP Server" \
        --type MCP_SERVER \
        --url npx \
        --frequency 300 \
        --regions us-east
      ```

      ```yaml devhelm.yml theme={null}
      version: "1"
      monitors:
        - name: My MCP Server
          type: MCP_SERVER
          config:
            command: npx
            args:
              - "@my-org/mcp-server"
            env:
              API_KEY: ${MCP_API_KEY}
          frequencySeconds: 300
          regions:
            - us-east
      ```

      ```bash API theme={null}
      curl -X POST https://api.devhelm.io/api/v1/monitors \
        -H "Authorization: Bearer $DEVHELM_API_TOKEN" \
        -H "Content-Type: application/json" \
        -d '{
          "name": "My MCP Server",
          "type": "MCP_SERVER",
          "config": {
            "command": "npx",
            "args": ["@my-org/mcp-server"],
            "env": {
              "API_KEY": "your-api-key"
            }
          },
          "frequencySeconds": 300,
          "regions": ["us-east"]
        }'
      ```
    </CodeGroup>

    With the CLI, `--url` is the command that launches the MCP server. Arguments and environment variables aren't settable via flags — use YAML config-as-code (`config.args`, `config.env`) or the API for the full configuration, as shown in the other tabs.
  </Step>

  <Step title="Verify it's running">
    ```bash theme={null}
    devhelm monitors list --type MCP_SERVER
    devhelm monitors get <monitor-id>
    ```
  </Step>

  <Step title="Check results">
    Results show whether the MCP server started, connected, and listed its capabilities.

    ```bash theme={null}
    devhelm monitors checks <monitor-id> --limit 5
    ```
  </Step>
</Steps>

## Add assertions

Verify that the MCP server exposes the tools and resources you expect:

```yaml theme={null}
monitors:
  - name: My MCP Server
    type: MCP_SERVER
    config:
      command: npx
      args:
        - "@my-org/mcp-server"
    frequencySeconds: 300
    regions:
      - us-east
    assertions:
      - config:
          type: mcp_connects
        severity: fail
      - config:
          type: mcp_tool_available
          toolName: search
        severity: fail
      - config:
          type: mcp_min_tools
          min: 3
        severity: warn
```

Key MCP assertions:

| Type                     | What it checks                                         |
| ------------------------ | ------------------------------------------------------ |
| `mcp_connects`           | Server starts and completes the MCP handshake          |
| `mcp_tool_available`     | A specific tool is listed in the server's capabilities |
| `mcp_tool_count`         | Server exposes at least N tools                        |
| `mcp_resource_available` | A specific resource is available                       |
| `mcp_startup_time`       | Server starts within a time threshold                  |

For the full list, see [MCP Server configuration](/monitoring/mcp-server/configuration).

## How it works

Each check cycle:

1. DevHelm starts the MCP server using the configured `command` and `args`
2. Connects via the Model Context Protocol (stdio transport)
3. Requests the server's tool and resource listings
4. Evaluates assertions against the response
5. Terminates the server process

Environment variables in `env` are passed to the server process. Use DevHelm secrets (`${VAR}` syntax) to avoid storing credentials in config files.

## Next steps

<CardGroup cols={2}>
  <Card title="MCP Server reference" icon="robot" href="/monitoring/mcp-server/overview">
    Full configuration and assertion details.
  </Card>

  <Card title="First alert" icon="bell" href="/guides/first-alert">
    Get notified when your MCP server fails.
  </Card>

  <Card title="MCP Server SDK" icon="code" href="/sdk/mcp/overview">
    Use DevHelm as an MCP server in AI agents.
  </Card>
</CardGroup>
