Skip to main content
Glama
sauryadas

oci-mcp-server

by sauryadas
README.md
# OCI MCP Server

An [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that gives Claude and other LLM clients natural-language access to Oracle Cloud Infrastructure resources.

Ask questions like:
- *"List all running compute instances in my prod compartment"*
- *"What OKE clusters do we have, and which Kubernetes versions are they on?"*
- *"Show me the subnets in our main VCN"*
- *"Which Object Storage buckets are in the analytics compartment?"*

## Covered Services

| Service | Tools |
|---|---|
| **Identity** | `get_tenancy`, `list_compartments`, `list_regions`, `list_availability_domains` |
| **Compute** | `list_instances`, `get_instance`, `list_shapes` |
| **Networking** | `list_vcns`, `list_subnets`, `list_security_lists`, `list_internet_gateways` |
| **Object Storage** | `get_object_storage_namespace`, `list_buckets`, `list_objects`, `get_bucket` |
| **OKE** | `list_oke_clusters`, `get_oke_cluster`, `list_node_pools`, `list_cluster_options` |

## Prerequisites

- Python 3.10+
- OCI CLI configured (`~/.oci/config`) — [setup guide](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm)
- An OCI user with at minimum `read` permissions on the resources you want to query

## Installation

```bash
git clone https://github.com/sauryadas/oci-mcp-server
cd oci-mcp-server
pip install -e .
```

Verify it starts cleanly:
```bash
python server.py
```

## Configuration

The server reads your OCI credentials from `~/.oci/config` (the same file used by the OCI CLI). To use a non-default profile or config path, set environment variables before starting the server:

```bash
export OCI_CLI_PROFILE=MY_PROFILE          # default: DEFAULT
export OCI_CLI_CONFIG_FILE=~/.oci/config   # default: ~/.oci/config
```

## Connect to Claude Desktop

Add the following to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):

```json
{
  "mcpServers": {
    "oci": {
      "command": "python",
      "args": ["/Users/<you>/projects/oci-mcp-server/server.py"]
    }
  }
}
```

Restart Claude Desktop and you'll see the OCI tools available in the tool picker.

## Connect to Claude Code

```bash
claude mcp add oci -- python /Users/<you>/projects/oci-mcp-server/server.py
```

## Example Prompts

```
What compartments do I have in my tenancy?

List all RUNNING instances in compartment ocid1.compartment.oc1..xxx

Show me the OKE clusters in my dev compartment and what Kubernetes versions they're running.

What subnets are in VCN ocid1.vcn.oc1..xxx ?

List the Object Storage buckets in my analytics compartment.
```

## Project Structure

```
oci-mcp-server/
├── server.py          # MCP server entry point
├── pyproject.toml
└── tools/
    ├── base.py        # shared OCI client initialisation
    ├── identity.py    # tenancy, compartments, regions
    ├── compute.py     # instances, shapes
    ├── networking.py  # VCNs, subnets, security lists
    ├── storage.py     # Object Storage buckets & objects
    └── containers.py  # OKE clusters & node pools
```

## Roadmap

- [ ] Database service (Autonomous DB, MySQL HeatWave)
- [ ] IAM policies and groups
- [ ] Resource tagging and search across compartments
- [ ] Instance action support (start/stop) with confirmation prompts
- [ ] Oracle Alloy operator-tier views

## License

MIT