nest-mcp-server
by jhenbertgit
Overview
A NestJS server implementing the Model Context Protocol (MCP) to expose developer tools to AI agents via HTTP or standard I/O, supporting real-time streaming of tool outputs.
Installation
pnpm run startEnvironment Variables
- PORT
- TRANSPORT
Security Notes
CRITICAL VULNERABILITY: The `filereader` tool (src/tools/filereader/filereader.service.ts) is susceptible to path traversal. It uses `fs.readFile` directly with user-provided `path` input without sufficient validation or restriction. An attacker can read arbitrary files on the server (e.g., `/etc/passwd`, `../../.env`). NETWORK RISKS: - CORS is enabled for all origins (`origin: '*'`), which is insecure for production environments. - The `/register`, `/authorize`, and `/token` endpoints are explicitly mock implementations, providing no real authentication or authorization. Deploying this server publicly without a robust external authentication layer would be highly insecure. - The `file-search` tool, while using `glob`, operates with `cwd: '.'` and could be leveraged for information disclosure (e.g., listing sensitive files outside intended scope) if patterns are not adequately restricted, though less critical than arbitrary file read.
Similar Servers
mcp-typescript-template
This project provides a foundational TypeScript template for developing remote Model Context Protocol (MCP) servers with robust tooling and best practices.
compound-mcp-server
Provides a Model Context Protocol (MCP) server for interacting with Groq models, including compound/meta models, exposing tools for real-time information and code execution capabilities from the Groq AI.
nestjs-starter
A production-ready NestJS boilerplate for building scalable, enterprise-grade APIs with JWT authentication, PostgreSQL/Prisma, AWS S3/SES, Bull/Redis queues, Docker/Kubernetes support, and AI capabilities via Model Context Protocol (MCP).
mcp_server
This server implements the Model Context Protocol (MCP) to expose developer-defined tools as a HTTP API, specifically demonstrating a task creation tool.