Skip to main content
Glama
nvapi-profile-mcp

nvapi-profile-mcp

by Paktion
README.md
<div align="center">

# nvapi-profile-mcp

**Let your AI assistant tune NVIDIA driver settings, per game, the same way the NVIDIA Control Panel does.**

[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)
![Platform: Windows](https://img.shields.io/badge/platform-Windows-0078D6.svg)
![MCP](https://img.shields.io/badge/MCP-server-8A2BE2.svg)
![NVIDIA](https://img.shields.io/badge/NVIDIA-NVAPI-76B900.svg)

</div>

---

`nvapi-profile-mcp` is a [Model Context Protocol](https://modelcontextprotocol.io) server that exposes the NVIDIA driver's **per-application profile database** (the thing behind *NVIDIA Control Panel → Manage 3D settings → Program Settings*) as tools an AI assistant can call.

Ask Claude *"make League run with max-performance power management"* and it finds the game's driver profile, checks the current value, writes the new one, and reads it back.

- **Talks to the driver directly** through NVAPI's DRS API (`nvapi64.dll`, which ships with every NVIDIA driver) via `ctypes`.
- **No extra software:** no NVIDIA Profile Inspector, no registry edits, no compiled helpers.
- **Safe by default:** refuses to write settings the driver can't name, reports before/after values, and can undo any change.

```text
You:    What NVIDIA settings does League of Legends use? Make it prefer max performance.

Claude: ⚙ get_profile("League of Legends.exe")
        → profile "League of Legends" (NVIDIA predefined), 4 executables, 31 settings
        ⚙ set_setting("League of Legends.exe", "Power management mode", 1)
        → before: not set · after: 0x00000001 — "Prefer maximum performance" · saved
        Done. League now runs with Power management = Prefer maximum performance.
```

---

## Contents

- [Requirements](#requirements)
- [Install](#install)
- [Tools](#tools)
- [Recipes](#recipes)
- [Setting reference](#setting-reference)
- [Safety model](#safety-model)
- [Troubleshooting](#troubleshooting)
- [How it works](#how-it-works)
- [Development](#development)
- [FAQ](#faq)
- [License](#license)

---

## Requirements

| | |
|---|---|
| **OS** | Windows 10 / 11 (64-bit) |
| **GPU** | Any NVIDIA GPU with the standard display driver installed |
| **Runtime** | [uv](https://docs.astral.sh/uv/) (it fetches Python 3.10+ and dependencies automatically) |
| **Permissions** | Reading usually works from a normal prompt. **Saving changes requires Administrator** (the driver database is system-wide). |

---

## Install

### Claude Code

```powershell
claude mcp add nvapi-profile -- uvx --from git+https://github.com/Paktion/nvapi-profile-mcp nvapi-profile-mcp
```

To let it **change** settings, start Claude Code from a terminal opened with **Run as administrator**.

### Claude Desktop

Add this to `%APPDATA%\Claude\claude_desktop_config.json` and restart Claude Desktop:

```json
{
  "mcpServers": {
    "nvapi-profile": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/Paktion/nvapi-profile-mcp", "nvapi-profile-mcp"]
    }
  }
}
```

### Any other MCP client

It's a standard **stdio** server. The command is:

```text
uvx --from git+https://github.com/Paktion/nvapi-profile-mcp nvapi-profile-mcp
```

### From source

```powershell
git clone https://github.com/Paktion/nvapi-profile-mcp
cd nvapi-profile-mcp
uv run nvapi-profile-mcp          # starts the stdio server
```

---

## Tools

Most tools take a **`target`**, the profile to work on:

| `target` value | Means |
|---|---|
| `"League of Legends.exe"` | The profile that contains this executable (how the driver itself picks settings for a game) |
| `"global"` | The global/base profile that applies to everything |
| `"profile:Cyberpunk 2077"` | A profile by its exact name |

and a **`setting`**, given as a hex id (`"0x1057EB71"`) or the driver's exact display name (`"Power management mode"`).

### `driver_info()`
Driver version and branch.
```json
{ "driver_version": "621.47", "branch": "r621_44" }
```

### `search_settings(query = "")`
Every setting your driver has a display name for, filtered by a case-insensitive substring. Includes human-readable values for common settings.
```json
[
  { "id": "0x1194F158", "name": "Enable G-SYNC globally" },
  { "id": "0x00A879CF", "name": "Vertical Sync",
    "known_values": { "0x60925292": "Use the 3D application setting", "0x08416747": "Force off",
                      "0x47814940": "Force on", "0x18888888": "Fast Sync" } }
]
```

### `get_profile(target)`
Which profile applies, whether NVIDIA ships it predefined, and every setting stored on it (including hidden ones, labelled as such).
```json
{
  "profile": "League of Legends",
  "is_predefined_by_nvidia": true,
  "applications": 4,
  "settings": [
    { "id": "0x1057EB71", "name": "Power management mode", "type": "dword",
      "value": "0x00000001 (1)", "is_driver_default": false,
      "location": "current_profile", "meaning": "Prefer maximum performance" }
  ]
}
```

### `get_setting(target, setting)`
One setting. If it isn't set on that profile, it says so (the global value then applies).

### `set_setting(target, setting, value, create_if_missing = false, allow_unnamed = false)`
Writes a 32-bit (DWORD) value, saves it to the driver, and returns **before and after**.
```json
{
  "profile": "League of Legends", "id": "0x1057EB71", "name": "Power management mode",
  "before": "not set", "after": "0x00000001 (1)",
  "meaning": "Prefer maximum performance", "saved": true
}
```
- `create_if_missing`: create a new profile for an executable the driver doesn't know yet.
- `allow_unnamed`: permit writing an id the driver has no display name for (see [Safety model](#safety-model)).

### `reset_setting(target, setting)`
Removes your override so NVIDIA's default applies again. This is the undo button.

---

## Recipes

Just ask in plain language. These are the calls the assistant will make.

**Competitive / low latency for one game**
> "Set up `VALORANT-Win64-Shipping.exe` for lowest latency."
```text
set_setting(target, "Power management mode",       1)   # Prefer maximum performance
set_setting(target, "Maximum pre-rendered frames", 1)   # = Low Latency Mode: On
```

**G-SYNC-friendly frame cap** (with G-SYNC on, cap a few FPS under your refresh rate)
> "Cap League at 237 FPS and force V-Sync on; I have a 240 Hz G-SYNC monitor."
```text
set_setting("League of Legends.exe", "Frame Rate Limiter", 237)
set_setting("League of Legends.exe", "Vertical Sync",      0x47814940)   # Force on
```

**Cap a launcher or older game that runs uncapped**
> "Limit `javaw.exe` (Minecraft) to 141 FPS."
```text
set_setting("javaw.exe", "Frame Rate Limiter", 141, create_if_missing=true)
```

**Audit and undo**
> "What have I changed on the League profile? Put power management back to default."
```text
get_profile("League of Legends.exe")
reset_setting("League of Legends.exe", "Power management mode")
```

---

## Setting reference

The settings people change most. Run `search_settings` to see everything your driver exposes.

| Setting | Id | Values |
|---|---|---|
| Power management mode | `0x1057EB71` | `0` Adaptive · `1` **Prefer maximum performance** · `2` Driver controlled · `3` Prefer consistent performance · `4` Prefer minimum power · `5` Optimal power / Normal |
| Vertical Sync | `0x00A879CF` | `0x60925292` Use the 3D app setting · `0x47814940` **Force on** · `0x08416747` Force off · `0x18888888` Fast Sync · `0x32610244` / `0x71271021` / `0x13245256` flip interval 2 / 3 / 4 |
| Maximum pre-rendered frames | `0x007BA09E` | `0` Use the 3D app setting · `1` = **Low Latency Mode: On** · `2`–`4` frames |
| Frame Rate Limiter | `0x10835002` | FPS cap as a number (e.g. `237`) · `0` off |
| Enable G-SYNC globally | `0x1194F158` | See the driver's values (not decoded by this tool yet) |

> **Note on "Ultra" low latency:** the Control Panel's *Low Latency Mode → Ultra* is stored in settings the driver doesn't name, so this server won't write them unless you explicitly pass `allow_unnamed=true` with the exact id. *Low Latency Mode: On* (`Maximum pre-rendered frames = 1`) is fully supported.

---

## Safety model

Driver settings are system-wide and persist across reboots, so the server is deliberately conservative:

| Guard | Why |
|---|---|
| **Unnamed ids are refused** | If the driver has no display name for an id, it's hidden or the model mistyped it. Writing it requires `allow_unnamed=true`. |
| **Before/after on every write** | You can always see exactly what changed. |
| **One-step undo** | `reset_setting` deletes your override and NVIDIA's default comes back. |
| **No accidental profiles** | Unknown executables are only given a new profile with `create_if_missing=true`. |
| **DWORD writes only** | String and binary settings are shown read-only. |
| **Sessions are scoped** | Each call opens a fresh driver session; read-only calls never save. |

The test suite's write test runs inside an **unsaved** session on a throwaway profile, so running the tests can't change your real settings.

---

## Troubleshooting

| Symptom | Fix |
|---|---|
| `nvapi64.dll not found` | Install or repair the NVIDIA display driver. This only works on NVIDIA GPUs. |
| Writes fail with a privilege / permission error | Run your MCP client as **Administrator** (for Claude Code, start the terminal with *Run as administrator*). |
| `No driver profile contains 'game.exe'` | Use the exact executable name (as shown in Task Manager → Details), or pass `create_if_missing=true`. |
| `Setting 0x… has no driver display name` | It's a hidden setting. Double-check the id, then retry with `allow_unnamed=true` only if you're sure. |
| Change doesn't seem to apply | Restart the game. Drivers read profile settings at launch. |
| `NVAPI function … is not available in this driver` | Very old driver. Update to a current NVIDIA driver. |

---

## How it works

```text
 MCP client (Claude)                         nvapi-profile-mcp                       NVIDIA driver
 ───────────────────                         ─────────────────                       ─────────────
  tool call  ──stdio──▶  MCPServer tools  ──▶  Nvapi / Session (ctypes)  ──▶  nvapi64.dll
                         (server.py)          (nvapi.py)                       └─ nvapi_QueryInterface(id)
                                                                                   └─ DRS_* functions
                                                                                        └─ profile database
```

`nvapi64.dll` exports a single function, `nvapi_QueryInterface(id)`, which returns pointers to the real NVAPI functions. This package:

1. Resolves the DRS functions it needs by interface id (`DRS_CreateSession`, `DRS_LoadSettings`, `DRS_FindApplicationByName`, `DRS_EnumSettings`, `DRS_GetSetting`, `DRS_SetSetting`, `DRS_SaveSettings`, `DRS_DeleteProfileSetting`, ...).
2. Lays out `NVDRS_SETTING_V1`, `NVDRS_PROFILE_V1` and `NVDRS_APPLICATION_V1` buffers by hand, with versions computed exactly like NVAPI's `MAKE_NVAPI_VERSION`.
3. Wraps each tool call in its own session: load → read/modify → save (writes only) → destroy.

Code layout:

```text
src/nvapi_profile_mcp/
├── nvapi.py          # ctypes NVAPI/DRS wrapper (Nvapi, Session, Setting)
├── server.py         # MCP tools
└── known_values.py   # human-readable values for common settings
tests/test_nvapi.py   # struct layout tests + real-driver tests (auto-skipped without NVIDIA)
examples/smoke_test.py  # calls every tool read-only against your driver
```

---

## Development

```powershell
uv sync
uv run pytest                        # unit tests; hardware tests run if an NVIDIA driver is present
uv run python examples/smoke_test.py # exercise the MCP tools read-only against your driver
```

Want to add friendly values for more settings? Extend `KNOWN_VALUES` in [`known_values.py`](src/nvapi_profile_mcp/known_values.py). Values come from NVIDIA's `NvApiDriverSettings.h`. PRs welcome.

**Ideas / roadmap**
- Decode more settings (G-SYNC modes, texture filtering, shader cache size)
- Export/import a profile's overrides as JSON
- Optional read-only mode flag

---

## FAQ

**How is this different from NVIDIA Profile Inspector?**
Same underlying API, different audience. Profile Inspector is a GUI for humans. This is a small, dependency-free server so an AI assistant can make targeted, explained, reversible changes.

**Does it change anything on its own?**
No. It only acts when your MCP client calls a tool, and only `set_setting` / `reset_setting` write anything.

**Will a driver update wipe my changes?**
Normal ("express") driver updates keep user overrides. A *clean* install resets them. Run `get_profile` afterwards to check.

**Does it work on AMD or Intel GPUs?**
No. NVAPI is NVIDIA-only.

---

## License

[MIT](LICENSE). Not affiliated with or endorsed by NVIDIA. "NVIDIA", "G-SYNC" and "NVAPI" are trademarks of NVIDIA Corporation.

TDQS

A3.5/5.0

Scored across 6 tools

Disambiguation4/5

Each tool has a recognizably distinct role: discovery (search_settings), whole-profile read (get_profile), single-value read (get_setting), and write operations (set_setting, reset_setting). The only mild overlap is between get_profile, which dumps every setting, and get_setting, which reads one, but the descriptions make the intended use clear.

Naming Consistency4/5

Five of six tools follow a clean verb_noun pattern (search_settings, get_profile, get_setting, set_setting, reset_setting), and the get/set/reset family is very predictable. driver_info breaks the pattern as a noun phrase, but it is the lone deviation and remains readable.

Tool Count5/5

Six tools is well-scoped: one informational, one discovery, two read variants, and two write variants covering set and revert. Every tool earns its place with no filler.

Completeness4/5

The surface covers the core lifecycle: discover settings, inspect a profile, read a value, override it, and revert NVIDIA's default. Minor gaps exist around enumerating available targets/application profiles (e.g. listing which exes have profiles) and bulk or backup/restore operations, which agents can work around by passing known exe names.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues