IBM watsonx.ai Granite

io.github.nirholas由 GitHub 账号 nirholas 发布v0.2.2更新于 Oct 24, 2026

IBM watsonx.ai MCP by three.ws: chat, text generation, embeddings, and tokenization.

发布方自己的服务:Granite

已验证STDIO仅桌面数据与分析AI 与机器学习

概览

AI 生成的概览

本地 MCP 服务器,让助手调用 IBM watsonx.ai Granite 模型进行对话、文本生成、向量嵌入、分词和预测。

可以做什么
使用 watsonx.ai 基础模型进行对话和文本生成,支持解码参数并返回 token 用量。为最多 1000 段文本批量生成嵌入向量。按模型分词器统计 token 数量,并可选返回 token 列表。对带时间戳的数值序列执行零样本时间序列预测。列出账户和区域可用的基础模型,可按功能筛选。
适用场景
当你已有开通 watsonx.ai 的 IBM Cloud 账户,希望助手直接调用 Granite 模型完成对话、生成、嵌入、token 计数或短期预测,而不经过中间服务时使用。
运行要求
通过 npx 在本地运行,需要 Node.js 20 或更高版本。需要已开通 watsonx.ai 的 IBM Cloud 账户,在 WATSONX_API_KEY 中提供 IBM Cloud API 密钥,并在 WATSONX_PROJECT_ID 中提供项目 ID,或在 WATSONX_SPACE_ID 中提供空间 ID。可选变量用于设置区域主机、模型 ID、API 版本和超时。需要访问 IBM Cloud 的网络连接。
安装前请注意
服务器持有 IBM Cloud API 密钥并用它换取短期 IAM 令牌,应将该密钥视为敏感凭据,避免写入共享配置。推理调用会计入你的 IBM Cloud 账户,可能产生费用。工具被描述为只读推理,不会修改账户或本地环境。该服务器由社区构建,与 IBM 无隶属关系。

安装

在 SourceWeft 中

  1. 打开 控制台中的 IBM watsonx.ai Granite,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[three.ws]

@three-ws/ibm-watsonx-mcp

MCP server for IBM watsonx.ai — chat, generation, embeddings, tokenization, forecasting, and model discovery, on your own IBM Cloud account.

[npm] [downloads] [license] [node] [MCP Registry] [three.ws]

Install · Quick start · Tools · Requirements · three.ws


A Model Context Protocol server that exposes IBM watsonx.ai — IBM Granite foundation models and anything else in your account — to MCP clients such as Claude Desktop, Claude Code, and Cursor. It talks directly to the watsonx.ai as-a-Service REST API with your own IBM Cloud credentials: it mints an IAM bearer token from your API key, caches it until just before expiry, and scopes every call to your project. No intermediary backend, no telemetry, no mock data.

Community-built and not affiliated with IBM. Registry name: io.github.nirholas/ibm-watsonx.

Install

bash
npm install @three-ws/ibm-watsonx-mcp

Run it directly with npx (no install needed):

bash
WATSONX_API_KEY=... WATSONX_PROJECT_ID=... npx @three-ws/ibm-watsonx-mcp

Or install globally to get the ibm-watsonx-mcp binary on your PATH:

bash
npm install -g @three-ws/ibm-watsonx-mcp

Quick start

With Claude Code, one command:

bash
claude mcp add ibm-watsonx -e WATSONX_API_KEY=... -e WATSONX_PROJECT_ID=... -- npx -y @three-ws/ibm-watsonx-mcp

