AB

aashari/boilerplate-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

74 stars 22 forks 质量 56 趋势 0

aashari/boilerplate-mcp-server 是从 https://github.com/aashari/boilerplate-mcp-server. 导入的 MCP 服务器候选

概览

aashari/boilerplate-mcp-server 是从 https://github.com/aashari/boilerplate-mcp-server. 导入的 MCP 服务器候选

概述(AI 翻译)

为在TypeScript中开发定制模型上下文协议(MCP)服务器提供生产准备基础。提供完整的分层架构模式、工作示例实现以及全面的开发者基础设施,将AI助手与外部API和数据源连接起来。

最新更新(2026年2月):更新至MCP SDK 1.26.0和Zod 4.3.6,继续保持现代registerTool模式和可流式HTTP改进。详情请参见docs/MODERNIZATION.md。

特色

  • 安全优先:DNS重绑定保护,仅本地主机绑定,安全错误处理
  • 双重传输支持:支持STDIO和带自动备份的可流式HTTP传输
  • 分层架构:CLI、工具、资源、提示符、控制器、服务和工具之间的清晰分离
  • 类型安全:完整的TypeScript实现,包含Zod v4.3.6模式验证
  • 所有MCP原语:工具、资源和提示符(含示例)
  • ResourceLink 模式:大型响应的高效资源引用
  • TOON 输出格式:基于代币的对象表示法,符号数比 JSON 少 30-60%

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Boilerplate MCP Server

A production-ready foundation for developing custom Model Context Protocol (MCP) servers in TypeScript. Provides a complete layered architecture pattern, working example implementation, and comprehensive developer infrastructure to connect AI assistants with external APIs and data sources.

Latest Update (Feb 2026): Updated to MCP SDK 1.26.0 and Zod 4.3.6 with continued modern registerTool patterns and streamable HTTP improvements. See docs/MODERNIZATION.md for details.

Features

  • Security First: DNS rebinding protection, localhost-only binding, secure error handling
  • Dual Transport Support: STDIO and Streamable HTTP transports with automatic fallback
  • Layered Architecture: Clean separation between CLI, tools, resources, prompts, controllers, services, and utilities
  • Type Safety: Full TypeScript implementation with Zod v4.3.6 schema validation
  • All MCP Primitives: Tools, resources, and prompts (with examples)
  • ResourceLink Pattern: Token-efficient resource references for large responses
  • TOON Output Format: Token-Oriented Object Notation for 30-60% fewer tokens than JSON
  • JMESPath Filtering: Extract only needed fields from responses to reduce token costs
  • Raw Response Logging: Automatic logging of large API responses to /tmp/mcp// with truncation guidance
  • Modern SDK: Uses MCP SDK v1.26.0 with registerTool API pattern (ready for v2 migration)
  • Complete IP Address Example: Tools, resources, prompts, and CLI commands for IP geolocation
  • Comprehensive Testing: Unit and integration tests with coverage reporting (47 tests passing)
  • Production Tooling: ESLint, Prettier, semantic-release, and MCP Inspector integration
  • Error Handling: Structured error handling with isError field and contextual logging
  • Security Documentation: Complete SECURITY.md with authentication implementation guides

What is MCP?

Model Context Protocol (MCP) is an open standard for securely connecting AI systems to external tools and data sources. This boilerplate implements the MCP specification with a clean, layered architecture that can be extended to build custom MCP servers for any API or data source.

Prerequisites

  • Node.js (>=20.x): Download
  • Git: For version control

Quick Start

# Clone the repository
git clone https://github.com/aashari/boilerplate-mcp-server.git
cd boilerplate-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Run in different modes:

# 1. CLI Mode - Execute commands directly
npm run cli -- get-ip-details 8.8.8.8
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →