Skip to content

AI and agents · By Rivtor · Updated

Host a TypeScript MCP server with a production Node runtime

Build a TypeScript MCP server to a production Node.js artifact, expose the supported HTTP transport and configure endpoint routing, host validation and authentication. Test the client-to-tool path separately from the host’s health check.

See the Rivtor deployment workflow →

Pin the SDK before writing the entrypoint

MCP TypeScript package layouts and APIs can differ between SDK releases. Start with the official example matching the installed version and lock dependencies. Record the runtime and transport the project supports. A copied stdio example is not an HTTP deployment entrypoint.

For a conventional TypeScript service, build src into a deliberate dist directory and start the emitted JavaScript. Verify module settings, file extensions and the supported Node version. A development watch command can hide missing runtime packages or output files.

Define the HTTP service boundary

ConfigurationVerification
MCP routeClient uses the exact deployed path
Public originGenerated URLs use the intended HTTPS origin
Health routeReturns a simple response without invoking a tool
Tool authorizationEach action is permitted for the authenticated caller
LifecycleShutdown stops new work and handles active requests

Check whether the pinned transport keeps any state in process. Do not copy scaling advice from a different protocol version. If tools persist records, use a durable data service rather than a process-local Map and describe the difference in the example.

Package and configure the application

Keep the server adapter and SDK in runtime dependencies. Supply secrets through the host’s private environment and ensure logs do not print authorization headers. Bind the listener to the assigned port and interface.

On Rivtor, inspect the Node service configuration or use an explicit Dockerfile/service override when the automatic command differs from the required server. PostgreSQL can support application state, but it does not automatically add an authorization model to MCP tools.

Test the deployed workflow

First request health, then connect a compatible MCP client and invoke a read-only tool with synthetic input. A 200 response from the homepage is not sufficient. Test an unauthenticated request and an authenticated request with insufficient permissions. For mutations, confirm retries cannot unintentionally repeat the same external effect. Keep tool capability, hosting availability and application correctness as separate observations.

References