Skip to content

flamekk/Model-Context-Protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TP5 MCP Streamable HTTP Demo

This project recreates the demo objective:

  • MCP server exposing two tools.
  • Test with @modelcontextprotocol/inspector.
  • LangChain/LangGraph-compatible agent using MCP over Streamable HTTP.
  • n8n AI Agent setup using MCP over Streamable HTTP.

Important security note

The OpenAI key pasted in the prompt was exposed in chat. Revoke it and create a new key before running the agent. Put the new key in .env; do not commit it.

Setup

Copy-Item .env.example .env
npm install

Edit .env and set:

OPENAI_API_KEY=your_new_key

Start the MCP server

npm run server

The MCP endpoint is:

http://127.0.0.1:3000/mcp

The health endpoint is:

http://127.0.0.1:3000/health

Test with MCP Inspector

In one terminal, keep the server running:

npm run server

In another terminal, list the tools with the Inspector CLI:

npm run inspector:list-tools

On Windows, the current Inspector CLI can print the correct JSON response and then exit with a Node/libuv assertion. If you see the tools JSON containing calculate and text_stats, the MCP call itself succeeded.

Call a tool with the 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]"

You can also open the Inspector UI:

npm run inspector

Then select:

Transport: Streamable HTTP
URL: http://127.0.0.1:3000/mcp

Local smoke test

npm run smoke

This lists the MCP tools and calls calculate.

LangChain agent

Make sure the server is running and .env contains a valid rotated OPENAI_API_KEY.

npm run agent

Custom prompt:

npm run agent -- "Calcule 42 / 6 puis analyse le texte: Bonjour depuis MCP."

n8n agent

Follow docs/n8n-agent.md.

The n8n MCP Client Tool configuration is:

Endpoint: http://127.0.0.1:3000/mcp
Server Transport: HTTP Streamable
Authentication: None
Tools to Include: All

About

Créer un serveur MCP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors