MCP Server for Oracle Cloud Infrastructure (OCI)
This project implements a Model Context Protocol (MCP) server for Oracle Cloud Infrastructure, allowing LLMs like Claude to interact directly with OCI resources.
Features
Dynamic Profile Selection: Switch between OCI profiles/tenancies without restarting the server
Connection to Oracle Cloud using standard OCI CLI configuration
Comprehensive tools to list and manage OCI resources
Instance lifecycle management (start, stop)
Database Systems and DB Nodes management
Integration with the MCP protocol to facilitate access from Claude Desktop
Prerequisites
Python 3.10 or higher
OCI CLI configured (
oci setup config
)Appropriate permissions in Oracle Cloud
Installation
Clone this repo
Usage
Starting the Server
Option 1: Dynamic Profile Selection (Recommended)
Start without a profile and select it at runtime:
Then use the MCP tools to manage profiles:
list_oci_profiles
- See available profiles from ~/.oci/configset_oci_profile
- Activate a specific profileget_current_oci_profile
- Check which profile is active
Option 2: With Default Profile
Start with a specific profile pre-loaded:
With uv
:
Switching Between Tenancies
You can switch between different OCI tenancies without restarting:
Configuration for Claude Desktop (MacOS)
Add this configuration to your file:
/Users/<usuario>/Library/Application Support/Claude/claude_desktop_config.json
With dynamic profile selection (recommended):
With fixed profile:
With
๐ Available MCP Tools
Profile Management ๐
list_oci_profiles
- List all available OCI profiles from ~/.oci/configset_oci_profile
- Activate a specific profile for API callsget_current_oci_profile
- Show currently active profile
Identity & Access Management
list_compartments
- List all compartments accessible to you
Compute Resources
list_instances
- List virtual machine instances in a compartmentget_instance
- Get detailed information about a specific instancestart_instance
- Start a stopped instancestop_instance
- Stop a running instance (supports soft/force stop)
Database Systems ๐ฅ
list_db_systems
- List DB Systems in a compartmentget_db_system
- Get detailed DB System informationlist_db_nodes
- List DB Nodes in a compartment (optionally filtered by DB System)get_db_node
- Get detailed DB Node informationstart_db_node
- Start a stopped DB Nodestop_db_node
- Stop a running DB Node (soft or hard stop)reboot_db_node
- Reboot a DB Nodereset_db_node
- Reset (force reboot) a DB Nodesoftreset_db_node
- Soft reset (graceful reboot) a DB Nodestart_db_system
- Start all nodes of a DB Systemstop_db_system
- Stop all nodes of a DB System
๐ก Usage Examples
Profile Management
Compute Instance Management
Database Systems Management
Resource Discovery
๐ Recent Improvements
v1.5 - Dynamic Profile Selection (Latest) ๐ฅ
Multi-tenancy support: Switch between OCI profiles without restarting
New MCP tools:
list_oci_profiles
,set_oci_profile
,get_current_oci_profile
Profile requirement validation in all OCI tools
Optional
--profile
argument (lazy initialization)Complete documentation in
DYNAMIC_PROFILE_SELECTION.md
Updated README with accurate tool listing
v1.4 - Centralized Configuration
Created centralized
config.py
with all configuration constantsEliminated magic numbers throughout the codebase
Improved maintainability and discoverability of configuration values
v1.3 - Async Operations
Removed all blocking
time.sleep()
callsMade all operations truly asynchronous
Improved server responsiveness
v1.2 - Standardized Error Handling
Implemented Hybrid Error Handling Pattern
Technical errors โ raise exceptions
Business states โ return success dictionaries
Comprehensive documentation in
ERROR_HANDLING_PATTERN.md
v1.1 - DRY Principle
Created
mcp_tool_wrapper
decoratorEliminated ~150 lines of repetitive code
Consistent error handling and logging across all tools
v1.0 - Code Cleanup
Removed unused/obsolete files
Cleaned up commented code
Established clean baseline
๐ Documentation
Dynamic Profile Selection Guide - Complete guide for multi-tenancy support
Error Handling Pattern - Developer guide for error handling
Error Handling Examples - Practical examples
๐ค Contributing
Contributions are welcome! The codebase follows these patterns:
Hybrid error handling (raise for technical errors, return dict for business states)
Async operations (no blocking calls)
Centralized configuration (constants in
config.py
)DRY principle (use decorators for common patterns)
๐ License
[Add your license here]
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables LLMs like Claude to interact directly with Oracle Cloud Infrastructure resources, supporting dynamic profile switching between tenancies and comprehensive management of compute instances, database systems, and OCI resources through natural language.