Installation
Running the Server
STDIO Transport Mode
HTTP Streaming Transport Mode
Available Tools
The server provides generic tools for SDK operations:| Tool Name | Description |
|---|---|
invoke_oci_api | Invoke an OCI Python SDK API via client and operation name |
list_client_operations | List public callable operations for a given OCI client class |
Tool Details
invoke_oci_api
Invoke any OCI SDK operation by specifying the client class and operation name. Parameters:client_fqn(required) - Fully-qualified client class name (e.g.,oci.core.ComputeClient)operation(required) - Client method/operation name (e.g.,list_instances)params(required) - JSON object of keyword arguments as expected by the SDK method
list_client_operations
Discover available operations for an OCI client. Parameters:client_fqn(required) - Fully-qualified client class name (e.g.,oci.identity.IdentityClient)
Usage Examples
List Compute Instances
invoke_oci_api with:
- client_fqn:
oci.core.ComputeClient - operation:
list_instances - params:
{"compartment_id": "ocid1.compartment.oc1..example"}
Create a VCN
oci.core.VirtualNetworkClient and create_vcn operation.
Discover Operations
list_client_operations with client_fqn: "oci.identity.IdentityClient".
Complex Model Parameters
CreateVcnDetails) from the provided JSON parameters.
Understanding the OCI SDK
What is the OCI SDK?
The OCI Python SDK provides programmatic access to Oracle Cloud Infrastructure:- Comprehensive - Covers all OCI services
- Type-Safe - Strongly typed models
- Well-Documented - Extensive docstrings
- Maintained - Regularly updated by Oracle
- Pythonic - Follows Python conventions
SDK Structure
Clients- Service-specific clients (e.g., ComputeClient, VirtualNetworkClient)
- Handle authentication and API requests
- Provide operation methods
- Data transfer objects
- Request/response models
- Configuration objects
- Automatic pagination for list operations
- Iterator-based result handling
Common Client Classes
Compute & Storageoci.core.ComputeClient- Compute instancesoci.core.BlockstorageClient- Block volumesoci.object_storage.ObjectStorageClient- Object storage
oci.core.VirtualNetworkClient- VCNs, subnets, securityoci.load_balancer.LoadBalancerClient- Load balancersoci.network_load_balancer.NetworkLoadBalancerClient- Network LB
oci.database.DatabaseClient- Database services
oci.identity.IdentityClient- IAM operations
oci.monitoring.MonitoringClient- Metrics and alarmsoci.logging.LoggingManagementClient- Loggingoci.cloud_guard.CloudGuardClient- Cloud Guard
Passing Complex Model Parameters
Many OCI SDK operations expect complex model instances (e.g.,CreateVcnDetails) rather than raw dictionaries.
Automatic Model Construction
The server automatically constructs SDK model objects from JSON parameters using heuristics: Parameter name patterns:- Ends with
_details(e.g.,create_vcn_details) - Ends with
_config - Ends with
_configuration - Ends with
_source_details
oci.core.models.CreateVcnDetails automatically.
Verb-Prefixed Parameters
Forcreate_* and update_* operations, if the parameter is named like vcn_details (missing the verb), the server will try CreateVcnDetails/UpdateVcnDetails automatically.
Explicit Model Hints
You can provide explicit type hints:__model - Simple class name in the client’s models module:
__model_fqn - Fully-qualified class name:
Nested Model Construction
Nested dictionaries and lists are recursively coerced to appropriate model types.Authentication and Configuration
The server uses the same configuration as the OCI CLI:- Loads configuration from
~/.oci/config(or the profile specified byOCI_CONFIG_PROFILE) - Adds an additional user-agent suffix for MCP telemetry
- Prefers Security Token Signer when
security_token_fileis available - Falls back to API key signer otherwise
Required Permissions
Permissions depend on the specific SDK operations being invoked. Use least-privilege IAM policies: Example:Common Use Cases
Service Exploration
- Discover available operations for any service
- Experiment with SDK functionality
- Prototype integrations
- Learn SDK capabilities
Flexible Automation
- Access services without dedicated MCP servers
- Build custom workflows
- Integrate multiple services
- Prototype before building specialized tools
Advanced Operations
- Perform operations not covered by specialized servers
- Access new SDK features immediately
- Use preview/beta services
- Execute complex multi-service workflows
Development & Testing
- Test SDK calls interactively
- Validate parameter formats
- Debug API interactions
- Build SDK knowledge
Best Practices
Client Selection
- Use correct fully-qualified client name
- Verify client exists in OCI SDK
- Check SDK documentation for operations
Parameter Construction
- Follow SDK parameter naming conventions
- Use snake_case for parameter names
- Provide all required parameters
- Include optional parameters as needed
Error Handling
- Check SDK documentation for exceptions
- Validate OCIDs and formats
- Handle pagination for list operations
- Review error messages carefully
Performance
- Be aware that the server auto-paginates list operations
- Use appropriate filtering parameters
- Limit result sets when possible
- Cache results if making repeated calls
Troubleshooting
Client Not Found
Error: No module named ‘oci.xyz’- Verify client class name is correct
- Check OCI SDK documentation
- Ensure SDK version supports the service
Operation Not Found
Error: Client has no attribute ‘xyz’- Use
list_client_operationsto see available operations - Check spelling and case
- Verify operation exists for that client
Invalid Parameters
Error: Missing required parameter / Invalid value- Check SDK documentation for required parameters
- Verify parameter names match SDK expectations
- Ensure OCIDs are valid
- Check data types (string vs int, etc.)
Model Construction Fails
Error: Cannot construct model- Provide explicit
__modelor__model_fqn - Check model class exists
- Verify all required model fields are provided
- Review SDK model documentation
Permission Errors
Error: NotAuthorizedOrNotFound- Verify IAM policies grant required permissions
- Check you’re using correct compartment
- Ensure resource exists
- Confirm authentication is valid
Advantages Over Specialized Servers
Flexibility- Access any OCI service immediately
- No need to wait for specialized server updates
- Experiment with new features
- Full SDK coverage
- All operations available
- No feature gaps
- No abstraction layer
- Complete control over parameters
- Access to all SDK capabilities
When to Use Specialized Servers
Consider using service-specific MCP servers when:- You need simpler, more intuitive interfaces
- Operations are frequently performed
- You want higher-level abstractions
- Pre-built workflows are valuable
Related Services
- OCI API - CLI-based access
- All specialized OCI servers - Service-specific tools
