Skip to content

Commit ce04ab2

Browse files
committed
update cli.md
Signed-off-by: Yuchen Zhang <[email protected]>
1 parent cb31e79 commit ce04ab2

File tree

1 file changed

+184
-18
lines changed

1 file changed

+184
-18
lines changed

docs/source/reference/cli.md

Lines changed: 184 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,38 +158,204 @@ Options:
158158
--help Show this message and exit.
159159
```
160160

161-
### MCP
161+
## MCP
162162

163-
The `nat mcp serve` command (equivalent to `nat start mcp`) starts a Model Context Protocol (MCP) server that exposes workflow functions as MCP tools. This allows other applications that support the MCP protocol to use your NeMo Agent toolkit functions directly. MCP is an open protocol developed by Anthropic that standardizes how applications provide context to LLMs. The MCP front-end is especially useful for integrating NeMo Agent toolkit workflows with MCP-compatible clients.
163+
The `nat mcp` command group provides utilities for both serving workflows as MCP servers and interacting with MCP servers as a client.
164164

165-
The MCP front-end can be configured using the following options:
165+
### Client
166+
167+
The `nat mcp client` command group provides utilities for interacting with MCP servers directly from the command line. These commands are useful for discovering available tools and testing MCP server connectivity before configuring your workflow.
168+
169+
The `nat mcp client --help` utility provides an overview of the available commands:
170+
171+
```console
172+
$ nat mcp client --help
173+
Usage: nat mcp client [OPTIONS] COMMAND [ARGS]...
174+
175+
MCP client commands.
176+
177+
Options:
178+
--help Show this message and exit.
179+
180+
Commands:
181+
ping Ping an MCP server to check if it's responsive.
182+
tool Inspect and call MCP tools.
183+
```
184+
185+
#### Ping
186+
187+
```console
188+
$ nat mcp client ping --help
189+
Usage: nat mcp client ping [OPTIONS]
190+
191+
Ping an MCP server to check if it's responsive.
192+
193+
Options:
194+
--url TEXT MCP server URL (e.g.
195+
http://localhost:8080/mcp for streamable-
196+
http, http://localhost:8080/sse for sse)
197+
[default: http://localhost:9901/mcp]
198+
--transport [sse|stdio|streamable-http]
199+
Type of client to use for ping [default:
200+
streamable-http]
201+
--command TEXT For stdio: The command to run (e.g. mcp-
202+
server)
203+
--args TEXT For stdio: Additional arguments for the
204+
command (space-separated)
205+
--env TEXT For stdio: Environment variables in
206+
KEY=VALUE format (space-separated)
207+
--timeout INTEGER Timeout in seconds for ping request
208+
[default: 60]
209+
--json-output Output ping result in JSON format
210+
--auth-redirect-uri TEXT OAuth2 redirect URI for authentication
211+
(streamable-http only, not with --direct)
212+
--auth-user-id TEXT User ID for authentication (streamable-http
213+
only, not with --direct)
214+
--auth-scopes TEXT OAuth2 scopes (comma-separated, streamable-
215+
http only, not with --direct)
216+
--help Show this message and exit.
217+
```
218+
219+
#### Tool Commands
220+
221+
```console
222+
$ nat mcp client tool --help
223+
Usage: nat mcp client tool [OPTIONS] COMMAND [ARGS]...
224+
225+
Inspect and call MCP tools.
226+
227+
Options:
228+
--help Show this message and exit.
229+
230+
Commands:
231+
call Call a tool by name with optional arguments.
232+
list List tool names (default), or show details with --detail or --tool.
233+
```
234+
235+
##### List Tools
236+
237+
```console
238+
$ nat mcp client tool list --help
239+
Usage: nat mcp client tool list [OPTIONS]
240+
241+
List tool names (default), or show details with --detail or --tool.
242+
243+
Options:
244+
--direct Bypass MCPBuilder and use direct MCP
245+
protocol
246+
--url TEXT MCP server URL (e.g.
247+
http://localhost:8080/mcp for streamable-
248+
http, http://localhost:8080/sse for sse)
249+
[default: http://localhost:9901/mcp]
250+
--transport [sse|stdio|streamable-http]
251+
Type of client to use (default: streamable-
252+
http, backwards compatible with sse)
253+
[default: streamable-http]
254+
--command TEXT For stdio: The command to run (e.g. mcp-
255+
server)
256+
--args TEXT For stdio: Additional arguments for the
257+
command (space-separated)
258+
--env TEXT For stdio: Environment variables in
259+
KEY=VALUE format (space-separated)
260+
--tool TEXT Get details for a specific tool by name
261+
--detail Show full details for all tools
262+
--json-output Output tool metadata in JSON format
263+
--auth Enable OAuth2 authentication with default
264+
settings (streamable-http only, not with
265+
--direct)
266+
--auth-redirect-uri TEXT OAuth2 redirect URI for authentication
267+
(streamable-http only, not with --direct)
268+
--auth-user-id TEXT User ID for authentication (streamable-http
269+
only, not with --direct)
270+
--auth-scopes TEXT OAuth2 scopes (comma-separated, streamable-
271+
http only, not with --direct)
272+
--help Show this message and exit.
273+
```
274+
275+
##### Call Tool
276+
277+
```console
278+
$ nat mcp client tool call --help
279+
Usage: nat mcp client tool call [OPTIONS] TOOL_NAME
280+
281+
Call a tool by name with optional arguments.
282+
283+
Options:
284+
--direct Bypass MCPBuilder and use direct MCP
285+
protocol
286+
--url TEXT MCP server URL (e.g.
287+
http://localhost:8080/mcp for streamable-
288+
http, http://localhost:8080/sse for sse)
289+
[default: http://localhost:9901/mcp]
290+
--transport [sse|stdio|streamable-http]
291+
Type of client to use (default: streamable-
292+
http, backwards compatible with sse)
293+
[default: streamable-http]
294+
--command TEXT For stdio: The command to run (e.g. mcp-
295+
server)
296+
--args TEXT For stdio: Additional arguments for the
297+
command (space-separated)
298+
--env TEXT For stdio: Environment variables in
299+
KEY=VALUE format (space-separated)
300+
--json-args TEXT Pass tool args as a JSON object string
301+
--auth Enable OAuth2 authentication with default
302+
settings (streamable-http only, not with
303+
--direct)
304+
--auth-redirect-uri TEXT OAuth2 redirect URI for authentication
305+
(streamable-http only, not with --direct)
306+
--auth-user-id TEXT User ID for authentication (streamable-http
307+
only, not with --direct)
308+
--auth-scopes TEXT OAuth2 scopes (comma-separated, streamable-
309+
http only, not with --direct)
310+
--help Show this message and exit.
311+
```
312+
313+
### Serve
314+
315+
The `nat mcp serve` command (equivalent to `nat start mcp`) starts a Model Context Protocol (MCP) server that exposes workflow functions as MCP tools. This allows other applications that support the MCP protocol to use your NeMo Agent toolkit functions directly. MCP is an open protocol developed by Anthropic that standardizes how applications provide context to LLMs.
316+
317+
The `nat mcp serve --help` utility provides a brief description of each option:
166318

167319
```console
168320
$ nat mcp serve --help
169321
Usage: nat mcp serve [OPTIONS]
170322

323+
Run a NAT workflow using the mcp front end.
324+
171325
Options:
172-
--config_file FILE A JSON/YAML file that sets the parameters for the
173-
workflow. [required]
174-
--override <TEXT TEXT>... Override config values using dot notation (e.g.,
175-
--override llms.nim_llm.temperature 0.7)
176-
--name TEXT Name of the MCP server
177-
--host TEXT Host to bind the server to
178-
--port INTEGER Port to bind the server to
179-
--debug BOOLEAN Enable debug mode
180-
--log_level TEXT Log level for the MCP server
181-
--tool_names TEXT Comma-separated list of tool names to expose.
182-
If not provided, all functions will be exposed.
183-
--help Show this message and exit.
326+
--config_file FILE A JSON/YAML file that sets the parameters
327+
for the workflow. [required]
328+
--override <TEXT TEXT>... Override config values using dot notation
329+
(e.g., --override llms.nim_llm.temperature
330+
0.7)
331+
--name TEXT Name of the MCP server (default: NeMo Agent
332+
Toolkit MCP)
333+
--host TEXT Host to bind the server to (default:
334+
localhost)
335+
--port INTEGER Port to bind the server to (default: 9901)
336+
--debug BOOLEAN Enable debug mode (default: False)
337+
--log_level TEXT Log level for the MCP server (default: INFO)
338+
--tool_names TEXT The list of tools MCP server will expose
339+
(default: all tools)
340+
--transport [sse|streamable-http]
341+
Transport type for the MCP server (default:
342+
streamable-http, backwards compatible with
343+
sse)
344+
--runner_class TEXT Custom worker class for handling MCP routes
345+
(default: built-in worker)
346+
--server_auth OAUTH2RESOURCESERVERCONFIG
347+
OAuth 2.0 Resource Server configuration for
348+
token verification.
349+
--help Show this message and exit.
184350
```
185351

186-
For example, to start an MCP server with a specific workflow and expose only a particular tool:
352+
For example, to start an MCP server with a specific workflow:
187353

188354
```bash
189-
nat mcp serve --config_file examples/RAG/simple_rag/configs/milvus_rag_config.yml --tool_names mcp_retriever_tool
355+
nat mcp serve --config_file examples/getting_started/simple_calculator/configs/config.yml
190356
```
191357

192-
This will start an MCP server exposing the `mcp_retriever_tool` function from the workflow, which can then be accessed by any MCP-compatible client.
358+
This will start an MCP server on the default host (localhost) and port (9901), available at `http://localhost:9901/mcp`.
193359

194360
## Run
195361

0 commit comments

Comments
 (0)