ibmi-mcp-server

ibmi-mcp-server

An MCP server that enables AI assistants to interact with IBM i AS/400 source members for source code management, compilation, and development workflows.

Category
访问服务器

README

IBM i MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to interact with IBM i AS/400 source members, providing seamless integration for source code management, compilation, and development workflows.

🚀 Features

  • 🔗 IBM i Integration: Connect to IBM i AS/400 systems
  • 📂 Source Member Management: Read, write, list, and manage source members
  • 🔧 Compilation Support: Compile RPG, DDS, and other source types
  • 🏷️ Automatic Source Marking: Apply source mark "5719A" to all modifications
  • 🌐 MCP Protocol: Full Model Context Protocol compliance
  • 🎯 AI Assistant Ready: Direct integration with ChatGPT, Claude, and other AI tools

📋 Table of Contents

⚡ Quick Start

1. Install Dependencies

git clone https://github.com/[your-username]/ibmi-mcp-server.git
cd ibmi-mcp-server
npm install

2. Build the Server

npm run build

3. Test Installation

npm test

4. Configure MCP Client

Add to your MCP client configuration:

{
  "mcpServers": {
    "ibmi-mcp-server": {
      "command": "node",
      "args": ["path/to/ibmi-mcp-server/build/index.js"]
    }
  }
}

5. Start Using

Connect to your IBM i system and start managing source members through your AI assistant!

🛠 Installation

Prerequisites

  • Node.js 18.0.0 or higher
  • npm (comes with Node.js)
  • Access to IBM i AS/400 system
  • MCP-compatible AI assistant or client

Local Development Setup

# Clone the repository
git clone https://github.com/[your-username]/ibmi-mcp-server.git
cd ibmi-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Start development mode (with auto-reload)
npm run dev

Production Deployment

# Install production dependencies only
npm ci --production

# Build for production
npm run build

# Start the server
npm start

⚙️ Configuration

Environment Variables

Create a .env file in the project root:

# Default IBM i connection settings
DEFAULT_IBMI_HOST=your-ibmi-system.com
DEFAULT_IBMI_USER=your-username
DEFAULT_LIBRARY=QGPL
DEFAULT_SOURCE_FILE=QRPGLESRC

# Development settings
NODE_ENV=development
DEBUG=false

MCP Client Integration

For VS Code with MCP Extension

Add to your VS Code settings or MCP configuration file:

