Get the FREE Ultimate OpenClaw Setup Guide →

fastify

🚀 High-performance MCP (Model Context Protocol) server built with Fastify, TypeScript, and functional programming. Production-ready with authentication, metrics, and auto-discovery capabilities for AI agents and LLM applications.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio neddl-fastify-mcp-server node dist/server.js \
  --env NODE_ENV="Environment (e.g., development, production)" \
  --env MCP_SERVER_HOST="Host for the MCP server" \
  --env MCP_SERVER_PORT="Port to run the MCP server on" \
  --env MCP_SERVER_TOKEN="Bearer token used for MCP authentication"

How to use

This MCP server provides a high-performance Model Context Protocol implementation built with Fastify and TypeScript. It exposes an MCP-compliant API with endpoints for health checks and metrics, and automatically discovers and registers tools, resources, and prompts from your project folders. Access to the MCP endpoints is secured via a Bearer token configured in MCP_SERVER_TOKEN, ensuring secure connections for AI agents and LLM integrations. Use the included MCP transport (WebSocket/HTTP) to interact with tools, resources, and prompts in a structured, type-safe manner through the @modelcontextprotocol/sdk.

Once running, you can interact with the MCP server through its standard endpoints and the MCP client tooling. The auto-discovery mechanism scans the tools, resources, and prompts directories to register capabilities without manual wiring, making it easy to extend capabilities as your project grows. The server also includes production-ready features such as metrics, health checks, and session management to support long-running deployments in Kubernetes or other orchestration environments.

How to install

Prerequisites:

  • Node.js 20.10.0+ (recommended 24.x LTS)
  • npm or yarn
  • Git

Installation steps:

  1. Clone the repository:
git clone https://github.com/your-username/neddl-fastify-mcp-server.git
cd neddl-fastify-mcp-server
  1. Install dependencies:
npm install
  1. Build the project (TypeScript to JavaScript):
npm run build
  1. Run the server in development or production mode (see environment variables in configuration):
# Development (with hot reload if configured)
npm run dev

# Production (standalone MCP server)
npm start
  1. Compose the runtime environment variables (example):
cp .env.example .env

Edit .env with your configuration, including MCP_SERVER_PORT, MCP_SERVER_HOST, and MCP_SERVER_TOKEN.

Additional notes

Tips and notes:

  • Ensure MCP_SERVER_TOKEN is kept secret and rotated regularly in production.
  • The MCP auto-discovery relies on the presence of Tools, Resources, and Prompts in their respective folders and updates when you modify index.ts in those directories.
  • If running in Kubernetes, expose port 9080 (as per .env.example) and configure readiness/liveness probes to monitor /health and /metrics.
  • For local development, you can use the dev script (npm run dev) to speed up iteration; for production, use npm start and a process manager like PM2 or a Kubernetes deployment.
  • If you encounter TypeScript compilation issues, verify your Node.js version matches the supported range and that dependencies are installed correctly.

Related MCP Servers

Sponsor this space

Reach thousands of developers