Model Context Protocol (MCP) is an open protocol developed by Anthropic that standardizes how applications provide context to LLMs. This guide covers how to run NVIDIA NeMo Agent Toolkit workflows as an MCP server using the FastMCP server runtime.
NeMo Agent Toolkit supports two MCP server runtimes. Both publish the workflow and its tools as MCP tools. Choose the runtime that matches your deployment stack and MCP server policy of the organization:
- Use
nat mcp servefor the MCP SDK server runtime. - Use
nat fastmcp server runfor the FastMCP server runtime. - For the MCP SDK server guide, see NeMo Agent Toolkit as an MCP Server.
- MCP client commands and configuration require the MCP SDK package (
nvidia-nat-mcp).
:::{warning}
The nvidia-nat-fastmcp package depends on the beta release of FastMCP3 and is not recommended for production use. This warning will be removed when FastMCP3 is generally available.
:::
Install the nvidia-nat-fastmcp package:
uv pip install nvidia-nat-fastmcpFor MCP client commands and configuration, install the nvidia-nat-mcp package:
uv pip install nvidia-nat-mcpUse nat fastmcp server run to start an MCP server using the FastMCP server runtime and publish workflow tools.
nat fastmcp server run --config_file examples/getting_started/simple_calculator/configs/config.ymlThis starts an MCP server using the FastMCP server runtime on the default host (localhost) and port (9902) and publishes all workflow tools at http://localhost:9902/mcp using streamable-http transport.
You can also specify server settings with CLI flags:
nat fastmcp server run --config_file examples/getting_started/simple_calculator/configs/config.yml \
--host 0.0.0.0 \
--port 9902 \
--name "My FastMCP Server"Use nat fastmcp server dev to restart the server when files change. This is useful when you iterate on workflow code or configuration.
nat fastmcp server dev --config_file examples/getting_started/simple_calculator/configs/config.yml \
--watch-path examples/getting_started/simple_calculator/srcBy default, developer mode ignores common noisy files such as *.log, *.tmp, and *.temp.
To further control which changes trigger reloads, use include and exclude globs:
--reload-include-globnarrows reloads to matching paths.--reload-exclude-globremoves matches from that set.- When include globs are provided, they take precedence over default excludes.
nat fastmcp server dev --config_file examples/getting_started/simple_calculator/configs/config.yml \
--watch-path examples/getting_started/simple_calculator/src \
--reload-include-glob "*.py" \
--reload-include-glob "*.yml" \
--reload-exclude-glob "*.log"Use nat fastmcp server install to generate MCP client configuration snippets for a FastMCP server. This command does not modify your environment.
nat fastmcp server install cursor --url http://localhost:9902/mcpSample output:
{
"mcpServers": {
"mcp_server": {
"transport": "streamable-http",
"url": "http://localhost:9902/mcp"
}
}
}To generate a MCP client configuration YAML snippet for a workflow configuration:
nat fastmcp server install nat-workflow --url http://localhost:9902/mcp --name mcp_mathSample output:
function_groups:
mcp_math:
_type: per_user_mcp_client
server:
transport: streamable-http
url: http://localhost:9902/mcpFor a full command reference, see Command Line Interface.
You can publish a subset of tools using the --tool_names flag:
nat fastmcp server run --config_file examples/getting_started/simple_calculator/configs/config.yml \
--tool_names calculator__multiply \
--tool_names calculator__divideTo mount the server at a custom base path, set base_path in the configuration file:
general:
front_end:
_type: fastmcp
name: "my_fastmcp_server"
base_path: "/api/v1"With this configuration, the MCP server is accessible at http://localhost:9902/api/v1/mcp.
Use nat mcp client to inspect and run tools exposed by an MCP server using the FastMCP server runtime.
Note: The nat mcp client commands require the nvidia-nat-mcp package. If you encounter an error about missing MCP client functionality, install it with uv pip install "nvidia-nat[mcp]".
$ nat mcp client tool list --url http://localhost:9902/mcp
calculator__divide
calculator__compare
calculator__subtract
calculator__add
calculator__multiply$ nat mcp client tool list --url http://localhost:9902/mcp --tool calculator__multiply --detail
Tool: calculator__multiply
Description: Multiply two or more numbers together.
Input Schema:
{
"properties": {
"numbers": {
"description": "",
"items": {
"type": "number"
},
"title": "Numbers",
"type": "array"
}
},
"required": [
"numbers"
],
"title": "Calculator__MultiplyInputSchema",
"type": "object"
}nat mcp client tool call calculator__multiply \
--url http://localhost:9902/mcp \
--json-args '{"numbers": [1, 3, 6, 10]}'
180.0curl -s http://localhost:9902/debug/tools/list | jqThe MCP server started with the FastMCP server runtime implements the Model Context Protocol specification, so it works with MCP clients. You can run a workflow that connects to the MCP server by pointing an MCP client function group at http://localhost:9902/mcp.
Example:
nat run --config_file examples/MCP/simple_calculator_fastmcp/configs/config-mcp-client.yml \
--input "Is 2 times 2 greater than the current hour?"MCP servers started with the FastMCP server runtime can validate bearer tokens using OAuth2 token introspection. Configure server_auth in your front end config with the introspection endpoint and client credentials.
See the protected example for a full setup:
examples/MCP/simple_calculator_fastmcp_protected
You can verify server health using the /health route or nat mcp client ping:
curl -s http://localhost:9902/health | jqnat mcp client ping --url http://localhost:9902/mcpexamples/MCP/simple_calculator_fastmcp/: FastMCP calculator exampleexamples/MCP/simple_calculator_fastmcp_protected/: Protected FastMCP calculator example