xmcp on Vercel
xmcp
is a TypeScript-first framework for building MCP-compatible backends. It provides an opinionated project structure, automatic tool discovery, and a streamlined middleware layer for request/response processing. You can deploy an xmcp app to Vercel with zero configuration.
Start with xmcp on Vercel by creating a new xmcp project:
npx create-xmcp-app@latest
This scaffolds a project with a src/tools/
directory for tools, optional src/middleware.ts
, and an xmcp.config.ts
file.
To deploy, connect your Git repository or use Vercel CLI:
vc deploy
To run your xmcp application locally, you can use Vercel CLI:
vc dev
Alternatively, use your project's dev script:
npm run dev
yarn dev
pnpm run dev
In xmcp, an optional middleware.ts
lets you run code before and after tool execution. This is commonly used for logging, auth, or request shaping:
import { type Middleware } from 'xmcp';
const middleware: Middleware = async (req, res, next) => {
// Custom processing
next();
};
export default middleware;
In Vercel, Routing Middleware executes before a request is processed by your application. Use it for rewrites, redirects, headers, or personalization, and combine it with xmcp's own middleware as needed.
When you deploy an xmcp app to Vercel, your server endpoints automatically run as Vercel Functions and use Fluid compute by default.
Was this helpful?