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, orhost:port:user:passwd
Connection Fallback Logic
The connect_to_q(host) tool uses flexible fallback logic:
- Full connection string (has colons): Use directly, ignore
Q_DEFAULT_HOSTconnect_to_q("myhost:5001:user:pass")
- Port number only: Combine with
Q_DEFAULT_HOSTor uselocalhostconnect_to_q(5001)→ UsesQ_DEFAULT_HOSTsettings with port 5001
- No parameters: Use
Q_DEFAULT_HOSTdirectlyconnect_to_q()→ UsesQ_DEFAULT_HOSTas-is
- Hostname only: Use as hostname with
Q_DEFAULT_HOSTport/auth or default portconnect_to_q("myhost")→ Combines withQ_DEFAULT_HOSTsettings
Tools
connect_to_q(host=None)- Connect to q server with fallback logicquery_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!tablemay fail during pandas conversion - String vs Symbol distinction: q strings and symbols may appear identical in output
- Type ambiguity: Use q's
metaandtypecommands 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
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
qmcp-0.1.0-py3-none-any.whl
(38.2 kB
view details)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
684b3803be9ca015d43e76de3d4e273e662c1291fae94540aa59fef432aa8f6a
|
|
| MD5 |
780ac85718486ee65f578c4f839f184a
|
|
| BLAKE2b-256 |
d208a0c8992548ee103750b510ee9332d9f91d7c96bea046d67a610baee8f285
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a644d41e8f493e781156a0104cc43cf2e94638f2622e70f724f9936e62a5cd31
|
|
| MD5 |
56b83df9102731f2c56e1c839651d9bd
|
|
| BLAKE2b-256 |
eda287cb7ea7ee231fd28e958dd242f4560775701ab763a35a09dc0f173ceba4
|