Complexity: 🟢 Beginner
This example demonstrates how to run the NVIDIA NeMo Agent Toolkit as an MCP server using the FastMCP server runtime and use those tools from a Model Context Protocol (MCP) client workflow.
This example mirrors the simple_calculator_mcp workflow, but it uses the FastMCP server command and defaults to port 9902. The FastMCP server integration comes from nvidia-nat-fastmcp, and the MCP client commands and configuration use nvidia-nat-mcp.
- Agent toolkit: Ensure you have the NVIDIA NeMo Agent Toolkit installed. If you have not already done so, follow the instructions in the Install Guide to create the development environment and install the toolkit.
- Base workflow: This example builds upon the Getting Started Simple Calculator example. Make sure you are familiar with the example before proceeding.
If you have not already done so, follow the instructions in the Install Guide to create the development environment and install the toolkit.
Install this example:
uv pip install -e examples/MCP/simple_calculator_fastmcp- Start the MCP server using the FastMCP server runtime:
nat fastmcp server run --config_file examples/getting_started/simple_calculator/configs/config.ymlThis starts an MCP server on port 9902 with endpoint /mcp and uses streamable-http transport.
- Inspect the tools available on the MCP server using the MCP client:
nat mcp client tool list --url http://localhost:9902/mcpSample output:
calculator__add
calculator__subtract
calculator__multiply
calculator__divide
calculator__compare
- Run the workflow:
nat run --config_file examples/MCP/simple_calculator_fastmcp/configs/config-mcp-client.yml --input "Is the product of 2 * 4 greater than the current hour of the day?"The client configuration is in examples/MCP/simple_calculator_fastmcp/configs/config-mcp-client.yml.
examples/MCP/simple_calculator_fastmcp_protected/: Protected FastMCP calculator example
- FastMCP Server - Learn about running the FastMCP server runtime
- MCP Client - Learn about using the MCP client to interact with the MCP server