# IBM watsonx.ai Granite

Brings IBM Granite models from your own watsonx.ai project into the agent: chat, generation, embeddings, token counting and time-series forecasting.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 249
- Author: nirholas
- License: Apache-2.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/nirholas/three.ws/tree/HEAD/packages/ibm-watsonx-mcp
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/mcp/ibm-watsonxai-granite

## What it does

The server talks to the watsonx.ai REST API directly using your IBM Cloud credentials. It trades `WATSONX_API_KEY` for a short-lived IAM bearer token, keeps that token in memory and refreshes it shortly before expiry. Nothing sits in between.

Six tools come with it: `watsonx_chat`, `watsonx_generate`, `watsonx_embed`, `watsonx_tokenize`, `watsonx_forecast` and `watsonx_list_models`. Each one only runs inference and leaves your account untouched; annotations like `readOnlyHint` and `idempotentHint` tell the client so.

You need Node.js 20 or newer, an IBM Cloud account with watsonx.ai enabled, an API key and a project id. This is a community project with no ties to IBM. Pass the key and project id as environment variables — the server won't start without them.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `WATSONX_API_KEY`, `WATSONX_PROJECT_ID`, `WATSONX_SPACE_ID`, `WATSONX_URL`, `WATSONX_MODEL_ID`, `WATSONX_EMBED_MODEL_ID`, `WATSONX_API_VERSION` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env WATSONX_API_KEY=<WATSONX_API_KEY> --env WATSONX_PROJECT_ID=<WATSONX_PROJECT_ID> --env WATSONX_SPACE_ID=<WATSONX_SPACE_ID> --env WATSONX_URL=<WATSONX_URL> --env WATSONX_MODEL_ID=<WATSONX_MODEL_ID> --transport stdio ibm-watsonx-mcp -- npx -y @three-ws/ibm-watsonx-mcp
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Codex

**Platform CLI**
```bash
codex mcp add ibm-watsonx-mcp --env WATSONX_API_KEY=<WATSONX_API_KEY> --env WATSONX_PROJECT_ID=<WATSONX_PROJECT_ID> --env WATSONX_SPACE_ID=<WATSONX_SPACE_ID> --env WATSONX_URL=<WATSONX_URL> --env WATSONX_MODEL_ID=<WATSONX_MODEL_ID> -- npx -y @three-ws/ibm-watsonx-mcp
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "ibm-watsonx-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@three-ws/ibm-watsonx-mcp"
            ],
            "env": {
                "WATSONX_API_KEY": "<WATSONX_API_KEY>",
                "WATSONX_PROJECT_ID": "<WATSONX_PROJECT_ID>",
                "WATSONX_SPACE_ID": "<WATSONX_SPACE_ID>",
                "WATSONX_URL": "<WATSONX_URL>",
                "WATSONX_MODEL_ID": "<WATSONX_MODEL_ID>"
            }
        }
    }
}
```
Replace <…> with your own values. 2 more environment variables are in the server README

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "ibm-watsonx-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@three-ws/ibm-watsonx-mcp"
            ],
            "env": {
                "WATSONX_API_KEY": "<WATSONX_API_KEY>",
                "WATSONX_PROJECT_ID": "<WATSONX_PROJECT_ID>",
                "WATSONX_SPACE_ID": "<WATSONX_SPACE_ID>",
                "WATSONX_URL": "<WATSONX_URL>",
                "WATSONX_MODEL_ID": "<WATSONX_MODEL_ID>"
            }
        }
    }
}
```
Replace <…> with your own values. 2 more environment variables are in the server README

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e WATSONX_API_KEY=<WATSONX_API_KEY> -e WATSONX_PROJECT_ID=<WATSONX_PROJECT_ID> -e WATSONX_SPACE_ID=<WATSONX_SPACE_ID> -e WATSONX_URL=<WATSONX_URL> -e WATSONX_MODEL_ID=<WATSONX_MODEL_ID> ibm-watsonx-mcp npx -y @three-ws/ibm-watsonx-mcp
```
Replace <…> with your own values. 2 more environment variables are in the server README

## When to use it
- send a prompt to Granite from inside the agent
- embed a batch of strings in one call
- count tokens before spending them
- forecast a time series without training a model
- see which foundation models your region offers

## Example prompts
- Ask `watsonx_chat` to explain MCP in one sentence
- Run `watsonx_embed` on the strings “lakehouse” and “data warehouse”
- List embedding models only via `watsonx_list_models`

## Similar
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [labelhead-artist-momentum](https://affpapa.org/en/nevibecode/mcp/labelhead-artist-momentum.md) — MCP server · ★ 107423
- [Agent Skills Search Server](https://affpapa.org/en/nevibecode/mcp/agent-skills-search-server.md) — MCP server · ★ 26559
- [Skyvern](https://affpapa.org/en/nevibecode/mcp/skyvern.md) — MCP server · ★ 23263
- [Nhost](https://affpapa.org/en/nevibecode/mcp/nhost.md) — MCP server · ★ 9366
- [PraisonAI](https://affpapa.org/en/nevibecode/mcp/praisonai.md) — MCP server · ★ 9289

From the same set: [nirholas/three.ws](https://affpapa.org/en/nevibecode/by/nirholas/three.ws.md) — 29 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
