# HAProxy MCP Server Tools

This document describes the MCP tools supported by the HAProxy MCP Server, which allow AI assistants to interact with HAProxy's Runtime API through the Model Context Protocol (MCP).

Each tool maps directly to HAProxy Runtime API commands and is implemented using the `client-native` library's Runtime client.

## 1. Statistics & Process Info

### show\_stat

Retrieves the full statistics table for HAProxy.

* **Runtime API**: `show stat`
* **Input**: Optional filter (proxy or server names)
* **Output**: Full stats table including bytes, sessions, errors

### show\_info

Displays HAProxy version, uptime, and process information.

* **Runtime API**: `show info`
* **Input**: None
* **Output**: Version, uptime, process limits, mode

### debug\_counters

Shows internal HAProxy counters.

* **Runtime API**: `debug counters`
* **Input**: None
* **Output**: Internal counters (allocations, events)

### clear\_counters\_all

Resets all statistics counters.

* **Runtime API**: `clear counters all`
* **Input**: None
* **Output**: Confirmation that all stats have been reset

### dump\_stats\_file

Writes current statistics to a file.

* **Runtime API**: `dump stats-file`
* **Input**: Filepath
* **Output**: Confirmation + path of dump file

## 2. Topology Discovery

### show\_frontend

Lists all frontends with their configurations.

* **Runtime API**: `show frontend`
* **Input**: None
* **Output**: List of frontends with bind address, mode, and state

### show\_backend

Lists all backends and their configurations.

* **Runtime API**: `show backend`
* **Input**: None
* **Output**: List of backends and their configuration snippets

### show\_servers\_state

Displays per-server state and statistics.

* **Runtime API**: `show servers state`
* **Input**: Optional backend name
* **Output**: Per-server state, current sessions, weight

### show\_map

Shows entries in a map file.

* **Runtime API**: `show map`
* **Input**: Map filename
* **Output**: All key→value entries

### show\_table

Shows entries in a stick table.

* **Runtime API**: `show table`
* **Input**: Table name
* **Output**: Stick‑table entries

## 3. Dynamic Pool Management

### add\_server

Dynamically registers a new server in a backend.

* **Runtime API**: `add server <backend> <name> <addr>`
* **Input**: Backend, server name, address, optional port, weight
* **Output**: Success/failure confirmation

### del\_server

Removes a dynamic server from a backend.

* **Runtime API**: `del server <backend> <name>`
* **Input**: Backend, server name
* **Output**: Success/failure confirmation

### enable\_server

Takes a server out of maintenance mode.

* **Runtime API**: `enable server <backend>/<name>`
* **Input**: Backend, server name
* **Output**: Confirmation

### disable\_server

Puts a server into maintenance mode.

* **Runtime API**: `disable server <backend>/<name>`
* **Input**: Backend, server name
* **Output**: Confirmation

### set\_weight

Changes a server's load-balancing weight.

* **Runtime API**: `set weight <backend>/<server> <weight>`
* **Input**: Backend, server, new weight
* **Output**: Old vs. new weight

### set\_maxconn\_server

Sets the maximum number of connections for a server.

* **Runtime API**: `set maxconn server <backend>/<name> <maxconn>`
* **Input**: Backend, server, maxconn value
* **Output**: Confirmation

### set\_maxconn\_frontend

Sets the maximum number of connections for a frontend.

* **Runtime API**: `set maxconn frontend <frontend> <maxconn>`
* **Input**: Frontend, maxconn value
* **Output**: Confirmation

## 4. Session Control

### show\_sess

Lists all active sessions.

* **Runtime API**: `show sess`
* **Input**: None or backend filter
* **Output**: List of active sessions

### shutdown\_session

Terminates a specific client session by ID.

* **Runtime API**: `shutdown session <session‑id>`
* **Input**: Session ID
* **Output**: Confirmation

### shutdown\_sessions\_server

Terminates all sessions on a given server.

* **Runtime API**: `shutdown sessions server <backend>/<name>`
* **Input**: Backend, server
* **Output**: Confirmation

## 5. Maps & ACLs

### add\_map

Adds an entry to a map file.

* **Runtime API**: `add map <file> <key> <value>`
* **Input**: Map file, key, value
* **Output**: Confirmation

### del\_map

Deletes a single entry from a map file.

* **Runtime API**: `del map <file> <key>`
* **Input**: Map file, key
* **Output**: Confirmation

### set\_map

Updates the value of an existing map entry.

* **Runtime API**: `set map <file> <key> <value>`
* **Input**: Map file, key, new value
* **Output**: Confirmation

### clear\_map

Deletes all entries from a map file.

* **Runtime API**: `clear map <file>`
* **Input**: Map file
* **Output**: Confirmation

### commit\_map

Commits a prepared map‐file transaction.

* **Runtime API**: `commit map <file>`
* **Input**: Map file
* **Output**: Confirmation

### add\_acl

Adds a value to an ACL list.

* **Runtime API**: `add acl <file> <key>`
* **Input**: ACL file, key
* **Output**: Confirmation

### del\_acl

Removes a value from an ACL list.

* **Runtime API**: `del acl <file> <key>`
* **Input**: ACL file, key
* **Output**: Confirmation

### clear\_acl

Deletes all entries from an ACL list.

* **Runtime API**: `clear acl <file>`
* **Input**: ACL file
* **Output**: Confirmation

### commit\_acl

Commits a prepared ACL transaction.

* **Runtime API**: `commit acl <file>`
* **Input**: ACL file
* **Output**: Confirmation

## 6. Health Checks & Agents

### enable\_health

Enables active health checks on a server.

* **Runtime API**: `enable health <backend>/<server>`
* **Input**: Backend, server
* **Output**: Confirmation

### disable\_health

Disables active health checks on a server.

* **Runtime API**: `disable health <backend>/<server>`
* **Input**: Backend, server
* **Output**: Confirmation

### enable\_agent

Resumes agent-based health probes.

* **Runtime API**: `enable agent <backend>/<server>`
* **Input**: Backend, server
* **Output**: Confirmation

### disable\_agent

Stops agent-based health probes.

* **Runtime API**: `disable agent <backend>/<server>`
* **Input**: Backend, server
* **Output**: Confirmation

## 7. Miscellaneous

### show\_errors

Lists protocol violation errors.

* **Runtime API**: `show errors [since <seconds>]`
* **Input**: Optional time filter in seconds
* **Output**: Protocol violation errors

### echo

Returns a string (connectivity test).

* **Runtime API**: `echo <string>`
* **Input**: String to echo
* **Output**: Echoed string

### help

Shows available Runtime API commands.

* **Runtime API**: `help`
* **Input**: None
* **Output**: List of all Runtime API commands


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tuannvm.com/haproxy-mcp-server/tools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
