IBM i MCP Server

IBM i MCP Server

Enables AI agents to interact with IBM i systems through the Model Context Protocol, providing secure SQL-based access to Db2 for i databases for querying, monitoring, and executing operations.

Category
访问服务器

README

<div align="center">

alt text

TypeScript Model Context Protocol SDK MCP Spec Version License Status Ask DeepWiki NPM Version

MCP server and CLI for IBM i </div>


Overview

The IBM i MCP Server enables AI agents to interact with IBM i systems through the Model Context Protocol (MCP). It provides secure, SQL-based access to Db2 for i databases, allowing AI applications like Claude, VSCode Copilot, Bob, and custom agents to query system information, monitor performance, and execute database operations.

This repo also ships the ibmi CLI (@ibm/ibmi-cli) — a terminal-first sibling that shares the same YAML-driven SQL tool engine, so the same tool definitions work in both the MCP server and the CLI.

MCP Architecture

How it works: AI clients connect via MCP → Server executes YAML-defined SQL tools → Results stream back to the AI agent through Mapepire.

[!TIP] 📚 Official Documentation | ⚠️ Docs are under active development

The Docs are continuously evolving. Please check back frequently for updates and new guides. If there's something missing, feel free to open an issue!

Repository Structure

Directory Purpose Documentation
packages/server/ MCP server implementation (TypeScript) — @ibm/ibmi-mcp-server on npm Server README
packages/cli/ ibmi command-line interface — @ibm/ibmi-cli on npm, co-versioned with the server CLI README
tools/ YAML-based SQL tool configurations Tools Guide
agents/ AI agent examples and integrations Agents Guide
client/ Python client examples for testing Client README
deployment/ Docker, Podman, OpenShift configs Deployment Guide
app/ Example Full stack Agent app (AgentOS) App README

Quick Navigation


MCP Server

The MCP Server enables AI agents to execute SQL queries on IBM i systems through YAML-defined SQL tools.

Quick Start

Prerequisites:

  • Mapepire running on IBM i (port 8076)
  • Node.js 18+ installed

Get Started:

  1. Clone the repository:

    git clone https://github.com/IBM/ibmi-mcp-server.git
    cd ibmi-mcp-server
    
  2. Configure your IBM i connection:

    cat > .env << 'EOF'
    DB2i_HOST=your-ibmi-host.com
    DB2i_USER=your-username
    DB2i_PASS=your-password
    DB2i_PORT=8076
    DB2i_IGNORE_UNAUTHORIZED=true
    EOF
    
  3. Start the server:

    npx -y @ibm/ibmi-mcp-server@latest \
       --transport http \
       --tools ./tools/performance/performance.yaml
    

    The server will use our pre-configured tools for:

    • 📊 Performance monitoring (system status, memory pools, active jobs)
    • See the Tools Guide for more toolsets.

    The MCP server can also run in a Docker container:

    docker run --rm --name ibmi-mcp-server \
      -v /path/to/tools/:/tools \
      -v /path/to/.env/:/.env \
      -e MCP_SERVER_CONFIG=/.env \
      -p 3010:3010 ghcr.io/ibm/ibmi-mcp-server:latest
    

    Replace the volume paths with your actual local paths to the tools directory and .env file.

  4. Verify it's running:

    # Check server health
    curl http://localhost:3010/healthz
    
    # List available tools
    curl -X POST http://localhost:3010/mcp \
      -H "Content-Type: application/json" \
      -H "Accept: application/json, text/event-stream" \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | \
      grep -o '"name":"[^"]*"' | sed 's/"name":"//g' | sed 's/"//g' | head -20
    

[!NOTE] 📖 Full Server Quickstart →

Next Steps:

Additional links:


IBM i CLI

A terminal-first sibling to the MCP server. The ibmi command shares the same YAML-driven SQL tool engine and is designed for local exploration, ad-hoc queries, scripted automation, and CI/CD — no MCP client required.

Quick Start

# Install
npm i -g @ibm/ibmi-cli

# Run a query
ibmi sql "SELECT * FROM SAMPLE.EMPLOYEE FETCH FIRST 5 ROWS ONLY"

# Run a YAML-defined tool
ibmi tool system_status --tools ./tools/work-management.yaml

When to use the CLI vs. the MCP Server

Both tools sit on top of the same YAML tool engine. The MCP Server is the de facto interface for building AI agents and multi-client AI workloads. The CLI covers everything else — and also serves as a lightweight, process-local alternative when a full MCP server is overkill.

Use the CLI when… Use the MCP Server when…
You need developer ergonomics — an interactive terminal experience for querying Db2 for i, exploring schemas, scripting in shell/CI, or piping results into other tools You are building AI agents or AI-powered applications that should call IBM i tools conversationally (Claude Desktop, VSCode Copilot, Bob, Agno, LangChain, custom agents)
You are running a local AI agent and want the CLI as a lightweight, in-process alternative to a long-lived MCP server — e.g., a coding agent that shells out to ibmi sql or ibmi tool as part of its loop You need remote server support over the MCP protocol, including stdio or HTTP transports
You want fast synchronous execution against one or many systems with rich output formats (table, json, csv, markdown, NDJSON) and no server process to manage You need shared, networked access with auth, rate limiting, structured telemetry, and session handling

