Custom MCP Services

更新时间:
复制 MD 格式

In addition to the official MCP Server, Alibaba Cloud Model Studio supports the following three methods for custom MCP Server deployment:

  1. Deploy using scripts: For code. Use this if you have or obtain a code package that follows the MCP protocol, such as MCP service code you developed or from an open-source community.

  2. Import from AI Gateway: For existing APIs. Use this if you want to encapsulate an existing, non-MCP compliant RESTful API (such as internal company business interfaces or third-party service interfaces) into a tool that Large Language Models can invoke.

  3. Import from Alibaba Cloud OpenAPI: For the Alibaba Cloud ecosystem. Use this if you want Large Language Models to operate other Alibaba Cloud products (such as OSS, ECS).

Deploy using scripts

Alibaba Cloud Model Studio supports hosting MCP service code, whether developed by you or obtained from an open-source community, using Function Compute (FC).

For example, deploy the open-source Knowledge Graph Memory MCP service:

Knowledge Graph Memory MCP service: This service enables Large Language Models to record personalized information and retrieve it for use in subsequent interactions.
  1. Create an MCP service

    Go to MCP Management and click Create MCP Service. Select Deploy by Script and click Deploy Service.

  2. Configure the MCP service

    Complete the configuration as follows. After confirming the settings, submit the deployment.

    Configuration item

    Purpose

    Configuration for this example

    Service name

    Description

    Differentiates MCP services. Does not affect Large Language Model judgment or invocation.

    Service name: Long-term memory

    Description: This service lets Large Language Models record personalized information and retrieve it for replies in subsequent interactions.

    Install Method

    To host a local MCP service (stdio), use the following methods:

    • npx: Start an MCP service developed using Node.js.

    • uvx: Start an MCP service developed using Python.

    To connect to a remote MCP service, use the following method:

    • http: Connect to an existing remote MCP server running elsewhere.

    Select: npx

    Deployment Method

    (npx/uvx only)

    Basic Mode: Pay by Requests: Suitable for on-demand startup, cost savings, and scenarios that can tolerate slower responses.

    Extreme Mode: Suitable for continuous operation, fast responses, and scenarios that can tolerate higher costs.

    For detailed billing rules, see Billing Information.

    Keep Basic Mode: Pay by Requests, disable Extreme Mode

    Region

    (npx/uvx only)

    For optimal response speed, choose a region near other existing cloud services. If unsure, use the "Beijing" region.

    Select: Beijing

    MCP service configuration

    Important

    Verify the source and source code of the MCP service to prevent phishing attacks.

    Important

    Not all MCP Servers support npx/uvx/http-based deployment. If the corresponding configuration code is missing, you cannot directly deploy to Alibaba Cloud Model Studio. We recommend that you refer to the MCP official documentation to perform local deployment.

    Note

    An MCP Server developed in Java can be deployed to Alibaba Cloud Function Compute, and then hosted on Model Studio via HTTP.

    • To deploy an open-source community MCP service, paste the configuration code from the MCP service product page.

      image

    • To deploy a self-developed MCP service, write the configuration code using the following template.

      Note

      This configuration template applies to MCP services developed based on npx/uvx/http best practices. If you use other development methods, modify the template accordingly.

      {
        "mcpServers": {
          "Local MCP Service": {
            "type": "stdio",
            "command": "npx",
            "args": [
              "-y",
              "@your_acc_name/your_pkg_name"
            ],
            "env": {
              "YOUR_ENV_KEY": "YOUR_ENV_VALUE"
            }
          },
          "Remote MCP Service": {
            "type": "sse/streamableHttp",
            "url": "https://your-mcp-server/sse"
          }
        }
      }

    Use the following configuration code directly:

    {
      "mcpServers": {
        "memory": {
          "command": "npx",
          "args": [
            "-y",
            "@modelcontextprotocol/server-memory"
          ]
        }
      }
    }

    Or, find this MCP Server in the MCP Marketplace, click to open the product page, and find the configuration code under the NPX title.

  3. Manage the MCP service

    After submitting the deployment, view the deployment status, test the tool's functionality, and modify service configurations.

    1. View deployment status

      Go to the Function Compute FC console to view the detailed deployment status of the MCP service.

      image

      (Optional) You can enable Simple Log Service to view real-time service status and troubleshoot potential issues.

      image

      Note

      Function Compute FC's Simple Log Service incurs fees. For details, refer to the Simple Log Service billing description in the console.

    2. Test the tool's functionality:

      On the Tool page, test the MCP service's operational functionality.

      image

    3. Modify service configuration:

      After deployment, you can only edit the Service name and Description. To modify the Deployment Method, Region, Install Method, or MCP service configuration, you must first stop the current deployment and then redeploy after modifying the configuration.

  4. Use the MCP service

    After the deployment is complete, you can configure the custom MCP Server. For more information, see Configure the MCP Server in an agent or a workflow.

Import from AI Gateway

For existing self-managed or third-party business APIs, you can use the AI Gateway to upgrade RESTful APIs into MCP Servers. For more information, see Gateway-Hosted MCP Server. Alibaba Cloud Model Studio lets you quickly import MCP Servers hosted by the AI Gateway.

  1. Import preparation

    Ensure that you have an MCP Server hosted on AI Gateway.

  2. Import an MCP service

    Go to MCP Management and click Create MCP Service. Select AI Gateway and click Import Service.

  3. Configure the MCP service

    Enter the configuration information as instructed in the following table. After confirming the information is correct, click Confirm Import.

    Configuration item

    Configuration description

    Example

    Gateway Region

    Region where AI Gateway is located

    China (Hangzhou)

    Gateway Instance

    AI Gateway instance

    test

    Select a service for MCPS

    MCP service hosted in AI Gateway

    test

    Select Endpoint

    Access point for the MCP service hosted in AI Gateway. The system automatically generates an access point for testing.

    [Automatically generated]

    image

  4. Complete the import

    After the import is complete, you can view the MCP services imported from the AI Gateway in MCP Management > Custom Services.

Import from Alibaba Cloud OpenAPI

If you want to create a service using Alibaba Cloud resources, you can use the OpenAPI Developer Portal to quickly publish an official OpenAPI as an MCP service. For more information, see OpenAPI MCP Server User Guide. Alibaba Cloud Model Studio lets you quickly import MCP services from the OpenAPI Developer Portal.

  1. Import preparation

    Ensure that you have created an MCP Server on the OpenAPI Developer Portal.

  2. Import an MCP service

    Go to MCP Management and click Create MCP Service. Select Alibaba Cloud OpenAPI and click Import Service.

  3. Configure the MCP service

    Follow the instructions below to complete the configuration. After verifying the configuration, click Confirm Import.

    Configuration item

    Configuration description

    Example

    Service name

    The OpenAPI MCP service to import.

    oss

    Role for accessing Alibaba Cloud OpenAPI

    The role that Alibaba Cloud Model Studio uses to access OpenAPI. You can use an existing role or click Create Role here.

    BailianMcpRoleFoross

    Policy

    Go to RAM Access Policies, use the JSON script here to create an access policy, and grant the access policy to the Access Alibaba Cloud OpenAPI Role.

    [Automatically generated]

    image

  4. Complete the import

    After the import is complete, you can view the MCP services imported from OpenAPI in MCP Management > Custom Services.