IS

iceener/streamable-mcp-server-template

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

146 stars 55 forks 品質 76 トレンド 30MIT

iceener/streamable-mcp-server-template は、https://github.com/iceener/streamable-mcp-server-template.からインポートされたMCPサーバー候補です。

概要

iceener/streamable-mcp-server-template は、https://github.com/iceener/streamable-mcp-server-template.からインポートされたMCPサーバー候補です。

概要(AI 翻訳)

このテンプレートはリモートのModel Context Protocol(MCP)サーバーです。BunおよびCloudflare Workers上で動作します。公式のMCP TypeScript SDKを使用しています。

サーバーはプロトコルバージョン2026-07-28を使用しています。また、2025プロトコルバージョンを使用するクライアントも受け入れています。

テンプレートには以下の機能が含まれています:

  • HostおよびOriginヘッダーのチェック。
  • OAuthトークンチェック。サーバーはOAuthリソースサーバーです。あなたのコードはトークンを受け取りません。
  • エラーポリシー。サーバーは内部エラーデータをクライアントに送信しません。
  • BunおよびCloudflare Workers上で実行されるテスト。

サンプルサーバーはOpen-Meteoの天候データを提供します。Open-MeteoはAPIキーを必要としません。サンプルはツールに置き換えてください。テンプレートの他の部分はそのままにしてください。

要件

  • バン1.4以降。
  • Node.js 22.18以降。ラングラーコマンドとスモークテストでは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とStreamable HTTPトランスポートを使いましょう。

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

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/          ┐
GitHub で README 全文を見る

インストール

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

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →