IS

iceener/streamable-mcp-server-template

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

145 stars 55 forks Качество 76 Тренд 30MIT

iceener/streamable-mcp-server-template — это кандидат на MCP-сервер, импортированный из https://github.com/iceener/streamable-mcp-server-template.

Обзор

iceener/streamable-mcp-server-template — это кандидат на MCP-сервер, импортированный из https://github.com/iceener/streamable-mcp-server-template.

Обзор (машинный перевод)

Этот шаблон является удалёным сервером Model Context Protocol (MCP). Он работает на Bun и на Cloudflare Workers. Использует официальный SDK MCP TypeScript.

Сервер использует версию протокола 2026-07-28. Он также принимает клиенты, использующие версии протокола 2025 года.

Шаблон включает следующие функции:

  • Проверки заголовков Host и Origin.
  • Проверка токена OAuth. Сервер является сервером ресурсов OAuth. Ваш код не получает токен.
  • Политика ошибок. Сервер не отправляет внутренние данные об ошибках клиентам.
  • Тесты, которые запускаются на Bun и на работниках Cloudflare.

Примерный сервер предоставляет погодные данные из Open-Meteo. Open-Meteo не требует API-ключа. Замените образцы своими инструментами. Оставьте остальные части шаблона.

Требования

  • Булочка 1.4 или позже.
  • Node.js 22:18 или позже. Команды Wrangler и дымовые тесты используют Node.js.

Запусти сервер

  1. Установите зависимости:

  2. Запустить сервер:

URL сервера — http://127.0.0.1:3000/mcp.

Чтобы использовать локальное время выполнения Cloudflare, запустите bun run dev:worker. Тогда URL сервера — http://127.0.0.1:8787/mcp.

Соедините клиента

Используйте URL сервера и потоковый HTTP-транспорт.

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

MCP Server Template

This template is a remote Model Context Protocol (MCP) server. It runs on Bun and on Cloudflare Workers. It uses the official MCP TypeScript SDK.

The server uses protocol version 2026-07-28. It also accepts clients that use the 2025 protocol versions.

The template includes these functions:

  • Checks of the Host and Origin headers.
  • OAuth token checks. The server is an OAuth resource server. Your code does not receive the token.
  • An error policy. The server does not send internal error data to clients.
  • Tests that run on Bun and on Cloudflare Workers.

The sample server gives weather data from Open-Meteo. Open-Meteo does not require an API key. Replace the samples with your tools. Keep the other parts of the template.

Requirements

  • Bun 1.4 or later.
  • Node.js 22.18 or later. The Wrangler commands and the smoke tests use Node.js.

Start the server

  1. Install the dependencies:

    bun install
    
  2. Start the server:

    bun run dev
    

The server URL is http://127.0.0.1:3000/mcp.

To use the Cloudflare local runtime, run bun run dev:worker. The server URL is then http://127.0.0.1:8787/mcp.

Connect a client

Use the server URL and the Streamable HTTP transport.

Client Procedure
MCP Inspector Run bun run inspector. Select Streamable HTTP. Enter the server URL.
Claude Code Run claude mcp add --transport http weather http://127.0.0.1:3000/mcp.
VS Code Add { "servers": { "weather": { "type": "http", "url": "http://127.0.0.1:3000/mcp" } } } to .vscode/mcp.json.
Cursor Add { "mcpServers": { "weather": { "url": "http://127.0.0.1:3000/mcp" } } } to ~/.cursor/mcp.json.

To test the connection, send a request. For example: “What is the weather in Kraków this week?”

Samples

Each sample shows one procedure.

Sample Type Shows
get-forecast Tool A call to an external API through a service. It shows cancellation, progress, and errors that the model can correct.
echo Tool The smallest complete tool: an input schema, an output schema, and annotations.
whoami Tool How to read the identity of the verified caller.
confirm-action Tool How to ask the user for approval during a call (input_required). The tool also requires an OAuth scope.
docs://server/guide Resource A static resource.
weather://codes/{code} Resource template How to list, read, and complete URIs from a template.
weather-briefing Prompt Prompt arguments and argument completion.

Project structure

src/
  server.ts       Server identity, dependencies, token verification, extra routes, McpServer factory
  settings.ts     Settings for your code, for example API keys
  tools/          ┐
Открыть полный README на GitHub

Установка

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

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →