Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/oci-faaas-mcp-server/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Copyright (c) 2025 Oracle and/or its affiliates.

The Universal Permissive License (UPL), Version 1.0

Subject to the condition set forth below, permission is hereby granted to any
person obtaining a copy of this software, associated documentation and/or data
(collectively the "Software"), free of charge and under any and all copyright
rights in the Software, and any and all patent rights owned or freely
licensable by each licensor hereunder covering either (i) the unmodified
Software as contributed to or provided by such licensor, or (ii) the Larger
Works (as defined below), to deal in both

(a) the Software, and
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
one is included with the Software (each a "Larger Work" to which the Software
is contributed by such licensors),

without restriction, including without limitation the rights to copy, create
derivative works of, display, perform, and distribute the Software and make,
use, sell, offer for sale, import, export, have made, and have sold the
Software and the Larger Work(s), and to sublicense the foregoing rights on
either these or other terms.

This license is subject to the following condition:
The above copyright notice and either this complete permission notice or at
a minimum a reference to the UPL must be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions src/oci-faaas-mcp-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# OCI Fusion Applications (FAaaS) MCP Server

## Overview

This server provides tools for interacting with Oracle Cloud Infrastructure (OCI) Fusion Applications (FAaaS) via the OCI Python SDK `oci.fusion_apps.FusionApplicationsClient`.

## Running the server

```sh
uv run oracle.oci-faaas-mcp-server
```

## Tools

| Tool Name | Description |
| --- | --- |
| list_fusion_environment_families | List Fusion Environment Families in a compartment |
| list_fusion_environments | List Fusion Environments in a compartment (optionally by family) |
| get_fusion_environment | Get details of a Fusion Environment by OCID |
| get_fusion_environment_status | Get status of a Fusion Environment by OCID |

Notes:
- All list tools handle pagination.
- Responses are converted to plain dictionaries using best-effort conversion of OCI SDK models.

⚠️ NOTE: All actions are performed with the permissions of the configured OCI CLI profile. We advise least-privilege IAM setup, secure credential management, safe network practices, secure logging, and warn against exposing secrets.

## Third-Party APIs

Developers choosing to distribute a binary implementation of this project are responsible for obtaining and providing all required licenses and copyright notices for the third-party code used in order to ensure compliance with their respective open source licenses.

## Disclaimer

Users are responsible for their local environment and credential safety. Different language model selections may yield different results and performance.

## License

Copyright (c) 2025 Oracle and/or its affiliates.