See the CLI Agent Integration guide for concrete examples of wiring the ibmi CLI into local AI agents.

[!NOTE] 📖 Full Documentation: CLI Guide →

Additional links:


SQL Tools

YAML-based SQL tool configurations that define what queries AI agents can execute on your IBM i system.

Quick Start

Create a custom tool file tools/my-tools.yaml:

sources:
  my-system:
    host: ${DB2i_HOST}
    user: ${DB2i_USER}
    password: ${DB2i_PASS}
    port: 8076
    ignore-unauthorized: true

tools:
  system_status:
    source: ibmi-system
    description: "Overall system performance statistics with CPU, memory, and I/O metrics"
    parameters: []
    statement: |
      SELECT * FROM TABLE(QSYS2.SYSTEM_STATUS(RESET_STATISTICS=>'YES',DETAILED_INFO=>'ALL')) X

toolsets:
  performance:
    tools:
      - system_status

Run the server with your tools:

npx -y @ibm/ibmi-mcp-server@latest --tools ./tools/my-tools.yaml --transport http

Available Tool Collections

The tools/ directory includes ready-to-use configurations:

  • Performance Monitoring - System status, active jobs, CPU/memory metrics
  • Security & Audit - User profiles, authorities, security events
  • Job Management - Active jobs, job queues, subsystems
  • Storage & IFS - Disk usage, IFS objects, save files
  • Database - Tables, indexes, constraints, statistics

[!NOTE] 📖 Full Documentation: Tools Guide →

Additional links:


AI Agents

Pre-built AI agent examples using popular frameworks to interact with IBM i systems through the MCP Server.

Available Agent Frameworks

Framework Language Use Case Documentation
Agno Python Production-ready agents with built-in observability Agno README
LangChain Python Complex workflows and tool chaining LangChain README
Google ADK Python Google AI ecosystem integration Google ADK README

What Agents Can Do

  • System Monitoring: Real-time performance analysis and health checks
  • Troubleshooting: Diagnose issues using natural language queries
  • Reporting: Generate system reports and insights
  • Automation: Execute administrative tasks through conversation

[!NOTE] 📖 Full Documentation: Agents Guide →

Additional links:


Python Clients

Simple Python client examples for testing and interacting with the MCP Server.

import asyncio
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

async def main():
    # Connect to the IBM i MCP server with authentication
    async with streamablehttp_client("http://localhost:3010/mcp") as (
        read_stream,
        write_stream,
        _,
    ):
        # Create a session using the authenticated streams
        async with ClientSession(read_stream, write_stream) as session:
            # Initialize the connection
            await session.initialize()

            # List available tools (now authenticated with your IBM i credentials)
            tools = await session.list_tools()
            for i, tool in enumerate(tools.tools, 1):
                print(f"{i:2d}. {tool.name}")
                print(f"    └─ {tool.description}")

            # Execute a tool with authenticated IBM i access
            print("\n" + "=" * 80)
            print("SYSTEM ACTIVITY RESULT")
            print("=" * 80)
            result = await session.call_tool("system_activity", {})

            print(result)


if __name__ == "__main__":
    asyncio.run(main())

[!NOTE] 📖 Full Documentation: Client README →

Additional links:


Deployment

Production-ready deployment configurations for containerized environments.

Deployment Options

  • Docker & Podman - Complete stack with MCP Context Forge Gateway
  • OpenShift - Kubernetes deployment with S2I builds
  • Production Features - HTTPS, authentication, monitoring, caching

[!NOTE] 📖 Full Documentation: Deployment Guide →


Setup Mapepire

Before you can use the ibmi-mcp-server, you must install and configure Mapepire on your IBM i system.

What is Mapepire?

Mapepire is a modern, high-performance database server for IBM i that provides SQL query execution capabilities over WebSocket connections. It acts as a gateway between modern application architectures (like MCP servers, AI agents, and REST APIs) and IBM i's Db2 for i database.

Why Mapepire Enables AI and MCP Workloads

Traditional IBM i database access methods (ODBC, JDBC) don't align well with modern AI and MCP architectures that require:

  • Fast, lightweight connections: AI agents make frequent, short-lived database queries
  • WebSocket support: Enables real-time, bidirectional communication for streaming results
  • Modern JSON-based protocols: Simplifies integration with TypeScript/JavaScript ecosystems
  • Low-latency responses: Essential for interactive AI conversations and tool executions

Mapepire bridges this gap by providing a modern, WebSocket-based SQL query interface that's optimized for the request/response patterns of AI agents and MCP tools.

Installation

Quick Install (IBM i SSH Session):

# 1. Install Mapepire using yum
yum install mapepire-server

# 2. Install Service Commander (if not already installed)
yum install service-commander

# 3. Start Mapepire service
sc start mapepire

[!NOTE] 📚 Full Documentation: Mapepire System Administrator Guide →

[!IMPORTANT] Important Notes:

  • By default, Mapepire runs on port 8076. You'll need this port number when configuring the DB2i_PORT variable in your .env file.
  • Ensure your IBM i firewall allows inbound connections on port 8076
  • For production deployments, configure SSL/TLS certificates (see official guide)


License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选