Skip to main content
Official Schema: See the JSON Schema definition for the authoritative source configuration specification.
Sources define database connections that your SQL tools use to execute queries against IBM i systems. Each source specifies connection parameters, credentials, and behavior options.

Quick Reference

All source configuration fields:

Basic Source Configuration

Every YAML file starts with a sources section that defines one or more database connections:
Source Naming: Choose descriptive source names like ibmi-production, ibmi-dev, or ibmi-system. Tools reference these names in their source field to specify which connection to use.

Source Fields Reference

Required Fields

All sources must include these three fields:
Security Requirement: Always use environment variables for credentials. Never hardcode sensitive values in YAML files.
Examples:
Authority Requirements: The IBM i user profile must have:
  • Object authority to tables, views, and procedures accessed by tools
  • Special authorities for system services (e.g., *AUDIT for security tools)
  • IBM i object-level security applies to all SQL queries

Optional Fields

These fields have sensible defaults and can be omitted for most configurations: Detailed Configuration:
Default port (8076):
Custom port:
Environment variable with default:
The default port 8076 is the standard port for the Mapepire daemon on IBM i systems.

JDBC Options

Forward any mapepire JDBC option to the underlying driver. The jdbc-options field accepts any property supported by the IBM i JDBC driver — library list, SQL naming convention, date format, time format, and many more.

Common Options

Use for: Resolving unqualified object names against a specific set of libraries.
libraries also accepts a comma-separated string: libraries: "MYLIB, DEVDATA, QGPL" — the server splits and trims it into an array.

Full Property List

The field accepts any property from the mapepire JDBCOptions interface — over 60 settings covering SQL behavior, date/time formatting, locale, tracing, and more. Refer to the IBM i JDBC properties reference for the complete catalog.
Passthrough validation: Unknown keys pass through the schema validator without error and are forwarded to the driver as-is. This is intentional — it avoids coupling the schema to the driver’s exact property surface. The tradeoff is that typos (e.g., librarys instead of libraries) are silently accepted at config load time and only surface when the driver rejects them at connection time.

Environment Variable Override

The DB2i_JDBC_OPTIONS environment variable overrides jdbc-options set in YAML — operators can enforce a fleet-wide JDBC configuration without editing per-deployment YAML. Env values are shallow-merged over YAML values (env wins on each key).
See the Configuration Reference → DB2i_JDBC_OPTIONS for the full syntax and parser rules.

Security: Credential Logging

The server logs only the libraries field of jdbc-options at pool initialization. All other JDBC fields — including potentially sensitive ones like key ring password, proxy server, and trace — are intentionally excluded from logs to prevent credential leakage.
If you need to verify other JDBC options took effect, query the JDBC driver’s runtime metadata (for example, execute SELECT CURRENT_DATE and inspect the format) rather than relying on log inspection.

Environment Variables

Use environment variables to externalize sensitive configuration and support multiple environments:

Basic Pattern

.env file:

Default Values

Provide fallback values for optional settings:
Syntax: ${VARIABLE_NAME:default_value} - Use : to specify default values that apply when the environment variable is not set.

Multiple Sources

Define multiple sources for different environments, systems, or use cases:

Multi-Environment Setup

Tool Usage:

Multi-System Setup

Connect to multiple IBM i systems in a single configuration:

Complete Configuration Examples

Development Configuration

.env:

Production Configuration

.env:

Custom Port Configuration


Security Best Practices

Always use environment variables for:
  • Hostnames
  • User profiles
  • Passwords
  • Ports (if non-standard)
Never hardcode:
Regular rotation strategy:
  1. Update .env file with new credentials
  2. Restart MCP server to apply changes
  3. Test connection with simple tool
  4. Update production after successful testing
Automated rotation:
  • Use secrets management systems (Vault, AWS Secrets Manager)
  • Configure automatic credential refresh
  • Monitor for rotation failures
Production requirements:
  • Valid SSL certificates from trusted CA
  • ignore-unauthorized: false enforced
  • Regular certificate renewal
  • Strong cipher suites
Development exceptions:
  • Self-signed certificates allowed
  • ignore-unauthorized: true for testing only
  • Never deploy to production with this setting
Protect YAML configuration files:

Troubleshooting

Symptom: ECONNREFUSED or “Connection refused” errorsSolutions:
  1. Verify Mapepire daemon is running on IBM i:
  2. Check firewall rules allow connections
  3. Verify hostname resolves correctly:
  4. Test port connectivity:
Symptom: “Invalid credentials” or “User not authorized” errorsSolutions:
  1. Verify environment variables are set:
  2. Test credentials directly on IBM i
  3. Check user profile status (not disabled/expired)
  4. Verify user has database authorities
Symptom: “Request timeout” or “Connection timeout” errorsSolutions:
  1. Increase requestTimeout for long-running queries
  2. Increase connectionTimeout for slow networks
  3. Optimize SQL queries to run faster
  4. Check network latency between server and IBM i
Symptom: “Certificate verification failed” or “Self-signed certificate” errorsSolutions:
  1. Development: Set ignore-unauthorized: true
  2. Production: Install valid SSL certificates on IBM i
  3. Update certificate trust store if needed
  4. Verify certificate has not expired

Next Steps

Tools Reference

Learn about tool definitions and configuration

Toolsets Reference

Organize tools into logical groups

Building SQL Tools

Step-by-step guide to creating custom tools

Configuration Guide

Complete server configuration reference
Source Design Philosophy: Sources represent database connections, not business logic. Keep source configurations simple, secure, and environment-specific. Use environment variables for all sensitive data and support multiple environments with distinct source names.