Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

Fastify Mcp

БесплатноНе проверен

Fastify Mcp — Model Context Protocol server

GitHubEmbed

Описание

Fastify Mcp — Model Context Protocol server

README

Integrate Model Context Protocol servers with your Fastify app.

Supports the Streamable HTTP transport as well as the legacy HTTP+SSE transport.

Usage

First, define your MCP server.

function createServer() {
  const mcpServer = new McpServer({
    name: "...",
    version: "...",
  });

  mcpServer.tool("...");
  mcpServer.resource("...");

  return mcpServer.server;
}

Create a Fastify app and register the plugin.

import { fastify } from "fastify";
import { streamableHttp } from "fastify-mcp";
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";

const app = fastify();

app.register(streamableHttp, {
  // Set to `true` if you want a stateful server
  stateful: false,
  mcpEndpoint: "/mcp",
  sessions: new Sessions<StreamableHTTPServerTransport>()
  createServer,
});

app.listen({ port: 8080 });

See the examples directory for more detailed examples.

Installation

# npm
npm install fastify-mcp

# yarn
yarn add fastify-mcp

Session Management

The official MCP TypeScript SDK does not support managing multiple sessions out of the box, and therefore it's the host server's responsibility to do so.

This package uses an in-memory mapping of each active session against its session ID to manage multiple sessions, as recommended by the MCP SDK examples.

Session Events

The Sessions class emits the following events:

  • connected: Emitted when a new session is added.
  • terminated: Emitted when a session is removed.
  • error: Emitted when an asynchronous event handler throws an error.
const sessions = new Sessions<StreamableHTTPServerTransport>();

sessions.on("connected", (sessionId) => {
  console.log(`Session ${sessionId} connected`);
});

sessions.on("terminated", (sessionId) => {
  console.log(`Session ${sessionId} terminated`);
});

Contributing

Please file an issue if you encounter a problem when using this package. Pull requests for new features or bug fixes are also welcome.

from github.com/haroldadmin/fastify-mcp

Установить Fastify Mcp в Claude Desktop, Claude Code, Cursor

Рекомендуется · одна команда, все IDE
unyly install fastify-mcp

Ставит в Claude Desktop, Claude Code, Cursor и VS Code — сам разбирается с npx, uvx и сборкой из исходников.

Впервые? Поставь CLI: curl -fsSL https://unyly.org/install | sh

Или настроить вручную

Выполни в терминале:

claude mcp add fastify-mcp -- npx -y fastify-mcp

FAQ

Fastify Mcp MCP бесплатный?

Да, Fastify Mcp MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для Fastify Mcp?

Нет, Fastify Mcp работает без API-ключей и переменных окружения.

Fastify Mcp — hosted или self-hosted?

Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.

Как установить Fastify Mcp в Claude Desktop, Claude Code или Cursor?

Открой Fastify Mcp на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Похожие MCP

Compare Fastify Mcp with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории ai