mcp-oci
mcp-oci
一个用于 Oracle Cloud Infrastructure (OCI) 的 Model Context Protocol 服务器。它让支持 MCP 的客户端(Claude Desktop、Claude Code、Cursor、Copilot 等)能够发现实时 OCI 资源、映射资源之间的关联关系,并生成可复现的 Terraform——所有行为完全由标志位控制。
可以把它想象成针对你云环境的 Playwright-MCP:模型无需手动重建基础设施知识,而是可以直接询问*"显示 prod compartment 中的所有 VCN"或"为这个 compartment 生成 Terraform"*,并获得结构化、不含机密信息的答案。
功能特性
实时发现 — 通过 OCI Resource Search 发现 compartments、regions 以及任意资源。
Terraform 生成 — 为已知类型(VCN、subnet、instance、bucket、compartment)生成忠实的 HCL,为其余类型生成带注释的骨架;支持包含 provider 变量的整个 compartment 模块。
依赖关系图 — 节点/边以及建议的置备顺序(依赖优先)。
机密信息永不触达模型 — 每个返回的负载在返回前都会被脱敏。
安全标志 — 访问模式、compartment/region 白名单、置备门控、dry-run 以及 JSON 审计日志(见下文)。
标准认证 — OCI 配置文件(
~/.oci/config)或实例主体。服务器不存储任何凭据。
Related MCP server: oci-mcp-server
安全模型
关注点 | 标志 | 默认值 | 效果 |
服务器能做什么? |
|
| 所有随附工具均为只读。 |
哪些 compartments 在范围内? |
| (全部) | 设置后,对其他 compartments 的操作将被拒绝。 |
哪些 regions 可访问? |
| (已配置的 region) | 设置后,仅允许针对这些 regions。 |
能否运行 |
|
| 置备功能的保留门控(尚未发布)。 |
预览而不执行 |
|
| 供未来的写入工具使用:验证并记录意图,但不执行。 |
审计追踪 |
|
| 每次受保护操作都会向 stderr 输出一行 JSON。 |
机密脱敏 | (始终开启) | — | 任何结果返回前,形似机密的字段都会被替换为 |
工具
发现(只读):list_compartments、list_regions、search_resources、list_compartment_resources、get_resource
Terraform(只读):generate_terraform、generate_compartment_terraform、build_dependency_graph
快速开始 — 添加到你的 agent
已发布到 npm,包名为 @dockndevai/mcp-oci。无需克隆或构建——你的 MCP 客户端可通过 npx 按需运行。以 read-only 模式开始;所有变量请参阅 .env.example,完整的各客户端指南请参阅 docs/CLIENTS.md。
Claude Code(CLI)
claude mcp add oci -e OCI_PROFILE="DEFAULT" -e OCI_MODE="read-only" -- npx -y @dockndevai/mcp-ociClaude Desktop · Cursor · Windsurf — 将相同的配置块放入 claude_desktop_config.json、.cursor/mcp.json 或 ~/.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 — 放入 ~/.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 模式) — 放入 .vscode/mcp.json:
{
"servers": {
"oci": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@dockndevai/mcp-oci"
],
"env": {
"OCI_PROFILE": "DEFAULT",
"OCI_MODE": "read-only"
}
}
}
}配置
将其指向标准的 OCI 配置 profile。为安全起见,请使用具有你希望 agent 访问的 compartments 的只读(inspect/read)权限的 IAM 用户/策略。
示例提示词
"列出所有 compartments,然后显示
prodcompartment 中的每个资源。""为 VCN
ocid1.vcn.oc1..…生成 Terraform。""为 compartment
…构建依赖关系图,并告诉我置备顺序。"
从源码运行(开发)
优先使用上面发布的包。要从克隆的仓库运行:
npm install
npm run build
node dist/index.js # with the environment variables set开发
npm run dev # watch mode
npm test # security policy + terraform generation + graph + redaction
npm run typecheck路线图
在
read-write/admin+OCI_ALLOW_APPLY之后支持执行terraform plan/apply。更多资源类型映射器(负载均衡器、数据库、DRG、IAM 策略)。
跨环境漂移对比。
发布
该服务器附带一个 server.json 用于官方 MCP 注册表,以及一个 mcpName 用于 npm 所有权验证。发布到 npm 并在 MCP 注册表、Smithery、Glama、Cursor 和 PulseMCP 上架,请参阅 PUBLISHING.md。
许可证
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.
IaC, CI and dependency security review for coding agents: local scan CLI plus hosted OAuth MCP.
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