Importing MCP Servers Via Dev First Approach¶
WSO2 API Controller (apictl) allows you to create and deploy MCP (Model Context Protocol) Servers without using the Publisher Portal of the WSO2 API Manager (WSO2 API-M). You can use this feature to create an MCP Server using an existing MCP specification and then deploy it to the desired WSO2 API-M environment.
Info
Before you begin
-
Make sure that the apictl is downloaded and initialized, if not, follow the steps in Download and Initialize the apictl.
-
Make sure you already have added an environment using the apictl for the WSO2 API-M environment you plan to import the MCP Server to.
If not, follow the steps in Add an Environment.
Import an MCP Server project¶
Info
Before you begin...
-
Make sure you have already created an environment to which you are planning to import the MCP Server. If not, follow steps in Add an Environment.
-
Make sure you have logged-in to the importing environment. If not, follow steps in Login to an Environment.
Tip
A user with Internal/devops role or admin role are allowed to import MCP Servers. To create a custom user who can import MCP Servers, refer Steps to Create a Custom User who can Perform API Controller Operations.
You can import the MCP Server to an environment using any of the following commands.
-
Command
apictl import mcp-server -f <path to MCP Server Project> -e <environment>apictl import mcp-server --file <path to MCP Server Project> --environment <environment> --rotate-revisionapictl import mcp-server --file <path to MCP Server Project> --environment <environment> --params=<environment params file>Info
Flags:
- Required :
--fileor-f: The file path of the MCP Server project to import.
--environmentor-e: Environment to which the MCP Server should be imported. - Optional :
--rotate-revision: If the maximum revision limit reached, delete the oldest revision and create a new revision.
--skip-deployments: Skip the deployment environments specified in the project and only update the current MCP Server.
--preserve-provider: Preserve the existing provider of MCP Server after importing. The default value istrue.
--update: Update an existing MCP Server or create a new MCP Server in the importing environment.
--params: Provide a API Manager environment params file. For more information, see Configuring Environment Specific Parameters.
--skip-cleanup: Leave all temporary files created in apictl during import process. The default value isfalse.
Note
Importing versions of an MCP Server
- When importing versions of an MCP Server, you are not allowed to change the MCP Server provider. - If the preserve-provider value was set to `true` when importing the initial MCP Server, the value should be set to `true` when importing all its' versions. - If the preserve-provider value was set to `false` when importing the initial MCP Server, the value should be set to `false` when importing all its' versions.Example
apictl import mcp-server -f ~/mymcpserver -e productionapictl import mcp-server --file ~/mymcpserver --environment production --rotate-revisionapictl import mcp-server --file ~/mymcpserver --environment production --params prod/params.yamlTip
When using the
--updateflag with theimport mcp-servercommand, apictl will check if the given MCP Server exists in the targeted environment. If the MCP Server exists, it will update the existing MCP Server. If not, it will create a new MCP Server in the imported environment.Note
Changes to the import command with the revision support for MCP Servers
- From WSO2 API-M 4.0.0 onwards, you have to create a new revision in order to deploy an MCP Server in a Gateway environment and only a revision can be deployed in a Gateway environment.
- With the import command of the apictl, if the MCP Server project has specified the deployment environments, the import will first update the current MCP Server.
- If the number of revisions created for that MCP Server do not exceed the max revision limit of 5, a new revision of that MCP Server will be created and that revision will be deployed in the specified Gateway environments.
- If the max revision numbers are reached, the imported MCP Server will only update the current MCP Server and not be deployed in the specified Gateway environments.
- You can use the
--rotate-revisionflag with the import command and if the max revision limit is reached, the import operation will delete the earliest revision for that MCP Server and create a new revision. This new revision will be deployed in the specified Gateway environments.
Note
apictl import-mcp-servercommand has been deprecated from apictl 4.0.0 onwards. Instead useapictl import mcp-serveras shown above. - Required :
-
Response
Successfully imported MCP Server!