Mcp Server Template

io.github.qmmughal由 GitHub 账号 qmmughal 发布v1.0.0更新于 Oct 24, 2026

Production-grade MCP Server Template for TypeScript and Node.js.

已验证STDIO仅桌面开发者工具

概览

AI 生成的概览

这是一个用 TypeScript 和 Node.js 构建 MCP 服务器的起步模板,本身不提供任何现成工具。

可以做什么
清单中没有列出任何工具,因此它不会给助手带来现成能力。它是一个项目脚手架:严格的 TypeScript 配置、用 Zod 校验工具输入和环境变量、用 esbuild 打包成单个文件,以及写入 stderr 的 pino 日志,以免干扰 stdout 上的 JSON-RPC 传输。它把工具、资源、提示词和服务分模块组织,并附带 Vitest 测试、类型检查、监听模式的开发脚本和生产构建。它还说明了如何把构建好的服务器接入 Claude Desktop 或 Cursor,以及推送版本标签时自动发布到 npm 和 MCP Registry 的流程。
适用场景
适合准备用 TypeScript 新写一个 MCP 服务器、希望样板代码、校验、日志和测试框架都已就绪的开发者。若只是想让助手获得现成工具,则不适合。
运行要求
需要本机的 Node.js 和 npm,因为它以本地 stdio 进程运行。需要克隆仓库、执行 npm install,并复制示例环境文件来配置变量。接入客户端时需要指向构建产物 dist/index.js 的绝对路径。
安装前请注意
示例客户端配置中出现了 API 密钥占位符和日志级别变量,你需要为自己构建的内容提供真实密钥。发布流程需要一个对该作用域包名有发布权限的 npm 自动化令牌。模板中工具的实际行为及其安全性需要你自己实现和把关。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Mcp Server Template,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Enterprise MCP Server Template 🚀

[TypeScript] [Node.js] [Model Context Protocol] [License: MIT]

A production-ready, enterprise-grade template for building Model Context Protocol (MCP) servers in TypeScript and Node.js. Designed for scalability, type safety, and seamless integration with AI agents like Claude Desktop and Cursor.

📖 About

The Model Context Protocol (MCP) standardizes how AI models interact with local and remote resources. This template provides a robust foundation for building your own custom MCP servers, eliminating boilerplate and enforcing best practices.

Key Features

  • Strict TypeScript: Modern ECMAScript targets with rigorous type safety.
  • Zod Validation: Runtime schema validation for tool inputs and environment variables, ensuring your server never crashes from malformed AI payloads.
  • Fast Bundling (esbuild): Compiles the entire server into a single, optimized executable (dist/index.js), eliminating the need to deploy node_modules.
  • Safe Structured Logging: Pre-configured pino logger writing safely to stderr, preserving the integrity of the stdout JSON-RPC transport required by MCP.
  • Modular Architecture: Clean separation of Tools, Resources, Prompts, and Services.
  • Vitest Integration: Blazing fast unit testing out of the box.

🚀 Getting Started

1. Installation

Clone the repository and install dependencies:

bash
git clone https://github.com/qmmughal/mcp-server-template.gitcd mcp-server-templatenpm install

2. Configuration

Copy the example environment file and configure your variables:

bash
cp .env.example .env

3. Development Workflow

Start the server in watch mode for local development:

bash
npm run dev

Run the test suite:

bash
npm test

Verify typings:

bash
npm run typecheck

4. Production Build

Bundle the server into a single, optimized executable:

bash
npm run build

The output will be generated at dist/index.js.

🔌 Connecting to an MCP Client

Claude Desktop

To connect this server to the Claude Desktop app, edit your Claude configuration file (usually found at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on Mac):

json
{  "mcpServers": {    "enterprise-template-server": {      "command": "node",      "args": ["/absolute/path/to/mcp-server-template/dist/index.js"],      "env": {        "LOG_LEVEL": "info",        "EXAMPLE_API_KEY": "your_api_key_here"      }    }  }}

Cursor

In Cursor, navigate to Settings -> Features -> MCP and add a new MCP server:

  • Type: command
  • Command: node /absolute/path/to/mcp-server-template/dist/index.js

🏗️ Architecture Overview

  • src/index.ts: Application entrypoint, capability registration, and stdio connection setup.
  • src/tools/: Definitions and JSON schemas for MCP Tools (actions the AI can take).
  • src/resources/: Dynamic resources via URI templating (data the AI can read).
  • src/prompts/: Reusable agent prompt templates.
  • src/services/: Core business logic, keeping protocol handlers thin and testable.
  • src/utils/errors.ts: Standardized error handling aligned with MCP error codes.

📦 Publishing & Registry

package.json is publish-ready (scoped name @qmmughal/mcp-server-template, license, repository, keywords), and server.json + .github/workflows/publish-mcp.yml are wired up to publish to both npm and the MCP Registry automatically whenever a v* tag is pushed:

bash
git tag v1.0.0git push origin v1.0.0

The workflow needs one repo secret before it can run: NPM_TOKEN (an npm automation token with publish rights to the @qmmughal scope). MCP Registry auth uses GitHub OIDC, so no extra secret is needed there.

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

📝 License

This project is MIT licensed.

来源:README.md,提交 40ac81f

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分