Cover image
Try Now
2025-04-03

用于构建模型上下文协议(MCP)应用程序的启动模板

3 years

Works with Finder

1

Github Watches

1

Github Forks

1

Github Stars

boot-mcp

npm version npm downloads bundle JSDocs License javascript_code style

A comprehensive starter template for building Model Context Protocol (MCP) applications with TypeScript.

What is MCP?

The Model Context Protocol (MCP) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:

  • Expose data through Resources (think of these sort of like GET endpoints; they are used to load information into the LLM's context)
  • Provide functionality through Tools (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)
  • Define interaction patterns through Prompts (reusable templates for LLM interactions)
  • Set boundaries with Roots (defining the operational scope for servers)
  • Enable agent behaviors with Sampling (allowing servers to request completions from LLMs)
  • Establish connections via Transports (communication mechanisms between clients and servers)

Installation

# npm
npm install

# pnpm
pnpm install

# yarn
yarn install

Quick Start

This template includes examples of MCP servers with different transports:

  • Stdio transport (for command-line tools and direct integrations)
  • HTTP with SSE transport (for remote servers)

Running the Example Server

# Start the stdio server
pnpm start:basic

# Start the HTTP server
pnpm start:http

Project Structure

boot-mcp/
├── src/
│   ├── index.ts          # Main entry point
│   ├── server/           # MCP server implementations
│   │   ├── basic.ts      # Basic server with common functionality
│   │   └── http.ts       # HTTP with SSE transport server
│   ├── resources/        # Resource implementations
│   │   └── index.ts      # Common resource types and utilities
│   ├── tools/            # Tool implementations
│   │   └── index.ts      # Various tools organized by category
│   ├── prompts/          # Prompt implementations
│   │   └── index.ts      # Common prompt templates and workflows
│   ├── roots/            # Root management
│   │   └── index.ts      # Root definition and utilities
│   ├── transports/       # Transport implementations
│   │   └── index.ts      # Stdio and HTTP/SSE transports
│   └── sampling/         # Sampling utilities (experimental)
│       └── index.ts      # LLM sampling capabilities
├── examples/             # Example usage
│   ├── basic-server.ts   # Basic stdio server example
│   └── http-server.ts    # HTTP server example
└── test/                 # Tests

Features

Resources

  • Text and binary resource support
  • Dynamic resource templates with parameters
  • Standard resource types (files, system info, etc.)
  • Resource content helpers

Tools

  • System operation tools (execute commands, read files, etc.)
  • Data processing tools (JSON parsing, CSV analysis, etc.)
  • Utility tools (random generators, string transformations, etc.)
  • Calculator and basic tools

Prompts

  • Simple greeting and text processing prompts
  • Code review prompts with language detection
  • Multi-step debugging workflows
  • Resource-based prompt templates

Roots

  • File system root management
  • URI validation and filtering
  • Standard root templates

Transports

  • Stdio transport for terminal applications
  • HTTP/SSE transport for web applications
  • Unified configuration interface

Sampling (Experimental)

  • Text completion requests
  • Conversation-based sampling
  • Model preference controls
  • Agent workflow examples

License

MIT License © Kirk Lin

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • Khalid kalib
  • Write professional emails

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • ANGEL LEON
  • A world class elite tech co-founder entrepreneur, expert in software development, entrepreneurship, marketing, coaching style leadership and aligned with ambition for excellence, global market penetration and worldy perspectives.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • HiveNexus
  • 一个适用于中小型团队的AI聊天机器人,支持DeepSeek,Open AI,Claude和Gemini等车型。 专为中小团队设计的ai聊天应用,支持deepSeek,打开ai,claude,双子座等模型。

    Reviews

    5 (1)
    Avatar
    user_cARvhQ24
    2025-04-15

    I've been using example-mcp-server by megmogmog1965 for a while now, and it has surpassed my expectations. The ease of setup and intuitive interface make managing my projects straightforward. The welcoming messages and well-defined starting URL enhance user experience greatly. I highly recommend it to anyone needing a reliable MCP application. Check it out here: https://mcp.so/server/example-mcp-server/megmogmog1965