npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

consul-mcp-server

v0.1.2

Published

MCP Server for Consul service discovery and service mesh

Readme

Consul 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_ADDR=http://localhost:8500
PORT=3000
USE_HTTP=true
  • CONSUL_ADDR: Address of your Consul server
  • PORT: Port for the HTTP server
  • USE_HTTP: Set to "true" for HTTP mode, omit for stdio mode

Installation

Installing in Cursor

To install and use this MCP server in Cursor:

  1. In Cursor, open Settings (⌘+,) and navigate to the "MCP" tab.

  2. Click "+ Add new MCP server."

  3. Enter the following:

    • Name: consul-assistant
    • Type: command
    • Command: npx -y consul-mcp-server
  4. Click "Add" then scroll to the server and click "Disabled" to enable the server.

  5. 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:

  1. In Claude Desktop, open Settings (⌘+,) and navigate to the "Developer" tab.

  2. Click "Edit Config" at the bottom of the window.

  3. 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"]
    }
  }
}
  1. 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

  1. Start the demo environment:

    ./scripts/setup-demo.sh
  2. Start the MCP server:

    npm start
  3. Connect Claude Desktop or Cursor to your MCP server

  4. 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 point
  • src/resources/: Consul API interaction code
  • src/tools/: Helper functionality like diagram generation
  • src/server/: MCP server components
  • src/mcp/: MCP action definitions and handlers
  • src/prompts/: Template management for AI interactions
  • src/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