Get the FREE Ultimate OpenClaw Setup Guide →

mcp-agent-langchainjs

Serverless AI agent using LangChain.js and Model Context Protocol (MCP) integration to order burgers from a burger restaurant

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

  1. Clone the repository git clone https://github.com/Azure-Samples/mcp-agent-langchainjs.git cd mcp-agent-langchainjs

  2. 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

  3. Verify the MCP server package exists ls packages/burger-mcp

  4. 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

  5. Confirm the MCP server is listening (default port 5000) curl http://localhost:5000/health

  6. (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

Sponsor this space

Reach thousands of developers