Released under the Universal Permissive License v1.0 as shown at
https://oss.oracle.com/licenses/upl/
5 changes: 5 additions & 0 deletions src/oci-faaas-mcp-server/oracle/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
Copyright (c) 2025, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v1.0 as shown at
https://oss.oracle.com/licenses/upl.
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
Copyright (c) 2025, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v1.0 as shown at
https://oss.oracle.com/licenses/upl.
"""

__project__ = "oracle.oci-faaas-mcp-server"
__version__ = "1.0.0"
215 changes: 215 additions & 0 deletions src/oci-faaas-mcp-server/oracle/oci_faaas_mcp_server/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
"""
Copyright (c) 2025, Oracle and/or its affiliates.
Licensed under the Universal Permissive License v1.0 as shown at
https://oss.oracle.com/licenses/upl.
"""

from datetime import datetime
from typing import Any, Dict, List, Optional

from pydantic import BaseModel, Field


def _oci_to_dict(obj):
"""Best-effort conversion of OCI SDK model objects to plain dicts."""
if obj is None:
return None
try:
from oci.util import to_dict as oci_to_dict

return oci_to_dict(obj)
except Exception:
pass
if isinstance(obj, dict):
return obj
if hasattr(obj, "__dict__"):
return {k: v for k, v in obj.__dict__.items() if not k.startswith("_")}
return None


class FusionEnvironmentFamily(BaseModel):
"""Pydantic model representing a Fusion Environment Family."""

id: Optional[str] = Field(None, description="OCID of the Fusion Environment Family")
display_name: Optional[str] = Field(None, description="Display name")
lifecycle_state: Optional[str] = Field(
None,
description="Lifecycle state (e.g., CREATING, UPDATING, ACTIVE, DELETING, DELETED, FAILED)",
)
compartment_id: Optional[str] = Field(
None, description="Compartment OCID containing this family"
)
time_created: Optional[datetime] = Field(
None, description="Creation time (RFC3339)"
)
time_updated: Optional[datetime] = Field(
None, description="Last update time (RFC3339)"
)
freeform_tags: Optional[Dict[str, str]] = Field(None, description="Freeform tags")
defined_tags: Optional[Dict[str, Dict[str, Any]]] = Field(
None, description="Defined tags"
)


class FusionEnvironment(BaseModel):
"""Pydantic model representing a Fusion Environment."""

id: Optional[str] = Field(None, description="OCID of the Fusion Environment")
display_name: Optional[str] = Field(None, description="Display name")
compartment_id: Optional[str] = Field(
None, description="Compartment OCID containing the environment"
)
fusion_environment_family_id: Optional[str] = Field(
None, description="OCID of the parent Fusion Environment Family"
)
fusion_environment_type: Optional[str] = Field(
None, description="Environment type (e.g., PRODUCTION, TEST)"
)
version: Optional[str] = Field(None, description="Fusion Apps version (e.g., 25C)")
public_url: Optional[str] = Field(None, description="Primary public URL")
idcs_domain_url: Optional[str] = Field(None, description="IDCS domain URL")
domain_id: Optional[str] = Field(None, description="IDCS domain OCID")

lifecycle_state: Optional[str] = Field(None, description="Lifecycle state")
lifecycle_details: Optional[str] = Field(
None, description="Additional lifecycle details"
)
is_suspended: Optional[bool] = Field(None, description="Suspended flag")
system_name: Optional[str] = Field(None, description="System name/code")
environment_role: Optional[str] = Field(None, description="Environment role")

maintenance_policy: Optional[Dict[str, Any]] = Field(
None, description="Maintenance policy details"
)
time_upcoming_maintenance: Optional[datetime] = Field(
None, description="Upcoming maintenance window (RFC3339)"
)
applied_patch_bundles: Optional[List[str]] = Field(
None, description="Applied patch bundles"
)

subscription_ids: Optional[List[str]] = Field(
None, description="Associated subscription OCIDs"
)
additional_language_packs: Optional[List[str]] = Field(
None, description="Enabled language packs"
)

kms_key_id: Optional[str] = Field(None, description="KMS key OCID")
kms_key_info: Optional[Dict[str, Any]] = Field(None, description="KMS key info")

dns_prefix: Optional[str] = Field(None, description="DNS prefix")
lockbox_id: Optional[str] = Field(None, description="Lockbox OCID")
is_break_glass_enabled: Optional[bool] = Field(
None, description="Break glass access enabled"
)

refresh: Optional[Any] = Field(None, description="Refresh details")
rules: Optional[List[Any]] = Field(None, description="Rules")
time_created: Optional[datetime] = Field(
None, description="Creation time (RFC3339)"
)
time_updated: Optional[datetime] = Field(
None, description="Last update time (RFC3339)"
)

freeform_tags: Optional[Dict[str, Any]] = Field(None, description="Freeform tags")
defined_tags: Optional[Dict[str, Dict[str, Any]]] = Field(
None, description="Defined tags"
)


class FusionEnvironmentStatus(BaseModel):
"""Pydantic model representing the status of a Fusion Environment."""

fusion_environment_id: Optional[str] = Field(
None, description="OCID of the Fusion Environment"
)
status: Optional[str] = Field(None, description="Status value")
time_updated: Optional[datetime] = Field(
None, description="Last status update time (RFC3339)"
)
time_created: Optional[datetime] = Field(
None, description="Creation time if present (RFC3339)"
)
details: Optional[Dict[str, Any]] = Field(
None, description="Additional status details"
)


def _get(data: Any, key: str) -> Any:
"""Safe getter to support both dicts and SDK objects."""
if isinstance(data, dict):
return data.get(key)
return getattr(data, key, None)


def map_fusion_environment_family(data: Any) -> FusionEnvironmentFamily:
"""Map SDK model or dict to FusionEnvironmentFamily."""
return FusionEnvironmentFamily(
id=_get(data, "id"),
display_name=_get(data, "display_name"),
lifecycle_state=_get(data, "lifecycle_state"),
compartment_id=_get(data, "compartment_id"),
time_created=_get(data, "time_created"),
time_updated=_get(data, "time_updated"),
freeform_tags=_get(data, "freeform_tags"),
defined_tags=_get(data, "defined_tags"),
)


def map_fusion_environment(data: Any) -> FusionEnvironment:
"""Map SDK model or dict to FusionEnvironment."""
return FusionEnvironment(
id=_get(data, "id"),
display_name=_get(data, "display_name"),
compartment_id=_get(data, "compartment_id"),
fusion_environment_family_id=_get(data, "fusion_environment_family_id"),
fusion_environment_type=_get(data, "fusion_environment_type"),
version=_get(data, "version"),
public_url=_get(data, "public_url"),
idcs_domain_url=_get(data, "idcs_domain_url"),
domain_id=_get(data, "domain_id"),
lifecycle_state=_get(data, "lifecycle_state"),
lifecycle_details=_get(data, "lifecycle_details"),
is_suspended=_get(data, "is_suspended"),
system_name=_get(data, "system_name"),
environment_role=_get(data, "environment_role"),
maintenance_policy=_get(data, "maintenance_policy"),
time_upcoming_maintenance=_get(data, "time_upcoming_maintenance"),
applied_patch_bundles=_get(data, "applied_patch_bundles"),
subscription_ids=_get(data, "subscription_ids"),
additional_language_packs=_get(data, "additional_language_packs"),
kms_key_id=_get(data, "kms_key_id"),
kms_key_info=_get(data, "kms_key_info"),
dns_prefix=_get(data, "dns_prefix"),
lockbox_id=_get(data, "lockbox_id"),
is_break_glass_enabled=_get(data, "is_break_glass_enabled"),
refresh=_get(data, "refresh"),
rules=_get(data, "rules"),
time_created=_get(data, "time_created"),
time_updated=_get(data, "time_updated"),
freeform_tags=_get(data, "freeform_tags"),
defined_tags=_get(data, "defined_tags"),
)


def map_fusion_environment_status(data: Any) -> FusionEnvironmentStatus:
"""Map SDK model or dict to FusionEnvironmentStatus."""
# Some SDK responses may not have fusion_environment_id as key; try id as fallback
fe_id = _get(data, "fusion_environment_id") or _get(data, "id")
# Anything else goes to details as a dict (best-effort)
coerced = _oci_to_dict(data) or {}
details = {
k: v
for k, v in coerced.items()
if k
not in {"fusion_environment_id", "id", "status", "time_updated", "time_created"}
} # noqa: E501
return FusionEnvironmentStatus(
fusion_environment_id=fe_id,
status=_get(data, "status"),
time_updated=_get(data, "time_updated"),
time_created=_get(data, "time_created"),
details=details or None,
)
Loading