Overview
Deploy TypeScript MCP servers using the official MCP SDK with automatic containerization and infrastructure managed by Smithery.Prerequisites
- TypeScript MCP server using the official MCP SDK that exports the MCP server object at entry point
- Node.js 18+ and npm installed locally
- Smithery CLI installed as a dev dependency (
npm i -D @smithery/cli
)
New to MCP servers? See the Getting Started guide to learn how to build TypeScript MCP servers from scratch using the official SDK.
Project Structure
Your TypeScript project should look like this:Setup
1. Configure smithery.yaml
Create asmithery.yaml
file in your repository root (usually where the package.json
is):
2. Configure package.json
Yourpackage.json
must include the module
field pointing to your server entry point:
Install the CLI locally with:The Smithery CLI externalizes your SDKs during bundling so your runtime uses the versions you install. If you see a warning about missing SDKs, add them to your dependencies (most servers need
@modelcontextprotocol/sdk
and @smithery/sdk
).3. Ensure Proper Server Structure
Your TypeScript MCP server must export a defaultcreateServer
function that returns the MCP server object. If you built your server following the Getting Started guide, it should already have this structure.
configSchema
:
configSchema
from the same file as your createServer
function (typically src/index.ts
).
What it does: Automatically generates session configuration forms for users connecting to your server.
OAuth
OAuth support in the TypeScript SDK and CLI is in beta and may change.
oauth
, Smithery CLI auto-mounts the required OAuth endpoints for you.
Export an OAuth provider
oauth
and injects the auth routes automatically.
Local Development
Test your server locally using the Smithery CLI:- Test your MCP server tools in real-time
- See tool responses and debug issues
- Validate your configuration schema
- Experiment with different inputs
Advanced Build Configuration
For advanced use cases, you can customize the build process using asmithery.config.js
file. This is useful for:
- Marking packages as external (to avoid bundling issues)
- Configuring minification, targets, and other build options
- Adding custom esbuild plugins
Configuration File
Createsmithery.config.js
in your project root:
Common Use Cases
External Dependencies: If you encounter bundling issues with packages like Playwright or native modules:build
and dev
commands.
Deploy
- Push your code (including
smithery.yaml
) to GitHub - Connect your GitHub to Smithery (or claim your server if already listed)
- Navigate to the Deployments tab on your server page
- Click Deploy to build and host your server
Good to Know
What happens under the hood
What happens under the hood
When you deploy, Smithery will:
- Clone your repository
- Parse your
smithery.yaml
to detect TypeScript runtime - Install dependencies with
npm ci
- Build your TypeScript code using the
module
entry point from yourpackage.json
- Package your server into a containerized HTTP service
- Deploy the container to our hosting infrastructure
- Send MCP
initialize
andlist_tools
messages with a dummy configuration to discover your server’s capabilities - Make it available at
https://server.smithery.ai/your-server/mcp
- Handle load balancing, scaling, and monitoring
Troubleshooting
Why does my deployment fail?
Why does my deployment fail?
Common deployment failures and solutions:
- Missing module field: Ensure your
package.json
has themodule
field pointing to your entry point - Dependencies not found: All dependencies must be listed in
dependencies
ordevDependencies
- Server doesn’t build locally: Before deploying, verify your server builds and runs locally:
If this fails, fix any TypeScript compilation errors or missing dependencies first