Why This Pattern Matters
Python tools are great for simple in-process tasks, but enterprise IT requires connecting to microservices, databases, and sidecar processes written in Node.js, Go, or Python. Model Context Protocol (MCP) is the industry standard for bridging LLMs with external tools over JSON-RPC.
📋 Prerequisites & Setup
Ensure your environment has the required dependencies:
pip install ibm-watsonx-orchestrate
Verify active environment:
orchestrate env list
🛠️ Step 1: Implement the Logic (simple_mcp_server.py)
from mcp.server import Server
from mcp.server.stdio import stdio_server
import mcp.types as types
import asyncio
mcp = Server("sample-ticket-mcp-server")
@mcp.tool()
async def search_support_tickets(priority: str = "HIGH") -> str:
"""
Query enterprise support tickets by priority level.
Args:
priority: Filter level ('CRITICAL', 'HIGH', 'MEDIUM', 'LOW').
"""
return f"""
🎫 Active Tickets [{priority} Priority]:
1. #TCK-901: Database latency spike in ca-tor (Assigned: Site Reliability)
2. #TCK-904: SSL Certificate renewal for api.internal (Assigned: Security)
"""
async def main():
async with stdio_server() as (read_stream, write_stream):
await mcp.run(
read_stream,
write_stream,
mcp.create_initialization_options()
)
if __name__ == "__main__":
asyncio.run(main())
📦 Step 2: Declare Dependencies (requirements.txt)
mcp>=1.0.0
ibm-watsonx-orchestrate>=2.9.0
🤖 Step 3: Configure the AI Agent (agent.yaml)
spec_version: v1
kind: native
name: mcp_support_agent
title: "MCP Support Triage"
description: "Integrates with external systems using Model Context Protocol (MCP)."
model: ibm/granite-3-8b-instruct
instructions: |
You are a support operations agent. Connect to the MCP ticket server
and query tickets for the user.
tools:
- search_support_tickets
🚀 Step 4: Import & Test Live in Terminal
Import tool and test conversationally:
orchestrate toolkits add --kind mcp --package-root ./mcp_discovery_test
Live Response:
[INFO] - Discovering tools from MCP server 'sample-ticket-mcp-server'...
[INFO] - Found 1 tool: search_support_tickets
[SUCCESS] - MCP Toolkit added successfully.
💡 Pro Tips & Gotchas
- The '0 tools found' Bug: When importing MCP toolkits via CLI, you must provide `--package-root .` so Orchestrate can locate dependencies and the execution wrapper.
- STDIO vs SSE Transport: Use STDIO transport for rapid local workstation testing, and switch to SSE (Server-Sent Events) or Streamable HTTP for production container microservices.
🏷️ Recommended Community Tags
When publishing this blog post, select or enter the following tags in the community editor:
watsonx Orchestrate, Model Context Protocol, MCP, Sidecars, JSON-RPC, STDIO Transport, AI Tools
🗺️ Series Roadmap (15 Hands-On Labs)
This tutorial is Part 7 of 15 in the complete enterprise hands-on series:
- 🟢 Part 1: Building Your First Custom Python Tool & AI Agent in 15 Minutes
- 🟢 Part 2: Input Defaults & UI Patterns (Pydantic Schemas)
- 🟢 Part 3: File Upload & Spreadsheet Analytics (Pandas Pipeline)
- 🟡 Part 4: Ambient User Context & Identity Injection
- 🟡 Part 5: Asynchronous Non-Blocking Workers & Polling
- 🟡 Part 6: Dynamic PDF Generation & File Streaming
- 🟡 Part 7: Model Context Protocol (MCP) STDIO Basics
- 🔴 Part 8: MCP Enterprise Security & Bearer Token Injection
- 🔴 Part 9: Role-Based Access Control (RBAC) Pre-Invoke Plugins
- 🔴 Part 10: Microsoft Entra ID (Azure AD) SSO & SAML Federation
- 🔴 Part 11: Agent CI/CD Lifecycle & Automated Multi-Env Promotion
- 🏆 Part 12: Tamper-Proof Audit Vault & Conversation Archiving
- 🏆 Part 13: Real-Time Telemetry & Token Observability Dashboard
- 🏆 Part 14: Quantitative RAG Pipeline Evaluation with Ragas
- 🔴 Part 15: Remote Containerized MCP Gateways on IBM Cloud Code Engine
Explore the interactive curriculum and code repository: