rpk ai mcp-server tools call
Invoke a tool on an MCP server through the AI Gateway MCP proxy.
The command reaches the server’s /mcp/v1/<name> endpoint with the same bearer token as the rest of rpk ai. If the server uses user-delegated OAuth, AI Gateway authenticates the call with your stored connection for that server’s OAuth provider.
Pass the tool’s arguments as a JSON object with --args. Example:
rpk ai mcp-server tools call my-servicenow listtablerecords \
--args '{"tableName":"incident","sysparm_limit":3}'
With --code-mode, the call targets the server’s code mode endpoint (/mcp/v1/<name>-code). That endpoint exposes search, which returns the server’s tool catalog, and execute, which runs JavaScript in a sandbox with call_tool bound to the server’s tools. Example:
rpk ai mcp-server tools call my-postgres execute --code-mode \
--args '{"code":"var r = call_tool({name:\"query\", arguments:{query:\"SELECT 1\"}}); JSON.stringify(r);"}'
| This command was introduced in ai version 0.2.28. |
Flags
| Value | Type | Description |
|---|---|---|
|
string |
JSON object of tool arguments, for example, '{ |
|
bool |
Target the virtual code-mode sibling endpoint (<server>-code) instead of the primary. |
Global flags
| Value | Type | Description |
|---|---|---|
|
string |
Redpanda or |
|
stringArray |
Override |
|
bool |
Ignore |
|
string |
|
|
bool |
Enable verbose logging. |