BN

btwld/nest-mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

7 stars 5 forks Качество 63 Тренд 23BSD-3-Clause

Build Model Context Protocol (MCP) servers, clients, and gateways using the NestJS ecosystem you already know.

Обзор

Build Model Context Protocol (MCP) servers, clients, and gateways using the NestJS ecosystem you already know: decorators, dependency injection, modules, and guards, without learning a new framework. NestJS peer dependencies (if not already installed): Define tools with decorators and register the module: Connect to a server and inject the client: Aggregate two upstream servers behind one endpoint: Tools from upstream servers are exposed with a prefix (weather_forecast, search_query). Downstream clients see one unified server. Full documentation lives in the docs/ folder. Working examples live in the apps/ directory:

README

Показан фрагмент оригинального README. Открыть оригинал.

nest-mcp

Build Model Context Protocol (MCP) servers, clients, and gateways using the NestJS ecosystem you already know: decorators, dependency injection, modules, and guards, without learning a new framework.

Packages

Package Description
@nest-mcp/server Build MCP servers with decorators, auth, resilience, and multi-transport support
@nest-mcp/client Connect to and consume MCP servers with typed injection and health checks
@nest-mcp/gateway Aggregate multiple upstream servers behind one unified MCP endpoint
@nest-mcp/common Shared types and utilities (peer dependency)

Architecture

┌─────────────────────────────────────────────┐
│             AI Client (LLM host)            │
└──────────────────────┬──────────────────────┘
                       │ MCP (Streamable HTTP / SSE / STDIO)
          ┌────────────▼────────────┐
          │   @nest-mcp/gateway     │  ← optional aggregation layer
          │  (NestJS application)   │
          └──┬──────────────┬───────┘
             │              │ upstream MCP connections (@nest-mcp/client)
  ┌──────────▼──┐    ┌──────▼──────┐
  │  @nest-mcp/ │    │  @nest-mcp/ │  ← MCP servers built with @nest-mcp/server,
  │   server A  │    │   server B  │     or any other MCP-compatible server
  └─────────────┘    └─────────────┘

@nest-mcp/server — internal architecture

  HTTP / SSE / STDIO
         │
         ▼
  ┌─────────────────────────────────────────────────────────┐
  │                    Transport Layer                      │
  │        (StreamableHttpService / SseService /            │
  │                 StdioService)                           │
  └──────────────────────┬──────────────────────────────────┘
                         │ MCP request (tool/resource/prompt)
                         ▼
  ┌─────────────────────────────────────────────────────────┐
  │                  Execution Pipeline                     │
  │                                                         │
  │  ContextFactory → McpExecutionContext                   │
  │         │                                               │
  │         ▼                                               │
  │  Auth Guards (@Public / @Scopes / @Roles / @Guards)     │
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →