mcp-agent-langchainjs
Serverless AI agent using LangChain.js and Model Context Protocol (MCP) integration to order burgers from a burger restaurant
claude mcp add --transport stdio azure-samples-mcp-agent-langchainjs node packages/burger-mcp/server.js \ --env MCP_HOST="0.0.0.0" \ --env MCP_PORT="5000" \ --env MCP_LOG_LEVEL="info"
How to use
This MCP server exposes the Burger API as MCP tools so that LangChain.js agents can discover, call, and manage burger-related actions (like browsing menus, placing orders, and checking status) via a standardized MCP interface. You can connect the LangChain.js agent to this MCP server to enable tool-based reasoning and dynamic tool invocation against the burger system. In practice, you’ll run the MCP server alongside the web UI and API services, then configure your agent to use the MCP transport to enumerate the available tools, invoke them, and handle tool results inside the agent’s reasoning loop.
How to install
Prerequisites:
- Node.js (LTS) 18+ installed on your machine
- Git installed
- Access to the repository (clone the project)
Installation steps:
-
Clone the repository git clone https://github.com/Azure-Samples/mcp-agent-langchainjs.git cd mcp-agent-langchainjs
-
Install dependencies for the burger MCP server and related packages mkdir -p packages/burger-mcp
If using a monorepo setup, install from the repo root
npm install
-
Verify the MCP server package exists ls packages/burger-mcp
-
Start the MCP server (in a terminal) npm run -w @Azure-Samples/mcp-agent-langchainjs start-burger-mcp
If a direct start script is provided, you can also run:
node packages/burger-mcp/server.js
-
Confirm the MCP server is listening (default port 5000) curl http://localhost:5000/health
-
(Optional) Run the full stack locally
- Start the Burger API
- Start the Agent Web App
- Start the MCP server (as shown above)
Note: If you are using a workspace setup, adjust commands to your package manager (pnpm/os). Replace the script names with the actual ones defined in your package.json.
Additional notes
Tips and common issues:
- Ensure Node.js version matches the project’s requirements (Node.js 22+ is recommended for newer samples).
- If the MCP server fails to bind to a port, verify the PORT environment variable is not in use and that you have the necessary permissions.
- When using MCP tools from LangChain.js, ensure the transport (Streamable HTTP) is configured correctly in your agent so that it can discover and call MCP tools.
- If you encounter CORS or network issues when calling MCP endpoints from the UI, check the host bindings and any reverse proxy configuration in your local environment.
- Review the project’s architecture docs to understand how the Burger MCP server ties into the Burger API and the web UIs.
- For local development, you can mock external APIs or use the provided burger-data scripts to seed data without hitting real services.
Related MCP Servers
lihil
2X faster ASGI web framework for python, offering high-level development, low-level performance.
XPack -Marketplace
The world’s first open-source MCP monetization platform, to quickly create and sell your own MCP server in just minutes. | XPack 是全球首个开源 MCP 交易平台,帮助你在10分钟内快速搭建自己的 MCP 商店并立刻开始销售 MCP 服务。
api
MCP server from hostinger/api-mcp-server
n8n-workflow-builder
MCP server that allow LLM in agent mode builds n8n workflows for you
openai -agent-dotnet
Sample to create an AI Agent using OpenAI models with any MCP server running on Azure Container Apps
website-publisher
AI Website builder and publisher MCP. Quickly publish and deploy your AI generated code as real website URL. Support html, css, js, python etc.