This is a Python web application that exposes the inmydata openedge agents SDK as a Model Context Protocol (MCP) Server. The MCP server enables AI agents to access PAS or Classic AppServer via inmydata's powerful ABL data querying capabilities through a standardized interface.
- Python 3.11 - Runtime environment
- FastMCP - High-level MCP server framework
- inmydata SDK - Provides structured data and calendar tools
- pandas - Data handling for SDK responses
- python-dotenv - Environment variable management
get_rows_fast- FAST PATH (recommended) - Query data with specific fields and simple filters. Returns clean JSON format optimized for LLMs.get_top_n_fast- FAST PATH for rankings - Get top/bottom N results by a metric.get_schema- Get available schema with AI-enhanced dashboard hints and field categorizationquery_results_fast- Queries results with SQL fetched with the get_rows_fast and get_top_n_fast tools and stored in a DuckDB database
get_financial_periods- Get all financial periods (year, quarter, month, week) for a dateget_calendar_period_date_range- Get start/end dates for a calendar period. Now supports smart defaults - call with no parameters to get current month's date range
Required environment variables (see .env.example):
INMYDATA_API_KEY- Your inmydata API keyINMYDATA_TENANT- Your tenant nameINMYDATA_CALENDAR- Your calendar nameINMYDATA_USER(optional) - User for chart events (default: mcp-agent)INMYDATA_SESSION_ID(optional) - Session ID for chart events (default: mcp-session)MCP_DUCKDB_LOCATION- Location to use for the DuckDB databaseMCP_DEBUG- For local use only. 0 (default) has no effect. 1 enables debugging to be connected from Visual Studio Code
INMYDATA_USE_OAUTH(optional) - Set totrueto enable OAuth authentication, orfalse/unset for legacy API key authentication (default: false)INMYDATA_MCP_HOST(optional) - MCP server host (default: mcp.inmydata.ai)INMYDATA_AUTH_SERVER(optional) - OAuth authorization server URL (default: https://auth.inmydata.com)INMYDATA_SERVER(optional) - inmydata server (default: inmydata.com)
For local MCP client connections:
python server.pyThe server communicates via standard input/output following the MCP protocol. Environment variables are read from .env file.
Note: Both servers use the mcp_utils helper class which handles all SDK interactions,
including proper JSON serialization of responses. This ensures consistent handling
of SDK objects (dates, calendar periods, etc.) across both local and remote modes.
For remote deployment on AWS, Google Cloud, Azure, etc:
python server_remote.py sse 8000
# or
python server_remote.py streamable-http 8000The remote server:
- Exposes HTTP endpoints for remote MCP client connections
- Accepts inmydata credentials securely via HTTP headers (not environment variables)
- Supports both SSE and Streamable HTTP transports
- Can be deployed on any cloud platform (AWS, GCP, Azure, Render, Railway, etc.)
The remote server supports two authentication modes, controlled by the INMYDATA_USE_OAUTH environment variable:
When OAuth is enabled, the server uses bearer token authentication:
Authorization: Bearer <token>- OAuth access tokenx-inmydata-tenant(optional) - Overrides tenant extracted from tokenx-inmydata-calendar(optional) - Calendar name (default: Default)x-inmydata-user(optional) - User for events (default: mcp-agent)x-inmydata-session-id(optional) - Session ID (default: mcp-session)x-inmydata-server(optional) - Server override
The tenant is automatically extracted from the token's client_imd_tenant or imd_tenant claim.
When OAuth is disabled, the server uses traditional API key authentication:
Headers:
x-inmydata-api-key- Your inmydata API keyx-inmydata-tenant- Your tenant namex-inmydata-calendar(optional) - Calendar name (default: Default)x-inmydata-user(optional) - User for events (default: mcp-agent)x-inmydata-session-id(optional) - Session ID (default: mcp-session)x-inmydata-server(optional) - Server override
Query Parameters (takes precedence over headers):
?tenant=your-tenant-name- Overridesx-inmydata-tenantheader if provided
Environment Variable Lookup:
- API key can be auto-detected from environment variable
{TENANT}_API_KEY(e.g.,ACME_API_KEYfor tenant "acme") - Falls back to
x-inmydata-api-keyheader if env var not found
See deployment-guide.md for detailed deployment instructions.
Claude Desktop can run local tools over stdio.
Steps: Enter the following in C:\Users\[USERNAME]\AppData\Roaming\Claude\claude_desktop_config.json
{
"mcpServers": {
"inmydata": {
"command": "[PATH TO PYTHON EXECUTABLE]\\python.exe",
"args": [
"[PATH TO MCP SERVER SRC]\\server.py"
],
"env": {
"MCP_DEBUG":"0",
"INMYDATA_API_KEY":"[API-KEY]",
"INMYDATA_TENANT": "[TENANT]",
"INMYDATA_CALENDAR": "[CALENDAR]",
"INMYDATA_USER": "[INMYDATA-USER]",
"INMYDATA_SESSION_ID": "[SESSION-ID]"
}
}
}
}docker build -t inmydata-mcp-server .
docker run -p 8000:8000 inmydata-mcp-serverOr using docker-compose:
docker-compose up -d- AWS: ECS, App Runner, or Lambda
- Google Cloud: Cloud Run
- Azure: Container Apps
- Render/Railway/Fly.io: Direct GitHub deployment
See deployment-guide.md for platform-specific instructions and client-config-example.json for client configuration.
Requirements note: a requirements.txt is included for quick installs and
adds uvicorn for the remote server. Install with:
python -m pip install -r requirements.txt-
2025-12-04: Added support for larger datasets by saving results in DuckDB database and adding a tool to query that.
-
2025-11-25: OpenEdge specific Agent MCP server forked from the inmydata Agent MCP server
-
2025-10-29: Optional OAuth Authentication
- π Configurable Auth Modes: New
INMYDATA_USE_OAUTHenvironment variable enables switching between OAuth and legacy API key authentication - π Backward Compatible: Defaults to legacy authentication (false) - existing deployments unaffected
- π― Token-Based Auth: When enabled, automatically extracts tenant from JWT claims (
client_imd_tenantorimd_tenant) - π Flexible Credentials: Legacy mode supports environment variable lookup (
{TENANT}_API_KEY), header-based API keys, and query parameter tenant override
- π Configurable Auth Modes: New
-
2025-10-27: Major LLM & Developer Experience Improvements
- π§ Flexible Parameters: All tool parameters now optional with smart defaults - eliminates crashes from empty
{}calls - π Simplified JSON:
get_rows_fastandget_top_n_fastreturn clean, flat JSON (40-60% smaller payloads) - π€ AI Schema Hints: Auto-categorized fields (time/location/product) with dashboard recommendations
- π
Smart Calendar Defaults:
get_calendar_period_date_range()with no args returns current month - π Query Parameter Auth:
?tenant=namesupport alongside headers - π Enhanced Filtering: Added
not_containsoperator for text filtering
- π§ Flexible Parameters: All tool parameters now optional with smart defaults - eliminates crashes from empty
-
2025-10-08: Improved architecture and progress updates
- Unified SDK interaction via
mcp_utilshelper class - Consistent JSON serialization across both servers
- Documented MCP progress notification API (
session.add_notification_handler('progress', handler)) - Added
requirements.txtwith uvicorn for remote server deployment
- Unified SDK interaction via
-
2025-10-02: Remote deployment support & example client
- Added
server_remote.pywith SSE/HTTP transport for remote hosting - Implemented secure credential passing via HTTP headers
- Created Docker deployment configuration
- Added comprehensive deployment guide for AWS, GCP, Azure
- Created
example_client.pydemonstrating FastMCP Client usage for both local and remote servers
- Added
- Graceful Error Handling: Empty
{}parameters return helpful errors instead of crashes - Token-Efficient Responses: Simplified JSON format reduces token usage by 40-60%
- Smart Defaults: Common operations (like "current month") work with minimal parameters
- Enhanced Filtering: Support for
equals,contains,not_contains,starts_with,gt,gte,lt,lteoperators
- Auto-Categorization: Fields automatically grouped by semantic meaning (time, location, product, etc.)
- Dashboard Hints: AI-generated recommendations for time dimensions, key metrics, and fast query fields
- Field Groups: Pre-categorized field collections for smarter UI generation
- FAST PATH (
get_rows_fast,get_top_n_fast): Direct warehouse queries - seconds, not minutes