How bezouwenr/ibmi-mcp-server works
This repository provides an IBM i MCP server and a sibling CLI for AI-driven and direct SQL access to Db2 for i, alongside agent integrations and an example AgentOS chat application. The main workflow is a client request reaching the server over MCP, invoking a registered SQL tool, and returning results from IBM i via Mapepire; the CLI offers a terminal-first route through the shared YAML tool engine. The graph includes documented CLI, agent, and UI capabilities, but their internal wiring is only shown where supported by the tree or sampled source.
Main entry points: transports MCP transports · connectionPool.ts Connection pools · main.py AgentOS application · tools SQL operations
Components 25
MCP server
- Server lifecycle
packages/server/src/mcp-server/server.ts - MCP transports
packages/server/src/mcp-server/transports - Authentication
packages/server/src/ibmi-mcp-server/auth - Tool registration
packages/server/src/ibmi-mcp-server/tools/index.ts - YAML toolsets
packages/server/src/ibmi-mcp-server/utils/config/toolsetManager.ts - SQL operations
packages/server/src/ibmi-mcp-server/tools - Query validation
packages/server/src/ibmi-mcp-server/tools/validateQuery.tool.ts - Connection pools
packages/server/src/ibmi-mcp-server/services/connectionPool.ts - Token pools
packages/server/src/ibmi-mcp-server/services/authenticatedPoolManager.ts
IBM i CLI
- CLI commands
packages/cli/src/commands - CLI connections
packages/cli/src/utils/connection.ts
Agent integrations
- Framework agents
agents/frameworks - Agent SDK
agents/packages/ibmi-agent-sdk/src - Python clients
client
AgentOS demo
- Chat interface
app/agent-ui/src/components/chat - Chat streaming
app/agent-ui/src/hooks/useAIStreamHandler.tsx - Session loading
app/agent-ui/src/hooks/useSessionLoader.tsx - AgentOS application
app/app/main.py - Agent configuration
app/infra/config_manager.py - IBM i agents
app/agents/ibmi_agents.py
Other components
- AI client
- Mapepire
- Db2 for i
- Terminal user
- Chat user
Connections 23
- AI client → MCP transports: sends MCP requests
- Server lifecycle → Tool registration: registers tools
- Server lifecycle → MCP transports: starts transport
- MCP transports → Authentication: authenticates requests
- Tool registration → SQL operations: registers SQL tools
- YAML toolsets → SQL operations: organizes tools
- SQL operations → Connection pools: executes queries
- Query validation → Connection pools: checks SQL metadata
- Token pools → Connection pools: manages token pools
- Connection pools → Mapepire: queries through
- Mapepire → Db2 for i: accesses
- Terminal user → CLI commands: runs commands
- CLI commands → CLI connections: uses connections
- CLI connections → Mapepire: queries through
- Framework agents → Agent SDK: uses SDK integrations
- Python clients → MCP transports: connects to
- Chat user → Chat interface: sends chat
- Chat interface → Chat streaming: streams runs
- Session loading → Chat interface: loads sessions
- Chat streaming → AgentOS application: calls AgentOS API
- AgentOS application → Agent configuration: loads configuration
- AgentOS application → IBM i agents: registers agents
- IBM i agents → Agent SDK: uses agent SDK