Skip to content

Conversation

@pranjalj-oracle
Copy link
Member

@pranjalj-oracle pranjalj-oracle commented Nov 26, 2025

Description

Onboard FAaaS MCP server to OCI GitHub MCP server repo.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Run tools with Cline

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Start MCP server in Local (uv run --project /Users/pranjaljain/mcp/src/oc
    i-faaas-mcp-server oracle.oci-faaas-mcp-server)
  • Configured Cline to connect with MCP server using below configuration
{
 "mcpServers": {
   "oracle-oci-faaas-mcp-server": {
     "disabled": false,
     "timeout": 60,
     "type": "stdio",
     "command": "uv",
     "args": [
       "run",
       "--project",
       "/Users/pranjaljain/mcp/src/oci-faaas-mcp-server",
       "oracle.oci-faaas-mcp-server"
     ],
     "env": {
       "OCI_CONFIG_PROFILE": "DEFAULT"
     }
   }
 }
}
  • Pass below query from cline terminal use mcp server oracle-oci-faaas-mcp-server list all active fusion environment family in compartment ocid1.tenancy.oc1..aaaaaaaanimrctwugowtycboykfe7rfw6q2rqntwk5nor3uukx3znfbsq7da
  • Result
image

Test Configuration:

  • Firmware version:
  • Hardware:
  • Toolchain:
  • SDK:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Nov 26, 2025
@pranjalj-oracle pranjalj-oracle changed the title FAaaS MCP server [WIP]FAaaS MCP server Nov 26, 2025
@pranjalj-oracle pranjalj-oracle force-pushed the pranjalj/faaasMcpServer branch 5 times, most recently from f42cc4b to fc2ae92 Compare December 1, 2025 19:02
@pranjalj-oracle pranjalj-oracle changed the title [WIP]FAaaS MCP server FAaaS MCP server Dec 1, 2025
@pranjalj-oracle pranjalj-oracle force-pushed the pranjalj/faaasMcpServer branch from fc2ae92 to 7bb5de2 Compare December 2, 2025 05:38
@shopewf
Copy link
Member

shopewf commented Dec 9, 2025

You could generate models for this server by checking how its done in the BEST_PRACTICES.md doc

@pranjalj-oracle
Copy link
Member Author

You could generate models for this server by checking how its done in the BEST_PRACTICES.md doc

generated and added.

@shopewf
Copy link
Member

shopewf commented Dec 12, 2025

Hey in my first tests, I passed in all the parameters so things succeeded, but I just tested it again without passing in the optional parameters and there are a few issues:

  1. The optional parameters need to be defined differently in the annotations for the tools. Check the best practices doc that we have for how to do it, or refer to the compute server. Pydantic Field's should be used.
  2. Some optional parameters must be left off if their value is None. Check the compute server for how it is done there by using kwargs.
  3. Pass in enum parameters with Literal's. Check the compute server for how its done there.

Here's a snippet you can use as an example. We likely dont need the _to_dict or _append_items_from_response_data functions either. It'll simplify the code without them.

@mcp.tool(description="List Instances in a given compartment")
def list_instances(
    compartment_id: str = Field(..., description="The OCID of the compartment"),
    limit: Optional[int] = Field(
        None,
        description="The maximum amount of instances to return. If None, there is no limit.",
        ge=1,
    ),
    lifecycle_state: Optional[
        Literal[
            "MOVING",
            "PROVISIONING",
            "RUNNING",
            "STARTING",
            "STOPPING",
            "STOPPED",
            "CREATING_IMAGE",
            "TERMINATING",
            "TERMINATED",
        ]
    ] = Field(None, description="The lifecycle state of the instance to filter on"),
) -> list[Instance]:
    instances: list[Instance] = []

    try:
        client = get_compute_client()

        response: oci.response.Response = None
        has_next_page = True
        next_page: str = None

        while has_next_page and (limit is None or len(instances) < limit):
            kwargs = {
                "compartment_id": compartment_id,
                "page": next_page,
                "limit": limit,
            }

            if lifecycle_state is not None:
                kwargs["lifecycle_state"] = lifecycle_state

            response = client.list_instances(**kwargs)
            has_next_page = response.has_next_page
            next_page = response.next_page if hasattr(response, "next_page") else None

            data: list[oci.core.models.Instance] = response.data
            for d in data:
                instance = map_instance(d)
                instances.append(instance)

        logger.info(f"Found {len(instances)} Instances")
        return instances

    except Exception as e:
        logger.error(f"Error in list_instances tool: {str(e)}")
        raise e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants