The OCI Compute MCP server provides tools to interact with Oracle Cloud Infrastructure Compute resources, including managing compute instances, images, and performing instance lifecycle operations.
Installation
uvx oracle.oci-compute-mcp-server
Running the Server
STDIO Transport Mode
uvx oracle.oci-compute-mcp-server
HTTP Streaming Transport Mode
ORACLE_MCP_HOST=<hostname/IP address> ORACLE_MCP_PORT=<port number> uvx oracle.oci-compute-mcp-server
The server provides the following tools for managing compute resources:
| Tool Name | Description |
|---|
list_instances | List compute instances in a given compartment |
get_instance | Get detailed information about a specific instance using its OCID |
launch_instance | Create and launch a new compute instance |
terminate_instance | Terminate (delete) a compute instance |
update_instance | Update instance configuration settings |
list_images | List available compute images in a compartment |
get_image | Get detailed information about a specific image using its OCID |
instance_action | Perform lifecycle actions on an instance (start, stop, reboot, etc.) |
Usage Examples
List All Instances
List all compute instances in my compartment
The AI will call the list_instances tool with your compartment OCID to retrieve all instances.
Get Instance Details
Show me details for instance ocid1.instance.oc1.phx.example
Retrieves comprehensive information about a specific instance including state, shape, availability domain, and networking details.
Launch a New Instance
Launch a new VM.Standard.E4.Flex instance with 2 OCPUs and 16GB memory
The AI will construct the appropriate parameters to create a new instance with the specified shape and resources.
Stop the instance ocid1.instance.oc1.phx.example
Performs a graceful shutdown of the specified instance.
Other supported actions:
- Start - Boot a stopped instance
- Reboot - Restart a running instance
- Reset - Force reset an instance
- Softreset - Graceful reset
- Softstop - Graceful shutdown
Update Instance Configuration
Update the display name of instance ocid1.instance.oc1.phx.example to "production-web-server"
Modifies instance metadata and configuration settings.
Working with Images
List all Oracle Linux images in my compartment
Retrieves available compute images that can be used to launch new instances.
Get details for image ocid1.image.oc1.phx.example
Shows image specifications, operating system, and compatibility information.
Terminate an Instance
Terminate instance ocid1.instance.oc1.phx.example
Destructive ActionTerminating an instance is permanent and cannot be undone. Boot volumes may be preserved based on your configuration.
Authentication
The server uses OCI CLI configuration from ~/.oci/config. Ensure you have:
- OCI CLI installed and configured
- Valid API credentials
- Appropriate IAM permissions for compute operations
Required Permissions
Your OCI user or instance principal needs these IAM permissions:
Allow group ComputeAdmins to manage instances in compartment MyCompartment
Allow group ComputeAdmins to manage instance-images in compartment MyCompartment
Allow group ComputeAdmins to use volume-attachments in compartment MyCompartment
Allow group ComputeAdmins to use vnics in compartment MyCompartment
Allow group ComputeAdmins to use subnets in compartment MyCompartment
For read-only access:
Allow group ComputeViewers to inspect instances in compartment MyCompartment
Allow group ComputeViewers to inspect instance-images 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
Instance Lifecycle Management
- List and monitor running instances
- Start/stop instances on schedules
- Reboot instances for maintenance
- Scale compute resources up or down
Deployment Automation
- Launch instances from templates
- Deploy instances across availability domains
- Configure instance shapes and resources
- Apply tags and metadata
Cost Optimization
- Stop unused instances
- Identify idle instances
- Right-size instance shapes
- Monitor instance utilization
Troubleshooting
Authentication Errors
Ensure your OCI CLI is properly configured:
Permission Denied
Verify your IAM policies grant necessary permissions for compute operations.
Instance Not Found
Double-check the instance OCID and ensure it exists in the correct region.
Additional Resources