About Consul MCP Server
Consul MCP Server connects AI agents to Consul service discovery and service mesh data for microservice analysis and troubleshooting. It can inspect health, connections, and metrics, and generate service relationship diagrams.
Key features
- 01List and analyze registered services
- 02Inspect health checks and failures
- 03View service connections and status
- 04Generate Mermaid service diagrams
- 05Analyze services and retrieve metrics
Use cases
- 01Troubleshoot failing microservice health checks
- 02Locate connection problems between services
- 03Diagram service mesh relationships
- 04Review service metrics and resource utilization
MCP support
The MCP server exposes tools for listing Consul services, checking health, inspecting connections, generating diagrams, analyzing services, and retrieving metrics.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEConsul MCP Server
A Model Control Protocol (MCP) server for interacting with HashiCorp Consul service discovery and service mesh. This implementation follows Anthropic's MCP specification and allows Claude to analyze your microservices architecture, create diagrams, identify issues, and provide recommendations through natural language interaction.
What is Model Control Protocol?
Model Control Protocol (MCP) is a specification developed by Anthropic that enables AI models like Claude to interact with external tools and APIs. This implementation connects AI Agents to your Consul infrastructure, allowing you to manage and analyze your services using natural language.
Features
- List and analyze services registered in Consul
- Identify and diagnose failing health checks
- Generate service mesh architecture diagrams
- Detect service connection issues and provide recommendations
- Get AI insights on service load balancing and resource utilization
Requirements
- Node.js 18+
- npm or yarn
- A running Consul instance (local or remote)
- Claude Desktop or Cursor IDE with Claude integration
Installation
# Clone the repository
git clone https://github.com/3loka/consul-mcp-server.git
cd consul-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
Configuration
Create a .env file in the root directory with the following variables:
CONSUL_HTTP_ADDR=http://localhost:8500
CONSUL_HTTP_TOKEN=your-consul-token
PORT=3000
USE_HTTP=true
CONSUL_HTTP_ADDR: Address of your Consul serverCONSUL_HTTP_TOKEN: ACL token of your Consul serverPORT: Port for the HTTP serverUSE_HTTP: Set to "true" for HTTP mode, omit for stdio mode
Installation
Installing in Cursor
To install and use this MCP server in Cursor:
-
In Cursor, open Settings (⌘+,) and navigate to the "MCP" tab.
-
Click "+ Add new MCP server."
-
Enter the following:
- Name: consul-assistant
- Type: command
- Command: npx -y consul-mcp-server
-
Click "Add" then scroll to the server and click "Disabled" to enable the server.
-
Restart Cursor, if needed, to ensure the MCP server is properly loaded.
Installing in Claude Desktop
To install and use this MCP server in Claude Desktop:
-
In Claude Desktop, open Settings (⌘+,) and navigate to the "Developer" tab.
-
Click "Edit Config" at the bottom of the window.
-
Edit the file (
~/Library/Application Support/Claude/claude_desktop_config.json) to add the following code, then Save the file.
{
"mcpServers": {
"consul-assistant": {
"command": "npx",
"args": ["-y", "consul-mcp-server"]
}
}
}
if the server is not local host or ACL is enabled, use below configuration instead
{
"mcpServers": {
"consul-assistant": {
"command": "npx",
"args": ["-y", "consul-mcp-server"],
"env": {
"CONSUL_HTTP_ADDR": "http://<host/ip>:8500",
"CONSUL_HTTP_TOKEN": "<ACL Token>"
}
}
}
}
- Restart Claude Desktop to ensure the MCP server is properly loaded.
Example Prompts
Once connected, try these prompts with Claude:
- "Show me all services registered in Consul"
- "Which services have failing health checks?"
- "Create a diagram of my service mesh connections"
- "Analyze which services are having connectivity issues"
- "What's the overall health of my microservices architecture?"
- "Show me services with high error rates in their connections"
Available MCP Actions
This server implements the following MCP actions:
| Action | Description |
|---|---|
consul/get_services | Get a list of all services in Consul |
consul/get_health_checks | Get health checks, optionally filtering for failing checks |
consul/get_service_connections | Get service connections and their status |
consul/create_service_diagram | Create a Mermaid diagram of service relationships |
consul/analyze_service | Analyze a specific service to identify issues |
consul/get_service_metrics | Get detailed metrics for a specific service |
Running a Demo Environment
For testing purposes, you can set up a local demo environment with multiple microservices registered in Consul:
# Run the setup script (requires Docker and Docker Compose)
chmod +x ./demo/setup-demo.sh
./demo/setup-demo.sh
This will start:
- A Consul server
- Several demo microservices
- Register the services in Consul
- Set up some service mesh connections and health checks
Demo Walkthrough
-
Start the demo environment:
./scripts/setup-demo.sh -
Start the MCP server:
npm start -
Connect Claude Desktop or Cursor to your MCP server
-
Try these demo scenarios:
a. Get a service overview:
Show me all the services registered in my Consul instance.b. Check for failing health checks:
Are any services experiencing health issues? What might be causing them?c. Create a service mesh diagram:
Create a diagram showing the connections between my services.d. Analyze connection issues:
Which services are having trouble connecting to each other?e. Get recommendations:
Based on my service mesh setup, what improvements would you recommend?
Development
Project Structure
src/index.ts: Main entry pointsrc/resources/: Consul API interaction codesrc/tools/: Helper functionality like diagram generationsrc/server/: MCP server componentssrc/mcp/: MCP action definitions and handlerssrc/prompts/: Template management for AI interactionssrc/tests/: Test suites
Running Tests
npm test
Building
npm run build
Contributing
Contributions are welcome! Please feel free to submit a pull request.
License
MIT
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.