nitro-mcp-server

nitro-mcp-server

Enables MCP client interaction via streamable HTTP, providing example tools (echo, getPostsByUser) and resources (posts, users) with pluggable authentication providers.

Category
Visit Server

README

Nitro MCP Server

This project is an MCP (Model Context Protocol) server using streamable HTTP transport powered by the Nitro. It is designed to demonstrate how to implement an MCP Server including authentication using pluggable providers.

Features

  • Lightweight and fast, built on Nitro
  • Tools located at /tools
  • Input and output schema validation with Zod
  • Example tools included:
    • echo: Echoes back the input, demonstrating basic tool functionality
    • getPostsByUser: Fetches posts by a user using an API, demonstrating output schema validation and structuredContent
  • Example resources included:
    • posts: Fetches posts from an API, demonstrating resource handling
    • users: Fetches users from an API, demonstrating resource handling
  • Easy integration with MCP clients
  • Authentication support with pluggable providers (Auth0, Microsoft Entra ID)

Getting Started

Prerequisites

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/nitro-mcp-server.git
    cd nitro-mcp-server
    
  2. Install dependencies:
    pnpm install
    

Running the Server

Start the server with:

pnpm dev

Running the MCP inspector:

pnpm inspect
  1. Open your browser and navigate to the inspector URL like http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=<token> to access the MCP inspector.
  2. Enter the address and port of your server at the URL field, like http://localhost:3000/mcp.
  3. Click "Connect" to establish a connection to your MCP Server.
  4. You can list the tools and invoke them.

Building the server

To build the server for production, run:

pnpm build

This will create a production-ready build in the .output directory.

Configuration

Configuration options can be set in the .env file. Options include:

  • NITRO_MCP_SERVER_HOST: The host the server listens on (default: localhost)
  • NITRO_MCP_SERVER_PORT: The port the server listens on (default: 3000)

Authentication

Authentication is supported via pluggable providers. Currently, Auth0 and Microsoft Entra ID are available. You can enable authentication by configuring the provider in your server settings or your local .env file in development.

As many Identity Providers do not support Dynamic Client Registration (DCR), this application uses an oAuth proxy solution to provide DCR as MCP specification requires, but delegates all the authentication responsibilities to the Identity Provider. Please note as such apply appropriate rate limiting to prevent misuse of register endpoint.

Supported Providers

  • Auth0: Configure with your Auth0 domain, client ID, and client secret.
  • Entra (Microsoft Entra ID): Configure with your tenant ID, client ID, and client secret.

Example configuration:

mcpServer: {
  auth: {
    providers: {
      auth0: {
        type: 'auth0',
        domain: '<your-auth0-domain>',
        clientId: '<your-client-id>',
        clientSecret: '<your-client-secret>',
        scope: 'openid profile email',
      },
      entra: {
        type: 'entra',
        tenantId: '<your-tenant-id>',
        clientId: '<your-client-id>',
        clientSecret: '<your-client-secret>',
        scope: 'openid profile email',
      }
    }
  }
}

These settings are configurable in an `.env' file or directly in the development environment, and at the server configuration in production. See the env.example file for a template.

See the provider files in lib/auth/ for more details and advanced options.

Todo

  • Add cleanup task for expired authorization codes

Contributing

Pull requests and issues are welcome! Please open an issue to discuss your ideas or report bugs.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured