Building a Watsonx.ai Chatbot Server with MCP in Python
@ruslanmv
About Building a Watsonx.ai Chatbot Server with MCP in Python
How to create a professional, production‑ready chatbot server powered by IBM Watsonx.ai and exposed via the Model Context Protocol (MCP) Python SDK.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"watsonx-mcp-server": {
"command": "python3",
"args": [
"-m",
"venv",
".venv"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is Watsonx Chatbot Server?
Watsonx Chatbot Server is a production‑ready MCP server that exposes IBM Watsonx.ai LLM inference as a standardized “chat” tool. It lets any MCP‑compatible client (e.g., Claude Desktop, custom Python clients) invoke Watsonx.ai responses through the Model Context Protocol.
How to use Watsonx Chatbot Server?
Set up Python 3.9+, a virtual environment, and install python-dotenv, ibm-watsonx-ai, and mcp[cli]. Store your Watsonx.ai API key, URL, and project ID in a .env file. Run mcp dev server.py for live‑reloading development with an Inspector UI at http://localhost:6274/, or run python server.py for direct STDIO mode. Use the sample client script to call the chat tool.
Key features of Watsonx Chatbot Server
- Exposes Watsonx.ai LLM inference as an MCP “chat” tool.
- Provides a dynamic greeting resource via
@mcp.resource. - Includes an optional symptom‑assessment prompt template.
- Supports live reloading and Inspector testing with
mcp dev. - Communicates over STDIO transport with any MCP client.
- Defaults to the
ibm/granite-13b-instruct-v2model.
Use cases of Watsonx Chatbot Server
- Building an internal helpdesk bot that responds to employee queries.
- Creating a public chatbot API that works with any MCP‑aware frontend.
- Rapidly prototyping medical symptom assessment assistants.
- Providing a reusable, modular LLM endpoint for multiple client applications.
FAQ from Watsonx Chatbot Server
What credentials are required to run the server?
You need an IBM Cloud Watsonx.ai API key, service URL, and project ID. Store them in a .env file as WATSONX_APIKEY, WATSONX_URL, and PROJECT_ID.
How do I install the dependencies?
Use pip install -r requirements.txt after creating a virtual environment. The required packages are python-dotenv>=0.21.0, ibm-watsonx-ai==1.3.8, and mcp[cli]>=1.6.0.
What transport does the server use?
The server uses STDIO transport for MCP communication. It runs as a command‑line process and exchanges JSON‑RPC messages over standard input/output.
How can I test the server without writing a client?
Run mcp dev server.py to start the development mode. Open http://localhost:6274/ in a browser to use the MCP Inspector for listing tools, calling the chat tool, and testing resources and prompts.
What model is used by default, and can I change it?
The default model is ibm/granite-13b-instruct-v2. You can override it by setting the MODEL_ID environment variable in your .env file.
Frequently asked questions
What credentials are required to run the server?
You need an IBM Cloud Watsonx.ai API key, service URL, and project ID. Store them in a `.env` file as `WATSONX_APIKEY`, `WATSONX_URL`, and `PROJECT_ID`.
How do I install the dependencies?
Use `pip install -r requirements.txt` after creating a virtual environment. The required packages are `python-dotenv>=0.21.0`, `ibm-watsonx-ai==1.3.8`, and `mcp[cli]>=1.6.0`.
What transport does the server use?
The server uses STDIO transport for MCP communication. It runs as a command‑line process and exchanges JSON‑RPC messages over standard input/output.
How can I test the server without writing a client?
Run `mcp dev server.py` to start the development mode. Open `http://localhost:6274/` in a browser to use the MCP Inspector for listing tools, calling the `chat` tool, and testing resources and prompts.
What model is used by default, and can I change it?
The default model is `ibm/granite-13b-instruct-v2`. You can override it by setting the `MODEL_ID` environment variable in your `.env` file.
Basic information
More AI & Agents MCP servers
Sequential Thinking Multi-Agent System (MAS)
FradSerAn advanced sequential thinking process using a Multi-Agent System (MAS) built with the Agno framework and served via MCP.
MCP Claude Code
SDGLBLMCP implementation of Claude Code capabilities and more
LinkedIn MCP Server
stickerdanielOpen-source MCP server for LinkedIn. Give Claude and any MCP-compatible AI agent access to profiles, companies, jobs, and messages.
Shell and Coding agent for Claude and other mcp clients
rusiaamanShell and coding agent on mcp clients
1MCP - One MCP Server for All
1mcp-appA unified Model Context Protocol server implementation that aggregates multiple MCP servers into one.
Comments