McpServer is the root of your app: an Express-backed server whose methods return the server itself, so you chain your tool registrations off it and export the resulting type for generateHelpers.
Example
A server registers one tool, exports its type for the typed client hooks, and starts listening.server.ts
Constructor
serverInfoyour server’snameandversion.optionsforwarded to the MCP SDK server.skybridgeOptionsSkybridge-specific configuration:
json tunes the express.json() parser Skybridge pre-applies, for example to raise the default 100kb body-size limit.
oauth is an OAuthConfig, usually from customProvider or a branded provider. When set, it mounts the well-known OAuth metadata and bearer-token verification on /mcp.
The config also carries the claim shape its verifier produces, so handlers read extra.authInfo?.extra typed, with no declaration of their own. See Type the Claims You Read.
skills set to true serves Agent Skills over MCP from src/skills and declares the io.modelcontextprotocol/skills capability. See the Skills guide.
Skills over MCP tracks SEP-2640, which is still under review. The feature is experimental and may change with the spec.
Properties
express
The underlying Express app, for custom routes, middleware, and settings. Register handlers before run().
Alpic Cloud routes traffic only to
/mcp. Custom routes work locally and on self-hosted deployments.Methods
Every method returns the server, so calls chain.registerTool
use
app.use.
useOnError
/mcp route. A default handler runs last, responding with a 500 JSON-RPC error when nothing else has sent a response.
mcpMiddleware
(request, extra, next), can inspect or short-circuit the call, and invokes next() to continue. Register it before run() or connect(); middleware runs in registration order, outermost first. An optional filter scopes which methods it runs for.
getToolError
isError tool result, so await next() resolves normally and the middleware never sees the failure. getToolError returns the error the tool handler threw during the current request, with its stack and cause intact. It lives on extra, which is never serialized to the client.
useOnError never runs for it — report tool errors from mcpMiddleware, and keep useOnError for transport-level failures. Errors raised by the SDK itself — unknown tool, input or output schema validation — never reach your handler and are not reported here.
run
/mcp, and listens (default port 3000). On serverless platforms, export what it returns so the platform can route requests to it. See Deploy for the per-platform setup.
registerTool
Define the tools and views the server exposes
generateHelpers
Turn
AppType into typed client hooksrequireBearerAuth
Require or optionally accept a signed-in user