Skip to main content

MCP Server for q/kdb+ integration

Project description

qmcp Server

A Model Context Protocol server for q/kdb+ integration.

Features

  • Connect to q/kdb+ servers
  • Execute q queries and commands
  • Persistent connection management

Requirements

  • Python 3.8+
  • qpython3 package
  • Access to a q/kdb+ server

Installation

pip install -e .

Usage

Run the MCP server:

qmcp

Environment Variables

  • Q_DEFAULT_HOST - Default connection info in format: host, host:port, or host:port:user:passwd

Connection Fallback Logic

The connect_to_q(host) tool uses flexible fallback logic:

  1. Full connection string (has colons): Use directly, ignore Q_DEFAULT_HOST
    • connect_to_q("myhost:5001:user:pass")
  2. Port number only: Combine with Q_DEFAULT_HOST or use localhost
    • connect_to_q(5001) → Uses Q_DEFAULT_HOST settings with port 5001
  3. No parameters: Use Q_DEFAULT_HOST directly
    • connect_to_q() → Uses Q_DEFAULT_HOST as-is
  4. Hostname only: Use as hostname with Q_DEFAULT_HOST port/auth or default port
    • connect_to_q("myhost") → Combines with Q_DEFAULT_HOST settings

Tools

  1. connect_to_q(host=None) - Connect to q server with fallback logic
  2. query_q(command) - Execute q commands and return results

Known Limitations

When using the MCP server, be aware of these limitations:

  • Keyed tables: Operations like 1!table may fail during pandas conversion
  • String vs Symbol distinction: q strings and symbols may appear identical in output
  • Type ambiguity: Use q's meta and type commands to determine actual data types when precision matters
  • Pandas conversion: Some q-specific data structures may not convert properly to pandas DataFrames

For type checking, use:

meta table           / Check table column types and structure
type variable        / Check variable type

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

qmcp-0.1.0.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

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

qmcp-0.1.0-py3-none-any.whl (38.2 kB view details)

Uploaded Python 3

File details

Details for the file qmcp-0.1.0.tar.gz.

File metadata

  • Download URL: qmcp-0.1.0.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for qmcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 684b3803be9ca015d43e76de3d4e273e662c1291fae94540aa59fef432aa8f6a
MD5 780ac85718486ee65f578c4f839f184a
BLAKE2b-256 d208a0c8992548ee103750b510ee9332d9f91d7c96bea046d67a610baee8f285

See more details on using hashes here.

File details

Details for the file qmcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: qmcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for qmcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a644d41e8f493e781156a0104cc43cf2e94638f2622e70f724f9936e62a5cd31
MD5 56b83df9102731f2c56e1c839651d9bd
BLAKE2b-256 eda287cb7ea7ee231fd28e958dd242f4560775701ab763a35a09dc0f173ceba4

See more details on using hashes here.

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