MCP servers (Model Context Protocol) provide a toolkit of multiple tools—individual capabilities for accessing specific APIs or databases. These servers can be interacted with using WebSocket protocol on the server’s global endpoint.

You can develop custom MCP servers in TypeScript or Python and deploy them on Blaxel by integrating a few lines of the Blaxel SDK and leveraging our other developer tools (Blaxel CLI, GitHub action, etc.).

Quickstart

It is required to have npm (TypeScript) **or uv (Python) installed to use the following command.

You can quickly initialize a new MCP server from scratch by using CLI command bl create-mcp-server. This will create a pre-scaffolded local repo where your entire code can be added.

bl create-mcp-server my-mcp

You can test it by running the following command which launches both the server and a web application (MCP Inspector, managed by MCP) locally for testing the server’s capabilities during development.


pnpm inspect

The web application is accessible at: http://127.0.0.1:6274. Alternatively, you can just simply serve the server locally by running bl serve --hotreload.

Develop the MCP server logic

Deploy your MCP server

Just run bl deploy in the folder of your project, as explained in this guide.

bl deploy

You can configure the server deployment (e.g. specify the MCP server name, etc.) in the blaxel.toml file at the root of your directory. Read the file structure section down below for more details.

Deploy your MCP server

Read our complete guide for deploying your custom MCP server on Blaxel.

Blaxel MCP server template file structure

blaxel.toml

This file is used to configure the deployment of the MCP server on Blaxel. It’s not mandatory, but it allows you to customize the deployment.

name = "my-mcp-server"
workspace = "my-workspace"
type = "function"

[env]
DEFAULT_CITY = "San Francisco"
  • name, workspace, and type fields are optional and serve as default values. Any bl command run in the folder will use these defaults rather than prompting you for input.
  • [env] section defines environment variables that the MCP server can access via the SDK. Note that these are NOT secrets.

Connect to your MCP server

Read our complete guide for connecting to and invoking an MCP server.