Skip to main content
Glama
Abhishek4512009

NVIDIA NIM MCP Server

README.md
# NVIDIA NIM MCP Server Guide

This guide describes the custom Model Context Protocol (MCP) server configured to execute local tasks using the user's NVIDIA NIM API quota.

---

## 🗄️ File Locations

*   **MCP Server Implementation:** [server.js](file:///C:/Users/kanna/nvidia-nim-mcp/server.js)
*   **MCP Config Registration:** [mcp_config.json](file:///C:/Users/kanna/.gemini/antigravity-cli/mcp_config.json)
*   **MCP Local Schema Directory:** [nvidia-nim/](file:///C:/Users/kanna/.gemini/antigravity-cli/mcp/nvidia-nim/)
    *   [nim_run_file.json](file:///C:/Users/kanna/.gemini/antigravity-cli/mcp/nvidia-nim/nim_run_file.json)
    *   [nim_chat.json](file:///C:/Users/kanna/.gemini/antigravity-cli/mcp/nvidia-nim/nim_chat.json)
    *   [nim_list_models.json](file:///C:/Users/kanna/.gemini/antigravity-cli/mcp/nvidia-nim/nim_list_models.json)

---

## 🛠️ Available Tools & Schema

### 1. `nim_run_file`
Send a file's content to a NIM LLM with processing instructions, writing output directly to the filesystem.
*   **Arguments:**
    *   `inputFile` (string, required): Absolute path to the source code or text file.
    *   `outputFile` (string, required): Absolute path where the processed result should be written.
    *   `instruction` (string, required): Prompt telling the model what to do with the file content.
    *   `model` (string, optional): Model ID to use. Defaults to `meta/llama-3.3-70b-instruct`.
    *   `systemPrompt` (string, optional): Optional system prompt to instruct the model.

### 2. `nim_chat`
Send a direct prompt query to a NIM LLM model.
*   **Arguments:**
    *   `prompt` (string, required): Prompt string.
    *   `model` (string, optional): Model ID. Defaults to `meta/llama-3.3-70b-instruct`.
    *   `systemPrompt` (string, optional): Optional system prompt.

### 3. `nim_list_models`
Queries the NGC endpoint and returns all available model IDs.
*   **Arguments:** None.

---

## 💡 Token-Saving Guidelines for Agents

To optimize token usage in our conversation window:
1.  **Do not pass raw file content** to the model in standard prompts.
2.  Instead, use `nim_run_file` and supply the `inputFile` and `outputFile` paths.
3.  This offloads the entire payload extraction and output generation directly to the NIM API, keeping our chat history clean of huge text blocks.