Skip to main content
Glama

MCP Server NestJS

by Cstannahill

MCP 服务器 (NestJS)

使用NestJS构建的健壮、可扩展且易于扩展的服务器端应用程序。该项目为帖子和用户提供了模型上下文协议 (MCP) 服务器实现、文件管理、身份验证和模块化 REST API。


目录


特征

  • MCP 服务器:实现文件操作等的模型上下文协议。
  • 文件管理:通过 REST 端点上传、下载、列出和删除文件。
  • 身份验证:基于 JWT 的本地策略身份验证。
  • 用户和帖子模块:具有 DTO 和实体的用户和帖子的模块化结构。
  • Swagger 集成:开箱即用的 API 文档。
  • 可扩展:轻松添加新模块和功能。

建筑学

  • NestJS :用于构建高效、可靠且可扩展的服务器端应用程序的渐进式 Node.js 框架。
  • MCP 集成:使用自定义 FileBrowserMCP 进行文件操作。
  • 模块化设计:每个功能都封装在自己的模块中。

入门

先决条件

安装

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

环境变量

在根目录中创建一个.env文件,用于保存任何机密或配置覆盖(可选)。


发展

运行服务器

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

有用的命令

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

测试

运行单元测试

$ npm run test

运行端到端(e2e)测试

$ npm run test:e2e

测试覆盖率

$ npm run test:cov

部署

  1. 构建项目:
    $ npm run build
  2. 启动服务器:
    $ npm run start:prod
  3. 对于高级部署(Docker、云等),请参阅NestJS 部署文档

API 参考

  • 当服务器运行时,Swagger UI 可在/api上使用(如果启用)。
  • 主要终点:
    • POST /auth/login — 验证并接收 JWT
    • POST /files/upload — 上传文件
    • GET /files/:id — 下载文件
    • DELETE /files/:id — 删除文件
    • GET /files — 列出文件
    • POST /users — 创建用户
    • POST /posts — 创建帖子

有关更多详细信息,请参阅src/中的控制器文件。


项目结构

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)

贡献

  1. 分叉存储库
  2. 创建你的功能分支( git checkout -b feature/YourFeature
  3. 提交您的更改( git commit -am 'Add some feature'
  4. 推送到分支( git push origin feature/YourFeature
  5. 打开拉取请求

编码标准

  • 遵循现有的代码风格(参见 ESLint 配置)
  • 为新功能编写单元测试和端到端测试
  • 记录您的代码并根据需要更新 README

Git 设置

该项目使用 Git 进行版本控制。远程源设置为:

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

执照

Nest 已获得 MIT 许可


资源与支持


如有任何疑问、问题或功能请求,请打开问题或联系维护人员。

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

一个强大的服务器端应用程序,它为文件操作实现模型上下文协议 (MCP),为管理文件、用户和帖子提供身份验证和模块化 REST API。

  1. 目录
    1. 特征
      1. 建筑学
        1. 入门
          1. 先决条件
          2. 安装
          3. 环境变量
        2. 发展
          1. 运行服务器
          2. 有用的命令
        3. 测试
          1. 运行单元测试
          2. 运行端到端(e2e)测试
          3. 测试覆盖率
        4. 部署
          1. API 参考
            1. 项目结构
              1. 贡献
                1. 编码标准
              2. Git 设置
                1. 执照
                  1. 资源与支持

                    Related MCP Servers

                    • -
                      security
                      A
                      license
                      -
                      quality
                      MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
                      Last updated -
                      4
                      3
                      TypeScript
                      MIT License
                    • -
                      security
                      A
                      license
                      -
                      quality
                      MCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.
                      Last updated -
                      13
                      2
                      TypeScript
                      MIT License
                    • -
                      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 -
                      47
                      1
                      JavaScript
                      MIT License
                      • Linux
                    • A
                      security
                      F
                      license
                      A
                      quality
                      A Model Context Protocol (MCP) server that interacts with system APIs, allowing users to check connections, search employees, register breakfast, and update chemical information by shifts.
                      Last updated -
                      21
                      76
                      JavaScript

                    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