
TypeScript MCP 框架
概览
xmcp 是一个用于构建和发布 TypeScript MCP 服务器的框架。它以 DX 为设计理念,简化了开发流程,降低了任何希望在模型上下文协议生态系统上创建和部署强大工具的人的入门门槛。 用以下方式启动你的第一个xmcp应用: 或在现有Next.js或Express项目上初始化xmcp,方法包括: ⊹ - 工具和提示从工具和提示目录自动注册\ ⊹ - 即时开发反馈\ ⊹ - 发布认证和定制中间件的工具包\ ⊹ - MCP服务器可定制配置\ ⊹ - 跨平台灵活部署\ ⊹ - Vercel零配置部署 ⊹ 访问 xmcp.dev 了解更多项目信息。\ ⊹ 访问 xmcp.dev/docs 查看完整文档。 如果您认为发现了安全漏洞,我们鼓励您立即告知我们。 我们会调查所有合法举报,并尽力迅速解决问题。
概述(AI 翻译)
XMCP
TypeScript MCP 框架
构建并发布你已经熟悉的代码的MCP服务器。让AI应用访问你的工具、数据和工作流程。编写TypeScript函数;xmcp 负责协议、验证和传输。
开始
创建一个新的xmcp应用:
或者在现有项目中添加xmcp:
工具是一个文件。导出一个模式、元数据和函数,然后 xmcp 注册:
特色
⊹ 文件系统路由 - 工具、提示和资源自动从目录注册,无需配置
⊹ 中间件 - 为每个请求添加认证、日志、速率限制或自定义逻辑
⊹ Transports - 通过HTTP或STDIO从同一代码提供服务
⊹ 集成 - 通过Better Auth、Clerk、Auth0、WorkOS、Descope、Scalekit和Supabase进行认证;通过Polar、Commet和x402实现变现
⊹ 适配器 - 可在Next.js、Express、NestJS、Fastify、Hono、TanStack Start、Nuxt、SvelteKit、React Router或Astro中运行
⊹ MCP 应用 - 将交互式 React 小部件与你的工具一同交付
⊹ 部署任意地点 - Vercel、Cloudflare、Alpic、Replit、Railway、Render,或任何Node.js主机\
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
The TypeScript MCP framework
Build and ship MCP servers with the code you already know. Give AI applications access to your tools, data, and workflows. Write TypeScript functions; xmcp handles the protocol, validation, and transport.
Getting started
Create a new xmcp app:
npx create-xmcp-app@latest
Or add xmcp to an existing project:
npx init-xmcp@latest
A tool is a file. Export a schema, metadata, and a function, and xmcp registers it:
// src/tools/greet.ts
import { z } from "zod";
import { type InferSchema } from "xmcp";
export const schema = {
name: z.string().describe("The name of the user to greet"),
};
export const metadata = {
name: "greet",
description: "Greet the user",
};
export default async function greet({ name }: InferSchema) {
return `Hello, ${name}!`;
}
Features
⊹ File system routing - Tools, prompts, and resources register automatically from their directories, with zero configuration
⊹ Middlewares - Add authentication, logging, rate limits, or custom logic to every request
⊹ Transports - Serve over HTTP or STDIO from the same code
⊹ Integrations - Authentication with Better Auth, Clerk, Auth0, WorkOS, Descope, Scalekit and Supabase; monetization with Polar, Commet and x402
⊹ Adapters - Run inside Next.js, Express, NestJS, Fastify, Hono, TanStack Start, Nuxt, SvelteKit, React Router or Astro
⊹ MCP Apps - Ship interactive React widgets alongside your tools
⊹ Deploy anywhere - Vercel, Cloudflare, Alpic, Replit, Railway, Render, or any Node.js host
⊹ Hot reloading - Instant feedback while you develop
Learn more
⊹ Visit xmcp.dev to learn more about the project.
⊹ Read the documentation for guides and API reference.
⊹ Start from a template.
Security
安装
npx create-xmcp-app@latest