Skip to main content
Glama

MCP Server NestJS

by Cstannahill

MCP Server (NestJS)

A robust, scalable, and extensible server-side application built with NestJS. This project provides a Model Context Protocol (MCP) server implementation, file management, authentication, and modular REST APIs for posts and users.


Table of Contents


Features

  • MCP Server: Implements Model Context Protocol for file operations and more.
  • File Management: Upload, download, list, and delete files via REST endpoints.
  • Authentication: JWT-based authentication with local strategy.
  • User & Post Modules: Modular structure for users and posts with DTOs and entities.
  • Swagger Integration: API documentation out-of-the-box.
  • Extensible: Easily add new modules and features.

Architecture

  • NestJS: Progressive Node.js framework for building efficient, reliable, and scalable server-side applications.
  • MCP Integration: Uses a custom FileBrowserMCP for file operations.
  • Modular Design: Each feature is encapsulated in its own module.

Getting Started

Prerequisites

Installation

# Clone the repository $ git clone https://github.com/Cstannahill/mcp-server-nestjs.git $ cd nestjs-mcp-server # Install dependencies $ npm install

Environment Variables

Create a .env file in the root directory for any secrets or configuration overrides (optional).


Development

Running the Server

# Start in development mode (with hot reload) $ npm run start:dev # Start in production mode $ npm run start:prod

Useful Commands

# Compile TypeScript $ npm run build # Lint code $ npm run lint

Testing

Run Unit Tests

$ npm run test

Run End-to-End (e2e) Tests

$ npm run test:e2e

Test Coverage

$ npm run test:cov

Deployment

  1. Build the project:
    $ npm run build
  2. Start the server:
    $ npm run start:prod
  3. For advanced deployment (Docker, cloud, etc.), see NestJS Deployment Docs.

API Reference

  • Swagger UI is available (if enabled) at /api when the server is running.
  • Main endpoints:
    • POST /auth/login — Authenticate and receive JWT
    • POST /files/upload — Upload a file
    • GET /files/:id — Download a file
    • DELETE /files/:id — Delete a file
    • GET /files — List files
    • POST /users — Create a user
    • POST /posts — Create a post

See controller files in src/ for more details.


Project Structure

src/ app.module.ts # Root module main.ts # Entry point auth/ # Authentication (JWT, guards, strategies) file/ # File management (upload, download, delete) mcps/ # Model Context Protocol integration posts/ # Posts module users/ # Users module database/ # Database connection (if used) uploads/ # Uploaded files (local dev)

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Open a pull request

Coding Standards

  • Follow the existing code style (see ESLint config)
  • Write unit and e2e tests for new features
  • Document your code and update the README as needed

Git Setup

This project uses Git for version control. The remote origin is set to:

https://github.com/Cstannahill/mcp-server-nestjs.git

License

Nest is MIT licensed.


Resources & Support


For any questions, issues, or feature requests, please open an issue or contact the maintainer.

-
security - not tested
F
license - not found
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

A robust server-side application that implements Model Context Protocol (MCP) for file operations, providing authentication and modular REST APIs for managing files, users, and posts.

  1. Table of Contents
    1. Features
      1. Architecture
        1. Getting Started
          1. Prerequisites
          2. Installation
          3. Environment Variables
        2. Development
          1. Running the Server
          2. Useful Commands
        3. Testing
          1. Run Unit Tests
          2. Run End-to-End (e2e) Tests
          3. Test Coverage
        4. Deployment
          1. API Reference
            1. Project Structure
              1. Contributing
                1. Coding Standards
              2. Git Setup
                1. License
                  1. Resources & Support

                    Related MCP Servers

                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that provides file system operations, analysis, and manipulation capabilities through a standardized tool interface.
                      Last updated 7 months ago
                      4
                      TypeScript
                      MIT License
                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server that enables enhanced file system operations including reading, writing, copying, moving files with streaming capabilities, directory management, file watching, and change tracking.
                      Last updated 15 days ago
                      12
                      15
                      TypeScript
                      MIT License
                      • Linux
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol (MCP) server that allows AI models to safely access and interact with local file systems, enabling reading file contents, listing directories, and retrieving file metadata.
                      Last updated 4 months ago
                      14
                      9
                      JavaScript
                      MIT License
                      • Linux
                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server that provides secure and intelligent interaction with files and filesystems, offering smart context management and token-efficient operations for working with large files and complex directory structures.
                      Last updated 5 months ago
                      21
                      42
                      Python
                      MIT License
                      • Apple
                      • Linux

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/Cstannahill/mcp-server-nestjs'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server