NestJS MCP Server - Model Context Protocol Example
@LiusDev
About NestJS MCP Server - Model Context Protocol Example
This repository demonstrates a NestJS implementation of the Model Context Protocol (MCP) with a microservice architecture.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"nestjs-mcp-server": {
"type": "http",
"url": "http://localhost:3000/sse"
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is NestJS MCP Server - Model Context Protocol Example?
This repository demonstrates a NestJS implementation of the Model Context Protocol (MCP) with a microservice architecture. It comprises two services: an MCP server that provides time context functions for LLMs, and an MCP backend client that uses LangChain.js and the MCP client SDK to connect to the server. It is intended for developers building context-aware LLM applications with NestJS.
How to use NestJS MCP Server - Model Context Protocol Example?
Install Node.js 20+, clone the repo, run npm install, copy .env.example to .env and add your OpenAI API key. Start both services using npm run start:dev mcp-server and npm run start:dev mcp-backend. Send a POST request to http://localhost:3001 with a JSON body containing a message field (e.g., "What time is it in Viet Nam?") to receive the current time.
Key features of NestJS MCP Server - Model Context Protocol Example
- Provides current time context to language models via MCP
- Supports connecting to multiple MCP servers simultaneously
- Uses Server-Sent Events (SSE) transport with reconnection options
- Includes LangChain.js adapter integration for tool calling
- Tool name prefixing to avoid conflicts with multiple servers
Use cases of NestJS MCP Server - Model Context Protocol Example
- Retrieving the current time for any timezone through an LLM query
- Demonstrating MCP integration with a NestJS microservice architecture
- Serving as a reference for building custom MCP servers and clients
- Testing connections to multiple MCP servers in a single application
FAQ from NestJS MCP Server - Model Context Protocol Example
What are the runtime requirements?
Node.js version 20 or higher and npm are required.
How do I start the services?
Use npm run start:dev mcp-server for the MCP server and npm run start:dev mcp-backend for the backend.
What transport does the MCP server use?
The MCP server uses Server-Sent Events (SSE) transport, with configuration options for reconnection.
What API keys are needed?
An OpenAI API key must be provided in the .env file under OPENAI_API_KEY.
Can I connect to multiple MCP servers?
Yes. You can configure additional servers in McpClientModule.register with unique keys and ports. The client fetches tools from all configured servers.
Frequently asked questions
What are the runtime requirements?
Node.js version 20 or higher and npm are required.
How do I start the services?
Use `npm run start:dev mcp-server` for the MCP server and `npm run start:dev mcp-backend` for the backend.
What transport does the MCP server use?
The MCP server uses Server-Sent Events (SSE) transport, with configuration options for reconnection.
What API keys are needed?
An OpenAI API key must be provided in the `.env` file under `OPENAI_API_KEY`.
Can I connect to multiple MCP servers?
Yes. You can configure additional servers in `McpClientModule.register` with unique keys and ports. The client fetches tools from all configured servers.
Basic information
More Other MCP servers
Blender
ahujasidOpen-source MCP to use Blender with any LLM

DeepMark
DeepMark helps teachers deliver rapid, consistent marking with meaningful feedback for every student — in a fraction of the time. What once took a week, now takes one free period.
XcodeBuildMCP
cameroncookeA Model Context Protocol (MCP) server and CLI that provides tools for agent use when working on iOS and macOS projects.

YOUB
Connect your AI assistant to your own YOUB endurance training account. Read recorded activities with full analysis, planned sessions, race goals, wellness (HRV, sleep, resting HR) and your athletic profile. Create or mov

Figs, Relationship Expert
Figs O'Sullivan, LMFTCouples therapist Figs O'Sullivan (LMFT, 17 years, endorsed by Sue Johnson, creator of EFT) inside your AI. Ask relationship questions answered from his clinical writing, name the pattern in a fight, get a three-step rep
Comments