OCI MCP Server
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.
README
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
pip install git+https://github.com/modelcontextprotocol/python-sdk.git
pip install oci fastapi uvicorn click pydantic loguru
pip install -e .
Usage
Starting the Server
Option 1: Dynamic Profile Selection (Recommended)
Start without a profile and select it at runtime:
python -m mcp_server_oci.mcp_server
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:
python -m mcp_server_oci.mcp_server --profile DEFAULT
With uv:
uv --directory /path/to/mcp-server-oci run python -m mcp_server_oci.mcp_server --profile DEFAULT
Switching Between Tenancies
You can switch between different OCI tenancies without restarting:
# In your MCP client (e.g., Claude):
# 1. List available profiles
"Show me available OCI profiles"
# 2. Switch to a different tenancy
"Switch to the 'production' OCI profile"
# 3. Verify current profile
"What OCI profile am I using?"
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):
"mcpServers": {
"mcp-server-oci": {
"command": "python",
"args": [
"-m",
"mcp_server_oci.mcp_server"
],
"env": {
"PYTHONPATH": "/<PATH_TO_MCP>/mcp-server-oci",
"FASTMCP_LOG_LEVEL": "INFO"
}
}
}
With fixed profile:
"mcpServers": {
"mcp-server-oci": {
"command": "python",
"args": [
"-m",
"mcp_server_oci.mcp_server",
"--profile", "DEFAULT"
],
"env": {
"PYTHONPATH": "/<PATH_TO_MCP>/mcp-server-oci",
"FASTMCP_LOG_LEVEL": "INFO"
}
}
}
With uv and dynamic profiles:
"mcpServers": {
"mcp-server-oci": {
"command": "uv",
"args": [
"--directory",
"/<PATH_TO_MCP>/mcp-server-oci",
"run",
"python",
"-m",
"mcp_server_oci.mcp_server"
],
"env": {
"FASTMCP_LOG_LEVEL": "INFO"
}
}
}
📋 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
# From Claude or any MCP client:
# List available profiles
"Show me all available OCI profiles"
# Activate a specific profile
"Set the OCI profile to 'production'"
# Check current profile
"What OCI profile am I currently using?"
# Switch between tenancies
"Switch to the DEFAULT profile"
Compute Instance Management
# List instances
"Show me all compute instances in compartment ocid1.compartment.oc1..."
# Get instance details
"Get details for instance ocid1.instance.oc1..."
# Start/stop instances
"Start the instance ocid1.instance.oc1..."
"Stop the instance ocid1.instance.oc1... with force stop"
Database Systems Management
# List DB Systems
"Show me all DB Systems in compartment ocid1.compartment.oc1..."
# Get DB System details
"Get details for DB System ocid1.dbsystem.oc1..."
# Manage DB Nodes
"List all DB Nodes for DB System ocid1.dbsystem.oc1..."
"Start DB Node ocid1.dbnode.oc1..."
"Stop all nodes of DB System ocid1.dbsystem.oc1..."
# Reboot operations
"Reboot DB Node ocid1.dbnode.oc1..."
"Soft reset DB Node ocid1.dbnode.oc1..."
Resource Discovery
# List compartments
"List all compartments in my tenancy"
# Cross-resource queries
"Show me all running instances in compartment X"
"List all DB Systems and their current states"
🚀 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
--profileargument (lazy initialization) - Complete documentation in
DYNAMIC_PROFILE_SELECTION.md - Updated README with accurate tool listing
v1.4 - Centralized Configuration
- Created centralized
config.pywith all configuration constants - Eliminated magic numbers throughout the codebase
- Improved maintainability and discoverability of configuration values
v1.3 - Async Operations
- Removed all blocking
time.sleep()calls - Made 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_wrapperdecorator - Eliminated ~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]
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。