Skip to main content
The OCI Network Load Balancer MCP server provides tools to interact with Oracle Cloud Infrastructure Network Load Balancer resources, enabling management of load balancers, listeners, backend sets, and backends.

Installation

uvx oracle.oci-network-load-balancer-mcp-server

Running the Server

STDIO Transport Mode

uvx oracle.oci-network-load-balancer-mcp-server

HTTP Streaming Transport Mode

ORACLE_MCP_HOST=<hostname/IP address> ORACLE_MCP_PORT=<port number> uvx oracle.oci-network-load-balancer-mcp-server

Available Tools

The server provides the following tools for managing network load balancers:
Tool NameDescription
list_network_load_balancersList network load balancers in a given compartment
get_network_load_balancerGet detailed information about a network load balancer
list_network_load_balancer_listenersList listeners in a given network load balancer
get_network_load_balancer_listenerGet a listener by name from a network load balancer
list_network_load_balancer_backend_setsList backend sets in a given network load balancer
get_network_load_balancer_backend_setGet a backend set by name from a network load balancer
list_network_load_balancer_backendsList backends in a given backend set and network load balancer
get_network_load_balancer_backendGet a backend by name from a backend set and network load balancer

Usage Examples

List Network Load Balancers

List all network load balancers in my compartment
Retrieves all network load balancers, showing their names, states, IP addresses, and configurations.

Get Load Balancer Details

Show me details for network load balancer ocid1.networkloadbalancer.oc1.phx.example
Retrieves comprehensive information about a specific load balancer including listeners, backend sets, and health status.

Working with Listeners

List all listeners for network load balancer ocid1.networkloadbalancer.oc1.phx.example
Shows all configured listeners (frontend endpoints) including ports, protocols, and backend set associations.
Get details for listener "web-listener" in load balancer ocid1.networkloadbalancer.oc1.phx.example
Displays configuration for a specific listener.

Managing Backend Sets

List all backend sets in network load balancer ocid1.networkloadbalancer.oc1.phx.example
Backend sets are collections of backend servers with health check and load balancing policies.
Show me backend set "app-backends" in load balancer ocid1.networkloadbalancer.oc1.phx.example
Retrieves backend set configuration including health check settings and load balancing policy.

Working with Backends

List all backends in backend set "app-backends" for load balancer ocid1.networkloadbalancer.oc1.phx.example
Shows individual backend servers (instances) in a backend set with their health status.
Get backend "10.0.1.5:8080" from backend set "app-backends" in load balancer ocid1.networkloadbalancer.oc1.phx.example
Retrieves details about a specific backend server.

Understanding Network Load Balancers

What is a Network Load Balancer?

Network Load Balancer is a Layer 4 (TCP/UDP) load balancing service that:
  • Distributes traffic across multiple backend servers
  • Provides high availability and fault tolerance
  • Operates at the connection level
  • Preserves source IP addresses
  • Offers ultra-low latency and high throughput
  • Handles millions of requests per second

Key Components

Listeners
  • Frontend configuration that accepts incoming traffic
  • Defined by protocol (TCP/UDP) and port
  • Routes traffic to backend sets
  • Can have multiple listeners per load balancer
Backend Sets
  • Logical grouping of backend servers
  • Includes health check configuration
  • Defines load balancing policy (e.g., round robin, least connections)
  • Can contain multiple backends
Backends
  • Individual servers (compute instances) that receive traffic
  • Identified by IP address and port
  • Monitored via health checks
  • Can be drain/enabled/disabled individually
Health Checks
  • Monitor backend server health
  • Automatically remove unhealthy backends from rotation
  • Configurable intervals and thresholds
  • Support TCP and HTTP health checks

Network Load Balancer vs Application Load Balancer

Network Load Balancer (Layer 4):
  • TCP/UDP traffic
  • Ultra-low latency
  • Preserves source IP
  • Millions of requests per second
  • Simple connection-based routing
Application Load Balancer (Layer 7):
  • HTTP/HTTPS traffic
  • Content-based routing
  • SSL termination
  • Advanced features (path routing, host-based routing)
  • Web application firewall integration

Authentication

The server uses OCI CLI configuration from ~/.oci/config. Ensure you have:
  1. OCI CLI installed and configured
  2. Valid API credentials
  3. Appropriate IAM permissions for load balancer operations
oci setup config

Required Permissions

Your OCI user or instance principal needs these IAM permissions:
Allow group LoadBalancerAdmins to manage network-load-balancers in compartment MyCompartment
Allow group LoadBalancerAdmins to use subnets in compartment MyCompartment
Allow group LoadBalancerAdmins to use network-security-groups in compartment MyCompartment
Allow group LoadBalancerAdmins to use vnics in compartment MyCompartment
For read-only access:
Allow group LoadBalancerViewers to inspect network-load-balancers in compartment MyCompartment
Security NoticeAll actions are performed with the permissions of the configured OCI CLI profile. We advise:
  • Least-privilege IAM setup
  • Secure credential management
  • Safe network practices
  • Secure logging
  • Never expose secrets in logs or responses

Common Use Cases

High Availability Architecture

  • Distribute traffic across multiple availability domains
  • Automatically route around failed instances
  • Scale backend capacity horizontally
  • Provide fault tolerance for critical applications

Database Load Balancing

  • Load balance database connections
  • Distribute read replicas
  • Handle connection pooling
  • Support active-passive failover

Gaming and Real-Time Applications

  • Ultra-low latency requirements
  • High throughput for concurrent connections
  • Preserve client IP addresses
  • Support UDP protocols

Microservices Architecture

  • Route internal service-to-service traffic
  • Private load balancers for backend services
  • Service discovery and health checking
  • Dynamic scaling of service instances

Best Practices

Health Check Configuration

  • Set appropriate intervals and timeouts
  • Use TCP checks for simple availability
  • Use HTTP checks for application-level health
  • Configure reasonable thresholds to avoid flapping

Backend Management

  • Drain backends before maintenance
  • Monitor backend health status
  • Distribute backends across availability domains
  • Use connection draining for graceful shutdowns

Security

  • Use private load balancers for internal traffic
  • Configure security lists and NSGs
  • Implement backend server authentication
  • Monitor access logs for anomalies

Performance

  • Right-size backend instance shapes
  • Monitor connection counts and latency
  • Use reserved bandwidth when needed
  • Scale backend sets based on load

Monitoring and Troubleshooting

Check Load Balancer Health

Show me details for network load balancer ocid1.networkloadbalancer.oc1.phx.example
Verify the overall state and configuration.

Verify Backend Health

List all backends in backend set "app-backends" for load balancer ocid1.networkloadbalancer.oc1.phx.example
Check which backends are healthy and receiving traffic.

Common Issues

All Backends Unhealthy:
  • Verify health check configuration
  • Ensure backends are running and accessible
  • Check security list/NSG rules allow health check traffic
  • Verify application is responding on health check port
Uneven Traffic Distribution:
  • Check load balancing policy
  • Verify all backends have same weight
  • Ensure backends have similar capacity
  • Check for long-lived connections
Connection Timeouts:
  • Verify listener port and protocol
  • Check backend server timeout settings
  • Ensure network connectivity
  • Review security rules

Additional Resources

Build docs developers (and LLMs) love