Service mesh and discovery
## HashiCorp Consul MCP Server: Service Mesh and Configuration The **HashiCorp Consul MCP Server** integrates service discovery and configuration into Google Antigravity, enabling developers to manage service registration, health checks, and distributed key-value configuration. ### Why Consul MCP? - **Service discovery** - Register and discover services dynamically - **Health checking** - Monitor service health with configurable checks - **Key-value store** - Distributed configuration management - **Service mesh** - Secure service-to-service communication - **Multi-datacenter** - Federated service mesh across datacenters ### Key Features #### 1. Service Registration ```python # Register a service await mcp.call("consul", "register_service", { "name": "api-server", "id": "api-server-1", "port": 8080, "tags": ["production", "v2"], "check": { "http": "http://localhost:8080/health", "interval": "10s", "timeout": "3s" } }) # Discover services services = await mcp.call("consul", "get_services", { "name": "api-server", "passing": True }) for svc in services: print(f"{svc[\"Address\"]}:{svc[\"Port\"]}") ``` #### 2. Key-Value Configuration ```python # Store configuration await mcp.call("consul", "kv_put", { "key": "config/database/host", "value": "db.example.com" }) # Get configuration config = await mcp.call("consul", "kv_get", { "key": "config/database", "recurse": True }) for item in config: print(f"{item[\"Key\"]}: {item[\"Value\"]}") # Watch for changes await mcp.call("consul", "kv_watch", { "key": "config/database", "callback": "on_config_change" }) ``` #### 3. Health Checks ```python # Get health status health = await mcp.call("consul", "health_checks", { "service": "api-server" }) for check in health: print(f"{check[\"Name\"]}: {check[\"Status\"]}") if check["Status"] != "passing": print(f" Output: {check[\"Output\"]}") # Get critical services critical = await mcp.call("consul", "health_state", { "state": "critical" }) ``` #### 4. Service Mesh ```python # Configure intentions await mcp.call("consul", "create_intention", { "source": "web-frontend", "destination": "api-server", "action": "allow" }) # List intentions intentions = await mcp.call("consul", "list_intentions", {}) for intent in intentions: print(f"{intent[\"SourceName\"]} -> {intent[\"DestinationName\"]}: {intent[\"Action\"]}") ``` ### Configuration ```json { "mcpServers": { "consul": { "command": "npx", "args": ["-y", "@anthropic/mcp-consul"], "env": { "CONSUL_HTTP_ADDR": "http://consul.service.consul:8500", "CONSUL_HTTP_TOKEN": "your-consul-token" } } } } ``` ### Use Cases **Service Discovery**: Automatically discover and connect to services. **Configuration Management**: Centralize application configuration with dynamic updates. **Health Monitoring**: Track service health across distributed systems. **Zero-Trust Networking**: Implement service mesh with mTLS. The Consul MCP Server enables dynamic service discovery and configuration.
{
"mcpServers": {
"consul": {
"mcpServers": {
"consul": {
"env": {
"CONSUL_TOKEN": "your-token",
"CONSUL_HTTP_ADDR": "http://localhost:8500"
},
"args": [
"-y",
"consul-mcp-server"
],
"command": "npx"
}
}
}
}
}