mcp-oci
A read-only OCI MCP server for discovering live cloud resources, generating Terraform, and mapping dependencies.
List compartments recursively and list subscribed OCI regions.
Search resources with structured queries or free text.
Enumerate all resources in a compartment.
Fetch detailed attributes for known resource types like VCNs, subnets, and instances, with secrets redacted.
Generate Terraform HCL for a single resource or a whole compartment module.
Build a resource dependency graph with a suggested provisioning order.
Enforce security controls such as compartment/region allowlists and audit logging; all shipped tools are read-only.
Generates Terraform configuration (HCL) for Oracle Cloud Infrastructure resources, including whole-compartment modules and dependency graphs with provisioning order.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-oci List all compartments and generate Terraform for the prod compartment."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-oci
A Model Context Protocol server for Oracle Cloud Infrastructure (OCI). It gives an MCP-capable client (Claude Desktop, Claude Code, Cursor, Copilot, …) the ability to discover live OCI resources, map how they relate, and generate reproducible Terraform — with behaviour controlled entirely by flags.
Think of it as a Playwright-MCP for your cloud: instead of rebuilding infrastructure knowledge by hand, the model can ask "show all VCNs in the prod compartment" and "generate Terraform for this compartment" and get structured, secret-free answers.
Features
Live discovery — compartments, regions, and any resource via OCI Resource Search.
Terraform generation — faithful HCL for known types (VCN, subnet, instance, bucket, compartment) and annotated skeletons for the rest; whole-compartment modules with provider variables.
Dependency graph — nodes/edges plus a suggested provisioning order (dependencies first).
Secrets never reach the model — every payload is redacted before return.
Security flags — access modes, compartment/region allowlists, provisioning gate, dry-run, and JSON audit logging (see below).
Standard auth — OCI config file (
~/.oci/config) or instance principals. No credentials stored by the server.
Related MCP server: oci-mcp-server
Security model
Concern | Flag | Default | Effect |
What can the server do? |
|
| All shipped tools are read-only. |
Which compartments are in scope? |
| (all) | When set, operations on other compartments are refused, and search / fetch results from other compartments are dropped or refused (checked against the resource's real compartment). |
Which regions are reachable? |
| (configured region) | When set, only these regions may be targeted. |
Can it run |
|
| Reserved gate for provisioning (not yet shipped). |
Preview without executing |
|
| For future write tools: validate + log intent without executing. |
Audit trail |
|
| Emits a JSON line to stderr per guarded operation. |
Secret redaction | (always on) | — | Secret-shaped fields are replaced with |
Tools
Discovery (read): list_compartments, list_regions, search_resources, list_compartment_resources, get_resource
Terraform (read): generate_terraform, generate_compartment_terraform, build_dependency_graph
Quickstart — add to your agent
Published on npm as @dockndevai/mcp-oci. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.
Claude Code (CLI)
claude mcp add oci -e OCI_PROFILE="DEFAULT" -e OCI_MODE="read-only" -- npx -y @dockndevai/mcp-ociClaude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"oci": {
"command": "npx",
"args": [
"-y",
"@dockndevai/mcp-oci"
],
"env": {
"OCI_PROFILE": "DEFAULT",
"OCI_MODE": "read-only"
}
}
}
}OpenAI Codex CLI — in ~/.codex/config.toml:
[mcp_servers.oci]
command = "npx"
args = ["-y", "@dockndevai/mcp-oci"]
env = { OCI_PROFILE = "DEFAULT", OCI_MODE = "read-only" }VS Code (GitHub Copilot, Agent mode) — in .vscode/mcp.json:
{
"servers": {
"oci": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@dockndevai/mcp-oci"
],
"env": {
"OCI_PROFILE": "DEFAULT",
"OCI_MODE": "read-only"
}
}
}
}Configure
Point it at a standard OCI config profile. For safety, use an IAM user/policy with
read-only (inspect/read) permissions on the compartments you want the agent to see.
Example prompts
"List all compartments, then show every resource in the
prodcompartment.""Generate Terraform for VCN
ocid1.vcn.oc1..….""Build a dependency graph for compartment
…and tell me the provisioning order."
Run from source (development)
Prefer the published package above. To run from a clone:
npm install
npm run build
node dist/index.js # with the environment variables setDevelop
npm run dev # watch mode
npm test # security policy + terraform generation + graph + redaction
npm run typecheckRoadmap
terraform plan/applyexecution behindread-write/admin+OCI_ALLOW_APPLY.More resource-type mappers (load balancers, databases, DRGs, IAM policies).
Cross-environment drift comparison.
Publishing
This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.
License
MIT
Available Tools
8 toolsbuild_dependency_graphBuild a resource dependency graphBRead-onlyIdempotent
Discover a compartment's resources and return a node/edge dependency graph plus a suggested provisioning order (dependencies first).
Inputs: compartmentId (required).
generate_compartment_terraformGenerate Terraform for a whole compartmentARead-onlyIdempotent
Discover every resource in a compartment and emit a Terraform module (provider variables + one block per resource) to reproduce it. Unrecognised types become annotated skeletons.
Inputs: compartmentId (required).
generate_terraformGenerate Terraform for a resourceARead-onlyIdempotent
Generate a Terraform (HCL) resource block for a single OCI resource by type and OCID. Fetches the resource's attributes and maps them to the matching oci_* resource.
Inputs: ocid (required), resourceType (required), compartmentId.
get_resourceGet resource detailsARead-onlyIdempotent
Fetch detailed attributes for a resource by type and OCID. Known types (Vcn, Subnet, Instance) return full attributes; others return the identifier. Secrets are redacted.
Inputs: ocid (required), resourceType (required), compartmentId.
list_compartment_resourcesList all resources in a compartmentBRead-onlyIdempotent
Enumerate every resource in a compartment (via Resource Search).
Inputs: compartmentId (required).
list_compartmentsList compartmentsARead-onlyIdempotent
List compartments in the tenancy (recursively). Compartments outside the allowlist are filtered out.
Inputs: rootCompartmentId.
list_regionsList subscribed regionsARead-onlyIdempotent
List the regions this tenancy is subscribed to.
Inputs: no named parameters.
search_resourcesSearch resourcesARead-onlyIdempotent
Search tenancy resources using OCI Resource Search. Provide either a structured query (e.g. "query instance resources where displayName =~ 'prod'") or free text.
Inputs: query (required), freeText.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools have distinct purposes, but search_resources and list_compartment_resources both enumerate resources, and generate_compartment_terraform and build_dependency_graph both discover compartment resources, which could cause slight confusion despite clear descriptions.
All tool names follow a consistent snake_case verb_noun pattern (list_*, get_*, search_*, generate_*, build_*), making the set highly predictable and easy to navigate.
With 8 tools, the set is well-scoped for OCI infrastructure discovery and Terraform generation, covering essential operations without unnecessary bloat.
The surface covers discovery, detailed inspection, Terraform generation, and dependency graphing, but lacks direct resource management operations (create/update/delete) and a tool to list all resource types, which could limit some workflows.
Maintenance
Related MCP Connectors
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
CloudOracle - 14-tool multi-cloud compliance MCP: AWS, Azure, GCP posture, IAM, configs.
Authenticated MCP server for ClearPolicy policy and compliance workflows.
Scans remote MCP servers for protocol, security, and TLS issues; exposes scan tools via MCP.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAutomatically discovers and tests MCP services for security vulnerabilities including command injection, SQL injection, SSRF, path traversal, and sensitive data exposure with detailed reports and remediation guidance.1-
- AlicenseNot gradedqualityDmaintenanceEnables natural-language access to Oracle Cloud Infrastructure resources, allowing users to query compute instances, OKE clusters, networking, and Object Storage via MCP tools.MIT
- FlicenseNot gradedqualityBmaintenanceEnables interaction with Oracle Cloud Infrastructure through the MCP protocol. Supports dynamic profile selection and provides 85 tools for managing compute, databases, networking, IAM, storage, load balancers, OKE, monitoring, and cost management.-
- AlicenseAqualityDmaintenanceMCP server for Oracle Cloud Infrastructure (OCI) that exposes Compute, Networking, and Object Storage operations to MCP clients, with support for multiple authentication modes, read-only enforcement, and per-call region overrides.18MIT