{
  "mcpServers": {
    "ibmi-mcp-server": {
      "command": "node",
      "args": ["C:\\path\\to\\ibmi-mcp-server\\build\\index.js"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

For Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "ibmi": {
      "command": "node",
      "args": ["path/to/ibmi-mcp-server/build/index.js"]
    }
  }
}

🔧 Tools Reference

connect_ibmi

Connect to an IBM i AS/400 system.

Parameters:

  • host (string, required): IBM i system hostname or IP
  • user (string, required): User profile name
  • password (string, optional): Password
  • port (number, default: 23): Connection port
  • library (string, default: "QGPL"): Default library
  • sourceFile (string, default: "QRPGLESRC"): Default source file

Example:

{
  "host": "ibmi-system.company.com",
  "user": "DEVELOPER",
  "library": "MYLIB",
  "sourceFile": "QRPGLESRC"
}

list_source_members

List source members with optional filtering.

Parameters:

  • library (string, optional): Library name
  • sourceFile (string, optional): Source physical file name
  • member (string, optional): Member name pattern
  • type (string, optional): Source type filter (RPGLE, DSPF, etc.)

Example:

{
  "library": "MYLIB",
  "sourceFile": "QRPGLESRC", 
  "type": "RPGLE"
}

read_source_member

Read source member content with optional line range.

Parameters:

  • member (string, required): Source member name
  • library (string, optional): Library name
  • sourceFile (string, optional): Source file name
  • startLine (number, optional): Starting line number
  • endLine (number, optional): Ending line number

Example:

{
  "member": "MYPROG",
  "startLine": 1,
  "endLine": 100
}

write_source_member

Write or update source member with automatic "5719A" source marking.

Parameters:

  • member (string, required): Source member name
  • content (string, required): Source member content
  • library (string, optional): Library name
  • sourceFile (string, optional): Source file name
  • sourceType (string, optional): Source type (RPGLE, DSPF, etc.)
  • description (string, optional): Member description

Example:

{
  "member": "MYPROG",
  "content": "// RPG code here...",
  "sourceType": "RPGLE",
  "description": "Updated by AI assistant"
}

compile_source_member

Compile a source member.

Parameters:

  • member (string, required): Source member name
  • library (string, optional): Library name
  • sourceFile (string, optional): Source file name
  • sourceType (string, optional): Source type
  • options (string, optional): Compile options

Example:

{
  "member": "MYPROG",
  "sourceType": "RPGLE",
  "options": "OPTION(*EVENTF)"
}

📚 Resources

Source Member Resource

Access IBM i source members as MCP resources using URI templates:

URI Pattern: ibmi://source/{library}/{sourceFile}/{member}

Examples:

  • ibmi://source/MYLIB/QRPGLESRC/MYPROG
  • ibmi://source/TESTLIB/QDDSSRC/MYDSPF
  • ibmi://source/PRODLIB/QCPYSRC/MYCPY

💡 Examples

Example 1: Connect and List Members

// Connect to IBM i
await callTool("connect_ibmi", {
  host: "ibmi-system.company.com",
  user: "DEVELOPER",
  library: "MYLIB"
});

// List RPG source members
const members = await callTool("list_source_members", {
  type: "RPGLE"
});

Example 2: Read and Modify Source

// Read existing source member
const source = await callTool("read_source_member", {
  member: "MYPROG"
});

// Modify the source (add your changes)
const updatedSource = source.content + "\n// Added by AI assistant";

// Write back with automatic source marking
await callTool("write_source_member", {
  member: "MYPROG", 
  content: updatedSource,
  sourceType: "RPGLE",
  description: "Enhanced by AI"
});

Example 3: Compile and Check Results

// Compile the source member
const compileResult = await callTool("compile_source_member", {
  member: "MYPROG",
  sourceType: "RPGLE"
});

console.log("Compilation:", compileResult.success ? "SUCCESS" : "FAILED");

Example 4: Using Resources

// Access source member as a resource
const resource = await readResource("ibmi://source/MYLIB/QRPGLESRC/MYPROG");
console.log("Source content:", resource.contents[0].text);

🏗 Development

Development Scripts

# Start development mode with auto-reload
npm run dev

# Build the project
npm run build

# Run the server
npm start

# Run tests
npm test

# Lint code
npm run lint

# Open MCP Inspector (if installed)
npm run inspector

Adding New Tools

  1. Define the tool in src/index.ts:
server.registerTool(
  "my_new_tool",
  {
    description: "Description of what the tool does",
    inputSchema: {
      parameter1: z.string().describe("Parameter description"),
      parameter2: z.number().optional().describe("Optional parameter"),
    },
  },
  async ({ parameter1, parameter2 }) => {
    // Tool implementation
    return {
      content: [
        {
          type: "text",
          text: `Result: ${parameter1}`,
        },
      ],
    };
  }
);
  1. Build and test:
npm run build
npm test

VS Code Development

The project includes VS Code configuration for debugging:

  1. Open project in VS Code
  2. Set breakpoints in source code
  3. Press F5 to start debugging
  4. Use the Debug Console to interact with the server

🔒 Security Considerations

  • Never commit credentials to version control
  • Use environment variables for sensitive configuration
  • Implement proper IBM i user permissions
  • Validate all input parameters
  • Use secure connection methods for IBM i access

📄 Source Marking

All source modifications automatically receive the "5719A" source mark:

  • RPG Sources: Mark applied at position 75+
  • DDS Sources: Mark applied at position 81+
  • Other Sources: Mark applied at appropriate position based on source type

This ensures compliance with source marking standards and tracks AI-assisted modifications.

🐛 Troubleshooting

Common Issues

Build fails with module errors:

npm install
npm run build

Server won't connect to IBM i:

  • Check host/port settings
  • Verify user credentials
  • Ensure network connectivity

Source marking issues:

  • Source mark "5719A" is applied automatically
  • Check line length limits for your source type

MCP client connection issues:

  • Verify the correct path to build/index.js
  • Check Node.js version (18.0.0+ required)
  • Ensure the server builds successfully

Debug Mode

Run with verbose logging:

DEBUG=* npm start

Getting Help

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Contribution Steps

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Add tests if applicable
  5. Run quality checks: npm run lint && npm test
  6. Commit changes: git commit -m "Add amazing feature"
  7. Push to branch: git push origin feature/amazing-feature
  8. Open a Pull Request

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Model Context Protocol team for the excellent SDK
  • IBM i community for inspiration and requirements
  • VS Code and TypeScript teams for amazing developer tools

🌟 Star History

If this project helps you, please consider giving it a star! ⭐


Built with ❤️ for the IBM i community

Enable your AI assistants to work directly with IBM i AS/400 source members while maintaining professional source marking standards.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选