Token导航 LogoToken导航TokenDH.com
MCP Template Node logo
AI代理未说明官方级别未说明来源级核验

MCP Template Node

MCP Server

A template repository for creating Model Context Protocol (MCP) servers in Node.js/TypeScript. This template demonstrates how to build a simple notes management system using the MCP protocol, which can be used with LLM-powered applications.

工具数

0

提示词数

0

GitHub Stars

1

资源数

0
知识管理TypeScriptAI代理

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Rethunk-Tech

提供方

Rethunk-Tech

最后核验

2026/5/18 04:55

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

MCP模板节点

用于在Node.js/TypeScript中创建模型上下文协议(MCP)服务器的模板存储库。此模板演示了一个使用MCP协议的简单笔记管理系统。

什么是MCP?

模型上下文协议(MCP)是应用程序向大型语言模型(LLM)提供上下文的标准化方法。更多信息请访问 模型上下文协议网站.

特性

  • 具有严格类型检查的TypeScript实现
  • 具有基本CRUD操作的简单笔记管理系统
  • MCP概念的完整示例(工具、资源、提示)
  • 用于存储笔记的内存
  • 全面的错误处理和验证
  • 使用Vitest进行单元测试
  • VS代码调试配置
  • 用于测试和构建的GitHub Actions CI工作流

先决条件

  • Node.js 18或更高版本
  • npm或纱线

项目结构

mcp-template-node/
├── build/                # Compiled JavaScript files
├── src/
│   ├── __tests__/        # Integration tests and test utilities
│   ├── errors/           # Custom error classes
│   ├── tools/            # MCP tool implementations
│   │   └── __tests__/    # Tool unit tests
│   ├── types/            # TypeScript type definitions
│   │   └── __tests__/    # Type tests
│   └── index.ts          # Main server entry point with MCP examples
├── package.json          # Project configuration
├── tsconfig.json         # TypeScript configuration
├── eslint.config.mjs     # ESLint flat configuration
└── README.md             # Project documentation

入门指南

  1. 克隆存储库:
   git clone https://github.com/Rethunk-Tech/mcp-template-node.git
   cd mcp-template-node
  1. 安装依赖项:
   yarn install
  1. 构建并运行服务器:
   yarn build
   yarn start

发展

  • 在监视模式下启动TypeScript编译器: yarn dev
  • 打开你的代码: yarn lint
  • 修复掉毛问题: yarn lint:fix
  • 运行测试: yarn test

测试

该项目包括全面的测试,以验证MCP服务器及其工具的功能。

运行测试

运行所有测试:

yarn test

在监视模式下运行测试(文件更改时重新运行测试):

yarn test:watch

运行覆盖率测试:

yarn test:coverage

测试结构

  • 单元测试:位于 __tests__ 他们测试的代码附近的目录
  • 集成测试:位于 src/__tests__/
  • 公共应用接口模块:常见的测试助手 src/__tests__/test-utils.ts

写作测试

该项目包括一个MockMcpServer,用于测试没有真正MCP依赖关系的工具:

import { MockMcpServer } from '../__tests__/test-utils.js';

describe('My Tool Tests', () => {
  let server: MockMcpServer;

  beforeEach(() => {
    server = new MockMcpServer();
    // Register tools
    registerMyTools(server as any);
  });

  it('should perform some action', async () => {
    const result = await server.callTool('my_tool', { param: 'value' });
    expect(result.content[0].text).toContain('Expected text');
  });
});

MCP检验员测试

对于独立测试,请使用MCP检查器工具:

yarn inspector

这将打开一个交互式会话,您可以在其中测试MCP工具。

可用工具

创建便笺

创建带有标题和内容的新注释。

列表注释

列出所有可用的笔记及其ID和标题。

获取注释

按ID检索特定笔记。

更新说明

更新现有笔记的标题、内容或标签。

删除注释

按ID删除笔记。

扩展模板

要扩展此模板,请执行以下操作:

  1. 在中添加新类型 src/types/
  2. 在中实施新工具 src/tools/
  3. 在中添加新资源 src/index.ts
  4. 根据需要创建新的提示模板
  5. 为新功能添加测试

贡献

贡献.md 了解如何为这个项目做出贡献的指导方针。

许可证

麻省理工学院

目录标签

目录标签

知识管理TypeScriptAI代理developer-toolsnodejsmcpllmllm-toolsmcp-servermodelcontextprotocolMCP协议本地部署Node.js笔记管理LLM上下文

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP