Before You Begin
Complete these prerequisites before starting the installation:1
Verify Node.js Installation
Ensure Node.js 18 or higher is installed on your development machine:Don’t have Node.js? Download from nodejs.org
2
Install Mapepire on IBM i
Mapepire must be running on your IBM i system before proceeding.Not installed yet? Follow the Setup Mapepire guide (takes ~10 minutes)Already installed? Verify it’s running:Note the port: Default is 8076—you’ll need this for configuration.
3
Gather IBM i Credentials
You’ll need:
- IBM i hostname or IP address
- User profile with database authorities
- User password
- Access to QSYS2 system services (verify with your system administrator)
4
Set Aside Time
Plan for 15-20 minutes of uninterrupted setup time.
Step 1: Installation
Choose your installation method based on your needs:- NPM Package (Recommended)
- Build from Source
Best for: Production use, quick setup, always-updated packageThe official npm package provides instant installation without building from source.Benefits:Next: Skip to Step 2: Configuration
- ✅ Always up-to-date with latest stable release
- ✅ No build step required
- ✅ Instant setup in seconds
- ✅ Automatic dependency management
- ✅ Perfect for CI/CD pipelines
The
-y flag automatically accepts the npm package installation prompt. You can omit it if you want to confirm before installation.Step 2: Configuration
Create your environment configuration file:- NPM Package
- Build from Source
Create a Edit the file and replace the placeholder values with your actual IBM i credentials.
.env file in your current directory:Explore All Configuration Options →
The Configuration guide covers authentication modes (JWT, OAuth, IBM i), HTTP/HTTPS settings, OpenTelemetry observability, and all environment variables with examples for development and production.
Step 3: Create Your First SQL Tool
SQL tools are YAML-based configurations that define SQL queries the MCP server can execute. Each tool specifies a data source, parameters, and the SQL statement to run.Create Tools Directory
First, create a directory to store your tool configurations:Create a Simple Tool Configuration
Create a file namedtools/quickstart.yaml with the following content:
Understanding the YAML Structure
The YAML configuration has three main sections:1
Sources
Defines the IBM i data sources your tools will connect to. The environment variables (
${DB2i_HOST}, etc.) are automatically replaced with values from your .env file.2
Tools
Defines the SQL operations available to AI agents. Each tool specifies:
source: Which data source to usedescription: What the tool does (helps AI understand when to use it)parameters: Input parameters (empty array[]means no parameters required)statement: The SQL query to execute
3
Toolsets
Groups related tools together for easier management. You can load specific toolsets when starting the server using
--toolsets performance.Use Pre-Built Tools
Start with ready-made tools! Learn how to run the server with pre-built SQL tools for performance monitoring, security analysis, and system administration.
Build Custom Tools
Ready to build more tools? The SQL Tools documentation covers parameters, validation, multiple data sources, complex queries, and the full YAML configuration reference.
Step 4: Start the Server
Start the server in HTTP mode with your new SQL tool:- NPM Package (Recommended)
- Build from Source
auto(default): Automatically detects client capabilities ← Start with thisstateful: Maintains persistent sessions with connection statestateless: Each request is independent, no session state
MCP_SESSION_MODE=stateful npx -y @ibm/ibmi-mcp-server@latest --transport httpAlternative: Stdio Transport - For MCP Inspector or CLI tools, use
--transport stdio (NPM package) or npm run start:stdio (build from source). However, HTTP transport is recommended for most use cases.| Option | Description | Example |
|---|---|---|
--tools <path> | Override YAML tools path | --tools ./my-configs |
--toolsets <list> | Load specific toolsets only | --toolsets performance,security |
--transport <type> | Force transport type | --transport http |
--help | Show help information | --help |
--list-toolsets | List available toolsets | --list-toolsets |
Step 5: Test with Sample MCP Client
Now that your server is running, test it with the example Python client from the GitHub repository to verify connectivity and tool execution.Example Client Location: The sample client scripts are available in the
client/ directory of the GitHub repository. Clone the repository or download the files to follow along.Install uv (Python Package Manager)
If you don’t haveuv installed:
Why uv? uv is a fast Python package manager that handles virtual environments and dependencies automatically. It’s the recommended way to run the client examples.
Run the MCP Client Script
In a new terminal window (keep the server running in the first terminal):What does this script do?
What does this script do?
The
mcp_client.py script:- Connects to your running MCP server at
http://localhost:3010/mcp - Lists all available tools (SQL tools loaded from your YAML configs)
- Executes the
system_activitytool (a pre-built IBM i monitoring query) - Formats and displays the results
client/mcp_client.py to understand how to use the MCP client SDK.Step 6: Run an AI Agent (Optional)
Now that you’ve verified the MCP server works, try the example AI agent from the GitHub repository that can answer natural language questions about your IBM i system.Agent Script Location: The
agent.py script is in the client/ directory of the GitHub repository. If you haven’t cloned the repo yet (from Step 5), you’ll need to do so first.Configure API Key
The agent uses an LLM to understand your questions and call the appropriate MCP tools. You’ll need an API key:- OpenAI (Recommended)
- Ollama (Local)
Run the Agent
From theclient/ directory (where you ran the previous step), ask natural language questions about your IBM i system:
- OpenAI
- Ollama (Local)
Build Production Agents
Ready for more? Explore our Agent Integrations documentation to build production-ready agents with Agno, Google ADK, or LangChain. Learn about FilteredMCPTools, specialized agent patterns, persistent memory, and multi-agent architectures.
🎉 Congratulations!
You’ve successfully set up the IBM i MCP Server! Here’s what you accomplished:1
✅ Server Installed
Built and configured the MCP server with IBM i connection
2
✅ Connection Verified
Connected to Mapepire and your IBM i database
3
✅ Tools Tested
Listed and executed SQL tools via the MCP client
4
✅ Agent Ready (Optional)
Ran an AI agent that understands natural language queries
- Connecting AI clients (Claude Desktop, VSCode, Cursor)
- Creating custom SQL tools for your specific use cases
- Building specialized agents for IBM i administration and monitoring
Next Steps
Client Integration
Connect the server to Claude Desktop, VSCode, Cursor, and 10+ other MCP clients
SQL Tools
Learn how to create custom SQL operations using YAML configurations
Configuration
Explore all configuration options and environment variables
Agent Development
Build sophisticated AI agents that understand IBM i concepts
Troubleshooting
Connection Refused
Connection Refused
- Verify your IBM i host is reachable:
ping your-ibmi-host - Check that the Mapepire daemon is running on port 8076
- Ensure your user profile has database authorities
Authentication Failed
Authentication Failed
- Verify your IBM i username and password are correct
- Check that your user profile is not disabled or expired
- Ensure you have appropriate authorities for QSYS2 services
Port Already in Use
Port Already in Use
Change the port in your Then restart the server.
.env file:Tools Not Loading
Tools Not Loading
- Check that
prebuiltconfigs/directory exists - Verify your YAML tool configurations are valid
- Use
--list-toolsetsto see available tools:
Client Script Fails (mcp_client.py)
Client Script Fails (mcp_client.py)
Connection refused or timeout:Python version error:
- Ensure MCP server is running: check for “Server ready!” message
- Verify server is on port 3010 (or update script if using different port)
- Server must use HTTP transport (not stdio)
- Client requires Python 3.13+ (check pyproject.toml)
- Install Python 3.13:
brew install python@3.13(macOS) - Or use
uv python install 3.13
Completion Time: This quickstart should take 20-30 minutes including the optional agent setup. Most time is spent waiting for installations and builds. If you encounter issues, check the configuration guide or review the troubleshooting section above.