Skip to main content

ASAM ODS Jaquel MCP Server - A Model Context Protocol server for creating and validating Jaquel queries

Project description

ASAM ODS Jaquel MCP Server

PyPI version Apache 2.0 License Python Status Build Status Stars

A Model Context Protocol (MCP) server for ASAM ODS with odsbox Jaquel query tools, ODS connection management, and measurement data access.


Overview

  • 🔌 Built-in ODS connection management
  • 🧰 29+ MCP tools: schema inspection, query validation, optimization, debugging, and direct ODS query execution
  • 🏗️ Entity hierarchy visualization (AoTest → AoMeasurement)
  • 🚀 Validate, build, and optimize Jaquel queries for ASAM ODS
  • 📦 Bulk timeseries/submatrix data access and script generation
  • 📊 Automatic Jupyter notebook generation for measurement comparison
  • 📈 Matplotlib visualization code generation
  • 📉 Statistical measurement comparison and correlation analysis
  • 🔎 Measurement hierarchy exploration and discovery
  • 💡 Interactive starting prompts for guided workflows
  • 🤖 AI-guided bulk API learning with get_bulk_api_help tool
  • 📝 Comprehensive examples, documentation, and test suite

Documentation

Quick Start

Installation

Using uvx (Recommended)

The easiest way to use this MCP server is with uvx:

uvx odsbox-jaquel-mcp

This automatically installs and runs the server without managing virtual environments.

Using pipx

For a persistent installation:

pipx install odsbox-jaquel-mcp
odsbox-jaquel-mcp

Traditional pip Installation

python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install odsbox-jaquel-mcp[play]

Note: The [play] extra includes optional data analysis and visualization dependencies (pandas, matplotlib, scipy) for working with Jupyter notebooks and data analysis.

Running the Server

The server runs on stdin/stdout and waits for MCP messages from an MCP client:

# With uvx (auto-installs and runs)
uvx odsbox-jaquel-mcp

# With pipx (if installed)
odsbox-jaquel-mcp

# With pip in virtual environment
python -m odsbox_jaquel_mcp

Configuration for MCP Clients

Add to your MCP client configuration (e.g., Claude Desktop, VS Code):

{
  "mcpServers": {
    "odsbox-jaquel": {
      "command": "uvx",
      "args": ["odsbox-jaquel-mcp"]
    }
  }
}

Or with pipx:

{
  "mcpServers": {
    "odsbox-jaquel": {
      "command": "odsbox-jaquel-mcp"
    }
  }
}

Development

Setup

git clone https://github.com/totonga/odsbox-jaquel-mcp.git
cd odsbox-jaquel-mcp
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e ".[dev]"

Common Tasks

# Run server locally
python -m odsbox_jaquel_mcp

# Run tests
pytest tests/
# or
python run_tests.py

# Code formatting and linting
black .
isort .
flake8 .

# Build package
python -m build

# Test with MCP Inspector
npx @modelcontextprotocol/inspector uvx odsbox-jaquel-mcp

Contributing

Pull requests and issues are welcome! Please:

  • Follow PEP8 and use type hints
  • Add/maintain tests for new features
  • Update documentation as needed

License

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

Links

Features

Core Validation Tools

Query Building & Validation

  • validate_jaquel_query - Check query syntax and structure
  • validate_filter_condition - Validate filter conditions
  • build_filter_condition - Construct filter conditions
  • explain_jaquel_query - Get plain English explanation

Pattern & Example Library

  • get_query_pattern - Get template for common patterns
  • list_query_patterns - List available patterns
  • generate_query_skeleton - Generate query skeleton for entity
  • get_operator_documentation - Learn about operators

Query Optimization

  • suggest_optimizations - Get optimization suggestions
  • merge_filter_conditions - Combine multiple conditions

Debugging Tools

  • debug_query_steps - Break query into logical steps
  • suggest_error_fixes - Get suggestions for errors

Schema Inspection (Requires Connection)

  • check_entity_schema - Get all fields for entity
  • validate_field_exists - Check if field exists
  • validate_filter_against_schema - Validate against schema
  • list_ods_entities - List all entities with relationships
  • get_test_to_measurement_hierarchy - Get ASAM ODS test hierarchy structure

