# rpk ai mcp-server tools call

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [agentic-data-plane-full.txt](https://docs.redpanda.com/agentic-data-plane-full.txt)

---
title: rpk ai mcp-server tools call
latest-operator-version: v26.2.1
latest-console-tag: v3.10.0
latest-connect-version: 4.105.0
latest-redpanda-tag: v26.2.1
docname: rpk/rpk-ai/rpk-ai-mcp-server-tools-call
page-component-name: agentic-data-plane
page-version: master
page-component-version: master
page-component-title: Agentic Data Plane
page-relative-src-path: rpk/rpk-ai/rpk-ai-mcp-server-tools-call.adoc
page-edit-url: https://github.com/redpanda-data/adp-docs/edit/main/modules/reference/pages/rpk/rpk-ai/rpk-ai-mcp-server-tools-call.adoc
description: Invoke a tool on an MCP server through the aigw MCP proxy. The server's /mcp/v1/<name> endpoint is reached with the same bearer token used by the rest of <code>rpk ai</code>; aigw resolves user-delegated OAuth tokens from the vault when the MCP server is configured with <code>--user-oauth-provider</code>.
page-git-created-date: "2026-07-28"
page-git-modified-date: "2026-08-06"
---

<!-- Source: https://docs.redpanda.com/agentic-data-plane/reference/rpk/rpk-ai/rpk-ai-mcp-server-tools-call.md -->

Invoke a tool on an MCP server through the aigw MCP proxy.

The server’s /mcp/v1/<name> endpoint is reached with the same bearer token used by the rest of `rpk ai`; aigw resolves user-delegated OAuth tokens from the vault when the MCP server is configured with `--user-oauth-provider`.

Arguments passed to the tool are a JSON object supplied via `--args`. Example:

```text
rpk ai mcp tools call gf-servicenow-sand2 listtablerecords \
  --args '{"tableName":"incident","sysparm_limit":3}'
```

With `--code-mode` the call targets the virtual code-mode sibling endpoint (/mcp/v1/<name>-code). That endpoint exposes search (tool catalog for the primary) and execute (runs JavaScript in a sandbox with call\_tool bound to the primary’s tools). Example:

```text
rpk ai mcp tools call pg-garrett execute --code-mode \
  --args '{"code":"var r = call_tool({name:\"query\", arguments:{query:\"SELECT 1\"}}); JSON.stringify(r);"}'
```

> 📝 **NOTE**
>
> This command was introduced in ai version 0.2.28.

## [](#usage)Usage

```bash
rpk ai mcp-server tools call [flags]
```

## [](#flags)Flags

| Value | Type | Description |
| --- | --- | --- |
| --args | string | JSON object of tool arguments, for example, '{foo:`bar`}'. Empty means no arguments. |
| --code-mode | bool | Target the virtual code-mode sibling endpoint (<server>-code) instead of the primary. |

## [](#global-flags)Global flags

| Value | Type | Description |
| --- | --- | --- |
| --config | string | Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml. |
| -X, --config-opt | stringArray | Override rpk configuration settings; -X help for detail or -X list for terser detail. |
| --ignore-profile | bool | Ignore rpk.yaml and redpanda.yaml; use default settings. |
| --profile | string | rpk profile to use. |
| -v, --verbose | bool | Enable verbose logging. |