Or add the server to your MCP client config (claude_desktop_config.json, Cursor's mcp.json):

json
{	"mcpServers": {		"ibm-watsonx": {			"command": "npx",			"args": ["-y", "@three-ws/ibm-watsonx-mcp"],			"env": {				"WATSONX_API_KEY": "your-ibm-cloud-api-key",				"WATSONX_PROJECT_ID": "your-watsonx-project-id"			}		}	}}

Restart the client and the six tools below appear. Inspect the surface manually with the MCP Inspector:

bash
npx -y @modelcontextprotocol/inspector npx @three-ws/ibm-watsonx-mcp

Tools

ToolWhat it does
watsonx_chatChat completion from a list of role/content messages. Returns the reply plus token usage.
watsonx_generateRaw prompt completion with decoding control (greedy/sample, stop sequences).
watsonx_embedEmbedding vectors for one or more texts (up to 1000). One vector per input plus dimensionality.
watsonx_tokenizeToken count (and optionally the tokens) for a text against a model tokenizer.
watsonx_forecastZero-shot time-series forecasting with an IBM Granite TimeSeries (TinyTimeMixer) model.
watsonx_list_modelsList the foundation models available to your account and region, optionally filtered.

Every tool is a read-only model-inference call — nothing in your environment or IBM account is modified — and declares MCP tool annotations (readOnlyHint, openWorldHint, idempotentHint) so clients can reason about side effects.

Input parameters

watsonx_chat — messages (required: array of { role, content }, roles system/user/assistant), model, max_tokens (1–4096), temperature (0–2), top_p (0–1).

watsonx_generate — input (required), model, max_new_tokens (1–4096), temperature (0–2), decoding_method (greedy/sample), stop_sequences.

watsonx_embed — inputs (required: 1–1000 texts), model.

watsonx_tokenize — input (required), model, return_tokens (boolean).

watsonx_forecast — timestamps (required: ISO-8601, uniform cadence, oldest first), values (required: numeric, same length), freq (required: pandas cadence, e.g. 1h, 15min, 1D), model, target_column, prediction_length (1–96).

watsonx_list_models — filter (e.g. function_text_generation, function_embedding), limit (1–200, default 100).

Example calls

jsonc
// watsonx_chat{ "messages": [{ "role": "user", "content": "Explain MCP in one sentence." }] }
// watsonx_generate{ "input": "Write a haiku about Kubernetes.", "decoding_method": "sample", "temperature": 0.7, "max_new_tokens": 60 }
// watsonx_embed{ "inputs": ["lakehouse", "data warehouse"] }
// watsonx_forecast{ "timestamps": ["2025-01-01T00:00:00Z", "2025-01-01T01:00:00Z"], "values": [1200, 1180], "freq": "1h", "prediction_length": 24 }
// watsonx_list_models{ "filter": "function_embedding" }

How auth works

WATSONX_API_KEY is exchanged for a short-lived IAM bearer token at https://iam.cloud.ibm.com/identity/token (grant_type=urn:ibm:params:oauth:grant-type:apikey). The token is cached in-process and refreshed about five minutes before it expires. Your API key never leaves your machine except in that single IAM exchange.

Requirements

  • Node.js >= 20.
  • An IBM Cloud account with watsonx.ai provisioned — sign up (free tier available).
  • An IBM Cloud API key — create one at https://cloud.ibm.com/iam/apikeys.
  • Your watsonx.ai project id — open the project → Manage → General → Project ID (or a deployment space id).

Environment variables

VariableRequiredDefault
WATSONX_API_KEYyes—
WATSONX_PROJECT_IDyes (or WATSONX_SPACE_ID)—
WATSONX_SPACE_IDalternative to WATSONX_PROJECT_ID—
WATSONX_URLnohttps://us-south.ml.cloud.ibm.com
WATSONX_MODEL_IDnoibm/granite-3-8b-instruct
WATSONX_EMBED_MODEL_IDnoibm/granite-embedding-278m-multilingual
WATSONX_FORECAST_MODELnoibm/granite-ttm-512-96-r2
WATSONX_API_VERSIONno2024-05-31
WATSONX_TS_API_VERSIONno2025-02-11 (time-series API date)
WATSONX_TIMEOUT_MSno60000
WATSONX_IAM_URLnohttps://iam.cloud.ibm.com/identity/token

Regional hosts: us-south, eu-de, eu-gb, jp-tok, au-syd, ca-tor — e.g. https://eu-de.ml.cloud.ibm.com.

Related

  • @three-ws/ibm-x402-mcp — the same IBM Granite tools as pay-per-use x402 endpoints (USDC on Solana), so callers need no IBM account of their own.

Links


Part of the three.ws SDK suite — 3D AI agents, on-chain identity, and agent payments.
Website · Changelog · GitHub

来源:packages/ibm-watsonx-mcp/README.md,提交 c8f2cde

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.2.2最新Oct 10, 2026
  2. v0.2.1Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Granite 集成