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 分