Skip to content

Updating MCP Server backendOperation Verb Causes Tools Page Failure and Null apiOperationMapping #5106

Description

@Awynimantha

Description

Hi Team,

There is an issue observed when updating MCP server information using the Publisher REST APIs.

After creating an MCP server, they perform an update to modify the HTTP verb in the backendOperation section of the apiOperationMapping, as shown below:

"apiOperationMapping": {
    "apiId": "21de709b-013b-49f9-a0d3-0c1210528dbb",
    "apiName": "new",
    "apiVersion": "2",
    "apiContext": "/new/2",
    "backendOperation": {
        "target": "/test",
        "verb": "PUT"
    }
}

Although the update operation completes successfully, the Tools page of the API becomes unresponsive and displays the following error:

TypeError: Cannot read properties of undefined (reading 'toLowerCase')
    at ab (ToolDetails.jsx:229:82)

Further analysis indicates that findMatchingTemplate() in ApiMgtDAO returns null because it cannot find a matching resource template for the updated HTTP verb. Since no corresponding resource entry exists for the modified verb, the MCP server definition retrieved through the GET API eventually contains a null value for apiOperationMapping.

Image

As a result, the Publisher Portal encounters an error while rendering the Tools page, and the resource mapping table is not updated correctly. Consequently, apiOperationMapping is returned as null when the tool details are accessed.

Steps to Reproduce

We were able to consistently reproduce the issue using the following steps in WSO2 APIM 4.6.0 latest u2 level:

  1. Create a sample API.
  2. Remove the default resource and add new resources.
  3. Create an MCP server using "Create MCP Server from Existing API".
  4. Update the MCP server(update the verb to another) through the REST API and change the backend operation verb to a different HTTP method.
    UUPDATE https://127.0.0.1:9443/api/am/publisher/v4/mcp-servers/be4808da-df51-464d-9637-05e773febb7e
  5. Open the Tools page of the MCP server.

Version

4.6.0

Environment Details (with versions)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions