One-Click Deploy an SSE MCP Server on Alibaba Cloud with Serverless Devs CLI
This guide walks you through the Model Context Protocol (MCP) basics, the pain points of manual setup, and how to use Serverless Devs CLI to initialize, develop, package, deploy, and test a native SSE MCP Server on Alibaba Cloud Function Compute, complete with sample code and client testing options.
What is Model Context Protocol (MCP)?
Model Context Protocol (MCP) is a standardized protocol that connects large language model (LLM) capabilities with the real world, defining Resources, Prompts, and Tools to enable modular extensions such as file system access, API integration, and IoT control for LLMs.
Current pain points of MCP Server development
Developers must manually configure Python/TypeScript SDKs, resolve dependency conflicts, and handle complex IaC deployment on the cloud, making a zero‑to‑one MCP Server setup costly and fragmented.
Accelerating development with Serverless Devs CLI
Serverless Devs CLI provides one‑click project initialization and deployment, dramatically shortening the development workflow.
Initialize a MCP Server project
s init start-fcai-mcp-nodejsFollow the prompts to set region, function name, and access configuration, which creates a ready‑to‑run Hello World MCP Server project.
Project directory structure
.
├── build.yaml # Build configuration
├── code # Project code
│ ├── check_node_version.mjs # Pre‑deployment check script
│ ├── package-lock.json
│ ├── package.json
│ ├── src
│ │ └── index.ts # Server source code
│ ├── tsconfig.json
│ └── webpack.config.js
├── readme.md
└── s.yaml # Deployment YAMLDevelop the MCP Server
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const createServer = () => {
const server = new McpServer({
name: "my-mcp-server",
version: "1.0.0",
});
server.tool(
"hello_world",
"Return string 'hello world!'",
{},
async () => {
console.log("Hello World tool called");
return { content: [{ type: "text", text: "hello world!" }] };
}
);
return server;
};
const server = createServer();
const transport = new StdioServerTransport();
server.connect(transport).then(() => console.log("Server started")).catch(err => console.error("Error starting server:", err));This server defines a simple hello_world tool that returns the string "hello world!" without any input parameters.
Package and deploy the server
npm install # install dependencies if not done
npm run build # bundle with webpack
s deploy -y # one‑click deployment to Function AIThe deployment YAML ( s.yaml) generated by the CLI contains all required instance specifications, code paths, and trigger configurations.
Test the deployed MCP Server
Use the official inspector client (or the built‑in LLM‑enabled inspector) to connect to the server:
npx @modelcontextprotocol/inspector node build/index.js
npx @serverless-devs/inspector node build/index.jsConfigure the internetUrl obtained after deployment, append /sse, and use the inspector UI to list tools, connect, and invoke the hello_world tool.
Client integration methods
Three ways to connect clients:
Official client (SSE) : Add the server URL with /sse to the client configuration JSON.
Custom local client : Use the SDK to create a client and an SSEClientTransport pointing to the deployed URL.
Remote client on Function Compute : Deploy the inspector as a function and access it via the provided domain.
Additional resources
Serverless Devs also offers ready‑made MCP Server templates for Python, Java, and many open‑source services (e.g., maps, GitHub). See the code repository for more examples.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Developer
Alibaba's official tech channel, featuring all of its technology innovations.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
