This document outlines the development plan for the haproxy-mcp-server Go project, leveraging the haproxytech/client-native SDK. The server will follow the Model Context Protocol (MCP) standard, similar to other MCP server implementations.
- Develop a Go-based MCP server for HAProxy that allows interaction with HAProxy's runtime API
- Provide a standardized way for AI assistants to manage HAProxy configurations
- Support both TCP4 and Unix socket connections to HAProxy
- Ensure enterprise-grade security and reliability
- API Focus: The server will strictly interact with HAProxy through the Runtime API only.
- Standard Logging: The project will use Go's standard library
log/slogfor logging. - Configuration Flexibility: Support for both TCP4 and Unix socket connections to HAProxy.
- Security: Implement secure handling of connections and proper input validation.
The project will follow a standard Go project layout:
cmd/server: Entry point for the applicationinternal/haproxy: HAProxy client wrapper and implementationinternal/mcp/tools: MCP tool definitions and implementationsinternal/config: Configuration management
A client wrapper will abstract the HAProxy Runtime API communications:
- Support for both TCP4 connections and Unix socket access
- Error handling and retry mechanisms
- Method wrappers for all needed Runtime API operations
MCP tools will expose HAProxy operations through the Model Context Protocol:
- Runtime statistics retrieval
- Version and process information
- Counters management
- Frontend, backend, and server discovery
- Configuration exploration
- Map and table inspection
- Server addition and removal
- Server enabling and disabling
- Weight and connection limit adjustments
- Session listing and management
- Session termination capabilities
- Map file management
- ACL list operations
- Health check control
- Agent-based monitoring configuration
- Error reporting
- Echo testing
- Help documentation
The MCP server will handle the protocol communications:
- Support for both stdio and HTTP transports
- Tool registration and dispatch
- Error handling and logging
Configuration will be handled through environment variables:
HAPROXY_HOST: Host of the HAProxy instanceHAPROXY_PORT: Port for the HAProxy Runtime APIHAPROXY_RUNTIME_MODE: "tcp4" or "unix"HAPROXY_RUNTIME_SOCKET: Unix socket pathMCP_TRANSPORT: Transport method (stdio/http)MCP_PORT: HTTP port for serverLOG_LEVEL: Logging verbosity
The project will include:
- Makefile for common development operations
- Docker support for containerized deployment
- CI/CD configuration for automated builds and testing
Testing will focus on:
- Unit tests for all components
- Integration tests for the HAProxy client
- End-to-end tests for the MCP server
Documentation will include:
- README with installation and usage instructions
- Configuration documentation
- MCP tools reference
- Integration examples
The CI/CD pipeline will automate:
- Code linting and testing
- Security scanning
- Binary builds for multiple platforms
- Docker image building and publishing
- Release management
The project will follow semantic versioning, with releases published to:
- GitHub Releases
- Docker Hub/GitHub Container Registry
- Homebrew tap