npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@faapi/mcp

v6.47.0

Published

MCP Server SDK for faapi — Streamable HTTP transport, zod-native tool definition

Readme

@faapi/mcp

MCP Server SDK for faapi — 不依赖 @modelcontextprotocol/sdk,纯手写 MCP 协议

@faapi/mcp 实现 MCP(Model Context Protocol)服务端,通过 Streamable HTTP transport 暴露 tool 给 AI 助手(如 Claude、Cursor)。用 zod 声明 tool 输入参数,自动转为 JSON Schema。

安装

pnpm add @faapi/mcp

要求 Node.js >= 24。

快速开始

在 faapi 应用中创建 MCP 端点:

// api/mcp/handler.ts
import { createMcpServer, createMcpHandler } from '@faapi/mcp';
import { z } from 'zod';

const mcp = createMcpServer({ name: 'my-app', version: '1.0.0' });

mcp.tool('hello', {
  description: 'Say hello',
  input: { name: z.string().describe('Name to greet') },
  handler: async ({ name }) => ({
    content: [{ type: 'text', text: `Hello, ${name}!` }],
  }),
});

export const { POST, GET, DELETE } = createMcpHandler(mcp);

启动后,MCP 端点在 /api/mcp 可用,AI 助手通过 Streamable HTTP 连接。

MCP 方法

| 方法 | 行为 | |------|------| | initialize | 协议握手,返回 serverInfo + capabilities | | tools/list | 列出所有 tool(含 JSON Schema) | | tools/call | 调用 tool,返回结果 | | ping | 心跳 |

Transport

仅支持 Streamable HTTP(MCP 2025-06-18 规范):

  • POST:发送 JSON-RPC 消息,返回 JSON 响应
  • GET:v1 返回 405(不支持独立 SSE 流)
  • DELETE:按 Mcp-Session-Id 销毁会话

与 @modelcontextprotocol/sdk 的区别

| 方面 | @modelcontextprotocol/sdk | @faapi/mcp | |------|--------------------------|------------| | Transport | stdio + Streamable HTTP + 旧版 SSE | 仅 Streamable HTTP | | 依赖 | @modelcontextprotocol/sdk + zod-to-json-schema | 仅 zod(v4 内置 toJSONSchema) | | 集成 | 独立进程 | faapi 路由(函数即接口) | | Tool 定义 | server.tool(name, schema, cb) | mcp.tool(name, { input, handler }) |

许可证

MIT