etcd MCP Server

April 15, 2025 ยท View on GitHub

A Model Context Protocol (MCP) server for interacting with etcd key-value store. This server provides a consistent interface for AI assistants like Claude to access and manipulate data in your etcd server.

Features

  • Connect to etcd server with v2 or v3 API
  • Key-value operations (get, put, delete)
  • Directory/prefix operations
  • Tree visualization of etcd keys
  • Authentication support
  • TLS support

Installation

  1. Create a Python virtual environment:
cd mcp-etcd
uv venv venv
source venv/bin/activate  # or source venv/bin/activate.fish for fish shell
  1. Install required packages:
# Inside the virtual environment
uv pip install python-etcd mcp

Usage

Starting the server

# Inside the virtual environment
python etcd_mcp_server_v2.py --host <etcd-host> --port <etcd-port>

Available options:

  • --host: etcd server host (default: localhost)
  • --port: etcd server port (default: 2379)
  • --protocol: http or https (default: http)
  • --user: Username for authentication
  • --password: Password for authentication
  • --transport: MCP transport method (stdio, tcp, ws)
  • --tcp-port: TCP port for MCP server
  • --ws-port: WebSocket port for MCP server

Integration with AI Assistants

Integration with Claude

Currently, the server can only be connected to Claude AI assistant. Integration with Cursor is not working reliably yet.

To configure Claude to use the etcd MCP server, add the following to your Claude desktop configuration file (~/.claude_desktop_config.json):

{
  "mcpServers": {
    "mcp-etcd": {
      "command": "bash",
      "args": [
        "-c",
        "cd /path/to/mcp-etcd && source venv/bin/activate && python etcd_mcp_server_v2.py --host <etcd-host>"
      ]
    }
  }
}

Replace /path/to/mcp-etcd with the actual path to your mcp-etcd directory and <etcd-host> with your etcd server address.

After configuring, restart Claude and use the MCP server with:

/mcp mcp-etcd get_tree
/mcp mcp-etcd get "/your/key"
/mcp mcp-etcd put "/your/key" "value"

Available Commands

  • get(key): Get value of a specific key
  • put(key, value, ttl=None): Store a value under a key
  • delete(key, recursive=False, dir=False): Delete a key or directory
  • get_directory(directory, recursive=False): Get all key-value pairs in a directory
  • get_all(): Get all key-value pairs from root
  • get_tree(separator="/"): Get hierarchical tree view of keys
  • mkdir(directory, ttl=None): Create a directory
  • get_leader(): Get information about etcd cluster leader
  • get_self_stats(): Get statistics about current etcd instance
  • get_store_stats(): Get statistics about etcd store

Troubleshooting

If you encounter connection issues:

  1. Verify etcd server is running and accessible
  2. Check the correct protocol version (v2 or v3) is being used
  3. Ensure authentication credentials are correct
  4. Check for any network restrictions or firewall rules

License

This project is released under the MIT License.