nest-mcp-sse logo

nest-mcp-sse

by HxinY499

This is a dynamic module for quickly developing SSE transport type McpServer under NestJS projects. It allows you to focus on MCP tool development without worrying about connection Transport, lifecycle management, and McpServer instantiation.

View on GitHub

Last updated: N/A

What is nest-mcp-sse?

nest-mcp-sse is a NestJS module that simplifies the creation and management of MCP (Model Context Protocol) servers using SSE (Server-Sent Events) for real-time communication. It handles the complexities of transport management and server lifecycle, allowing developers to focus on building MCP tools.

How to use nest-mcp-sse?

  1. Install the module and its dependencies using npm, yarn, or pnpm. 2. Import the McpModule into your NestJS module using McpModule.register, McpModule.forRoot, or McpModule.forFeature. Configure the module with controllerBaseUrl and mcpServerConfigs. 3. Use the McpServerService to access and manage MCP server instances. Register tools on the server using the native MCP SDK methods.

Key features of nest-mcp-sse

  • Rapidly create MCP servers in NestJS applications

  • Manage multiple MCP server instances

  • Automatically handle SSE connection lifecycle

  • No over-encapsulation of the native MCP Server methods

  • Supports manual registration of server instances

  • Provides endpoints for SSE connections and message handling

Use cases of nest-mcp-sse

  • Developing real-time MCP tools within a NestJS application

  • Managing multiple MCP server instances for different functionalities

  • Creating interactive applications that require server-sent events

  • Building applications that use the Model Context Protocol for communication

FAQ from nest-mcp-sse

What is MCP?

MCP stands for Model Context Protocol, a protocol for communication between applications.

What is SSE?

SSE stands for Server-Sent Events, a server push technology enabling real-time data streaming from a server to a client.

Do I need to manually manage SSE connections?

No, the module automatically handles the SSE connection lifecycle.

Can I use the native MCP SDK methods directly?

Yes, the module does not over-encapsulate the native MCP Server methods, allowing you to use them directly.

How do I access the McpServer instance?

You can access the McpServer instance through the McpServerService using the getServer method.