Connection Management (NEW)

  • connect_ods_server - Establish ODS connection
  • disconnect_ods_server - Close ODS connection
  • get_ods_connection_info - Get connection status
  • execute_ods_query - Execute query on ODS server
  • get_submatrix_measurement_quantities - List measurement quantities for submatrix
  • read_submatrix_data - Read timeseries data from submatrix
  • generate_submatrix_fetcher_script - Generate Python scripts for data fetching

Starting Prompts

Discover and use the server's capabilities through interactive guided prompts:

  • Validate a Jaquel Query - Learn query validation
  • Explore Query Patterns - Find common query templates
  • ODS Server Connection - Set up and manage connections
  • Build Filter Conditions - Master WHERE clause construction
  • Bulk Data Access - Master the 3-step Bulk API workflow
  • Measurement Analysis - Compare measurements and visualize data
  • Optimize & Debug - Improve query performance

See PROMPTS.md for complete details on all starting prompts.

Error Handling

Common Errors and Solutions

Not connected

{
  "error": "Model not loaded",
  "hint": "Connect to ODS server using 'connect_ods_server' tool first"
}

Solution: Call connect_ods_server first

Invalid entity

{
  "error": "Entity not found: InvalidEntity",
  "available_entities": ["AoUnit", "AoMeasurement", ...]
}

Solution: Use valid entity from available_entities

Invalid field

{
  "valid": false,
  "issues": ["Field 'invalid_field' not found"],
  "suggestions": ["id", "name", "description"]
}

Solution: Use one of the suggested fields

Connection failed

{
  "success": false,
  "error": "Connection refused",
  "error_type": "ConnectionError"
}

Solution: Check URL, server availability, firewall

Troubleshooting

Issue: Tools not discovered

  • Ensure mcp>=0.1.0 is installed
  • Check ToolsCapability is set in ServerCapabilities
  • Restart MCP client

Issue: Schema tools fail

  • Ensure ODS server is accessible
  • Check username/password
  • Verify network connectivity
  • Review server logs

Issue: Queries timeout

  • Increase request_timeout in connect
  • Optimize query with suggest_optimizations
  • Reduce $rowlimit
  • Check ODS server performance

Performance Tips

  1. Use specific filters - Avoid querying all records
  2. Limit rows - Always use $rowlimit appropriately
  3. Select attributes - Only retrieve needed columns
  4. Index awareness - Filter on indexed fields first
  5. Connection reuse - Keep connection open when possible
  6. Cache schemas - Schema inspection is cached

Security Notes

  • Credentials are only held in memory during connection
  • Connection is cleaned up on disconnect
  • No credentials stored in config files
  • Use HTTPS with verify_certificate: true for production

Support

For issues or questions:

  1. Check the error message and hints
  2. Review the documentation and examples

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

odsbox_jaquel_mcp-0.3.8.tar.gz (114.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

odsbox_jaquel_mcp-0.3.8-py3-none-any.whl (77.6 kB view details)

Uploaded Python 3

File details

Details for the file odsbox_jaquel_mcp-0.3.8.tar.gz.

File metadata

  • Download URL: odsbox_jaquel_mcp-0.3.8.tar.gz
  • Upload date:
  • Size: 114.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for odsbox_jaquel_mcp-0.3.8.tar.gz
Algorithm Hash digest
SHA256 6d2f009cc3b2920677092e29acf3628f44f63a7e9a1d2e2d27dfc27224f865ec
MD5 aec3a2875d10840081630485b190c88b
BLAKE2b-256 d0875a97579f50cd0f41b397246a2967b4877694c0032cd659bdf58b6c74abeb

See more details on using hashes here.

Provenance

The following attestation bundles were made for odsbox_jaquel_mcp-0.3.8.tar.gz:

Publisher: build.yml on totonga/odsbox-jaquel-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file odsbox_jaquel_mcp-0.3.8-py3-none-any.whl.

File metadata

File hashes

Hashes for odsbox_jaquel_mcp-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 73257de2f35198fe15b75c790a60a546d08a7499c86ef1181b0825dfba1c1d9a
MD5 4137440c88bb01c7b6c1f48f665afc16
BLAKE2b-256 d70305821139f316a4eb0ed0c42c2926125f5b518d4ca829364b8ed5170f49f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for odsbox_jaquel_mcp-0.3.8-py3-none-any.whl:

Publisher: build.yml on totonga/odsbox-jaquel-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page