MCP Streamable HTTP Demo
TP5 MCP Streamable HTTP デモ
このプロジェクトは、以下のデモ目的を再現します。
2つのツールを公開する MCP サーバー。
@modelcontextprotocol/inspectorによるテスト。Streamable HTTP 経由で MCP を使用する LangChain/LangGraph 互換エージェント。
Streamable HTTP 経由で MCP を使用する n8n AI エージェントのセットアップ。
重要なセキュリティ上の注意
プロンプトに貼り付けられた OpenAI キーがチャットで公開されました。エージェントを実行する前に、そのキーを無効化し、新しいキーを作成してください。新しいキーは .env に記述し、コミットしないでください。
Related MCP server: SampleMCP
セットアップ
Copy-Item .env.example .env
npm install.env を編集し、以下を設定します。
OPENAI_API_KEY=your_new_keyMCP サーバーの起動
npm run serverMCP エンドポイントは以下の通りです。
http://127.0.0.1:3000/mcpヘルスチェックエンドポイントは以下の通りです。
http://127.0.0.1:3000/healthMCP Inspector によるテスト
1つのターミナルでサーバーを実行し続けます。
npm run server別のターミナルで、Inspector CLI を使用してツールを一覧表示します。
npm run inspector:list-toolsWindows では、現在の Inspector CLI は正しい JSON レスポンスを出力した後に Node/libuv のアサーションで終了する場合があります。calculate と text_stats を含む tools JSON が表示されていれば、MCP 呼び出し自体は成功しています。
Inspector CLI でツールを呼び出します。
npx --yes @modelcontextprotocol/inspector --cli http://127.0.0.1:3000/mcp --transport http --method tools/call --tool-name calculate --tool-arg operation=add --tool-arg "numbers=[2,3,4]"Inspector UI を開くこともできます。
npm run inspector次に、以下を選択します。
Transport: Streamable HTTP
URL: http://127.0.0.1:3000/mcpローカルスモークテスト
npm run smokeこれにより、MCP ツールが一覧表示され、calculate が呼び出されます。
LangChain エージェント
サーバーが実行されており、.env に有効で更新された OPENAI_API_KEY が含まれていることを確認してください。
npm run agentカスタムプロンプト:
npm run agent -- "Calcule 42 / 6 puis analyse le texte: Bonjour depuis MCP."n8n エージェント
docs/n8n-agent.md に従ってください。
n8n MCP クライアントツールの設定は以下の通りです。
Endpoint: http://127.0.0.1:3000/mcp
Server Transport: HTTP Streamable
Authentication: None
Tools to Include: AllThis server cannot be deployed
Maintenance
Related MCP Connectors
Open-source Zapier/n8n alternative as an MCP server: agents build, run and debug your workflows.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA Python-based MCP server demonstrating basic math and text tools, supporting both SSE and STDIO transports for integration with AI assistants like Cline in VS Code.-
- FlicenseNot gradedqualityDmaintenanceA demonstration MCP server that provides math (add/multiply) and weather tools, connecting via stdio and streamable HTTP, and integrates with LangChain and LangGraph for agentic workflows.-
- FlicenseNot gradedqualityDmaintenanceProvides math and weather tools accessible via LangGraph agent using MCP protocol with stdio and streamable HTTP transports.1-
- FlicenseNot gradedqualityDmaintenanceA calculator MCP server providing add and subtract tools, along with file resources and a code review prompt, supporting in-memory, HTTP, and STDIO transports. It also includes a LangGraph ReAct agent example that uses the tools.-