dataquery-sdk 1.2.3__tar.gz → 1.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/CHANGELOG.md +6 -2
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/PKG-INFO +160 -6
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/README.md +156 -2
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/__init__.py +1 -1
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/cli.py +113 -5
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/config/env.py +109 -1
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/core/client.py +1 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/mcp_proxy.py +12 -2
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/sse/client.py +1 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/types/models.py +15 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/utils.py +7 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery_sdk.egg-info/PKG-INFO +160 -6
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery_sdk.egg-info/requires.txt +3 -3
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/pyproject.toml +4 -4
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/CONTRIBUTING.md +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/LICENSE +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/MANIFEST.in +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/config/__init__.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/config/logging.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/constants/__init__.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/constants/api.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/constants/download.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/constants/rate_limit.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/constants/sse.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/core/__init__.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/core/_mixins.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/core/_sync.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/data/function.json +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/dataquery.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/download/__init__.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/download/parallel.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/download/utils.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/export.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/function_registry.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/py.typed +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/sse/__init__.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/sse/event_store.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/sse/subscriber.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/transport/__init__.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/transport/auth.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/transport/connection_pool.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/transport/rate_limiter.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/transport/retry.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/types/__init__.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery/types/exceptions.py +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery_sdk.egg-info/SOURCES.txt +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery_sdk.egg-info/dependency_links.txt +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery_sdk.egg-info/entry_points.txt +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/dataquery_sdk.egg-info/top_level.txt +0 -0
- {dataquery_sdk-1.2.3 → dataquery_sdk-1.2.5}/setup.cfg +0 -0
|
@@ -51,5 +51,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
51
51
|
- Pagination models: `items`, `page-size`, and `info` fields, plus the `next_link` property and `get_self_link()` accessor, moved onto the shared `Paginated` mixin; `FileList` is now paginated; list fields default to empty instead of being required so partial/empty envelopes parse cleanly
|
|
52
52
|
- New `APIResponseError` raised when a 2xx response carries an `errors`/`error` envelope (e.g. `498 Unrecognized Page Token`); an `info` `204` "no content" envelope now yields an empty page so pagination stops cleanly, while any other unrecognized body fails loudly
|
|
53
53
|
- Exports: `Paginated`, `Link`, `APIResponseError` are now part of the public API
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
## [1.2.4] - 2026-08-12
|
|
55
|
+
- MCP: `mcp-connect` accepts `--client-id`, `--client-secret` and `--bearer-token` and exports them into the `DATAQUERY_*` environment of the process, so the MCP bridge and the SDK share one credential set instead of each needing its own setup
|
|
56
|
+
## [1.2.5] - 2026-08-21
|
|
57
|
+
- MCP: `mcp-connect --url` is now optional
|
|
58
|
+
|
|
59
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataquery-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
4
4
|
Summary: Python SDK for DATAQUERY Data API - Query, download, and check availability of economic data files
|
|
5
5
|
Author-email: DATAQUERY SDK Team <dataquery_support@jpmorgan.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/jpmorganchase/dataquery-sdk
|
|
@@ -25,7 +25,7 @@ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
|
25
25
|
Requires-Python: >=3.12
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
|
-
Requires-Dist: aiohttp<4.0.0,>=3.
|
|
28
|
+
Requires-Dist: aiohttp<4.0.0,>=3.14.3
|
|
29
29
|
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
30
30
|
Requires-Dist: structlog>=23.0.0
|
|
31
31
|
Requires-Dist: python-dotenv>=1.0.0
|
|
@@ -46,7 +46,7 @@ Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
|
|
46
46
|
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
47
47
|
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
|
|
48
48
|
Requires-Dist: mike>=1.1.0; extra == "docs"
|
|
49
|
-
Requires-Dist: pymdown-extensions>=
|
|
49
|
+
Requires-Dist: pymdown-extensions>=11.0.0; extra == "docs"
|
|
50
50
|
Provides-Extra: pandas
|
|
51
51
|
Requires-Dist: pandas>=2.0.0; extra == "pandas"
|
|
52
52
|
Provides-Extra: mcp
|
|
@@ -67,7 +67,7 @@ Requires-Dist: fastmcp>=2.14; extra == "all"
|
|
|
67
67
|
Requires-Dist: pip-audit>=2.7.0; extra == "all"
|
|
68
68
|
Requires-Dist: build>=1.3.0; extra == "all"
|
|
69
69
|
Requires-Dist: urllib3>=2.7.0; extra == "all"
|
|
70
|
-
Requires-Dist: pymdown-extensions>=
|
|
70
|
+
Requires-Dist: pymdown-extensions>=11.0.0; extra == "all"
|
|
71
71
|
Dynamic: license-file
|
|
72
72
|
|
|
73
73
|
# DataQuery SDK
|
|
@@ -98,6 +98,7 @@ built in for both.
|
|
|
98
98
|
- [Quick start — JSON Data API](#quick-start--json-data-api)
|
|
99
99
|
- [Auto-download (SSE)](#auto-download-sse)
|
|
100
100
|
- [CLI](#cli)
|
|
101
|
+
- [MCP bridge (`mcp-connect`)](#mcp-bridge-mcp-connect)
|
|
101
102
|
- [Configuration](#configuration)
|
|
102
103
|
- [Logging](#logging)
|
|
103
104
|
- [Error handling](#error-handling)
|
|
@@ -140,6 +141,9 @@ through one `DataQuery` client — pick the methods that match what you need.
|
|
|
140
141
|
- **Retry + circuit breaker** — exponential backoff, configurable failure threshold
|
|
141
142
|
- **Sync and async APIs** — every operation has `_async` and sync variants
|
|
142
143
|
- **CLI** — `dataquery groups | files | availability | download | download-group | auth | config`
|
|
144
|
+
- **MCP bridge** — `dataquery mcp-connect` connects any stdio MCP client
|
|
145
|
+
(Claude Desktop, Claude Code, …) to the remote DataQuery MCP server, minting
|
|
146
|
+
OAuth tokens for it
|
|
143
147
|
|
|
144
148
|
## New here? Three steps to your first download
|
|
145
149
|
|
|
@@ -172,6 +176,9 @@ pip install dataquery-sdk
|
|
|
172
176
|
# With pandas DataFrame conversion
|
|
173
177
|
pip install "dataquery-sdk[pandas]"
|
|
174
178
|
|
|
179
|
+
# With the MCP bridge (dataquery mcp-connect)
|
|
180
|
+
pip install "dataquery-sdk[mcp]"
|
|
181
|
+
|
|
175
182
|
# With dev tooling (ruff, mypy, pytest)
|
|
176
183
|
pip install "dataquery-sdk[dev]"
|
|
177
184
|
```
|
|
@@ -439,8 +446,134 @@ dataquery config template --output .env
|
|
|
439
446
|
dataquery auth test
|
|
440
447
|
```
|
|
441
448
|
|
|
442
|
-
|
|
443
|
-
|
|
449
|
+
`--env-file PATH` (to point at a non-default `.env`) is a top-level flag, so it
|
|
450
|
+
goes *before* the subcommand: `dataquery --env-file .env.prod groups`. Most
|
|
451
|
+
subcommands accept `--json` for machine-readable output.
|
|
452
|
+
|
|
453
|
+
## MCP bridge (`mcp-connect`)
|
|
454
|
+
|
|
455
|
+
`dataquery mcp-connect` connects a desktop MCP client — Claude Desktop, Claude
|
|
456
|
+
Code, or any stdio MCP host — to the remote DataQuery MCP server. It speaks
|
|
457
|
+
stdio to the client and streamable HTTP to the server, stamping every outbound
|
|
458
|
+
request with a fresh OAuth (AuthE) bearer token minted from your `DATAQUERY_*`
|
|
459
|
+
credentials. Tokens are refreshed for the life of the session, and the MCP host
|
|
460
|
+
itself never handles your client secret.
|
|
461
|
+
|
|
462
|
+
It needs the `mcp` extra:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
pip install "dataquery-sdk[mcp]"
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### Wire it into an MCP client
|
|
469
|
+
|
|
470
|
+
Add the server to your client's MCP config (`claude_desktop_config.json`,
|
|
471
|
+
`.mcp.json`, or the equivalent for your host):
|
|
472
|
+
|
|
473
|
+
```json
|
|
474
|
+
{
|
|
475
|
+
"mcpServers": {
|
|
476
|
+
"dataquery": {
|
|
477
|
+
"command": "dataquery",
|
|
478
|
+
"args": ["mcp-connect", "--save-credentials"],
|
|
479
|
+
"env": {
|
|
480
|
+
"DATAQUERY_CLIENT_ID": "your_client_id",
|
|
481
|
+
"DATAQUERY_CLIENT_SECRET": "your_client_secret"
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
`--save-credentials` copies the credentials it resolved into
|
|
489
|
+
`~/.dataquery/.env` on the first launch (see [Credentials](#credentials)). From
|
|
490
|
+
then on the bridge — and every other SDK call and CLI run on the machine —
|
|
491
|
+
finds them there, so you can drop the `env` block from the config and keep your
|
|
492
|
+
secret out of a file your MCP client reads on every start:
|
|
493
|
+
|
|
494
|
+
```json
|
|
495
|
+
{
|
|
496
|
+
"mcpServers": {
|
|
497
|
+
"dataquery": {
|
|
498
|
+
"command": "dataquery",
|
|
499
|
+
"args": ["mcp-connect"]
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
To skip installing anything, run it straight from PyPI with `uvx`:
|
|
506
|
+
|
|
507
|
+
```json
|
|
508
|
+
{
|
|
509
|
+
"mcpServers": {
|
|
510
|
+
"dataquery": {
|
|
511
|
+
"command": "uvx",
|
|
512
|
+
"args": ["--from", "dataquery-sdk[mcp]", "dataquery", "mcp-connect", "--save-credentials"],
|
|
513
|
+
"env": {
|
|
514
|
+
"DATAQUERY_CLIENT_ID": "your_client_id",
|
|
515
|
+
"DATAQUERY_CLIENT_SECRET": "your_client_secret"
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Endpoint
|
|
523
|
+
|
|
524
|
+
`--url` is optional. The endpoint resolves as `--url` → `DATAQUERY_MCP_URL` →
|
|
525
|
+
the production server
|
|
526
|
+
`https://api-dataquery.jpmchase.com/research/dataquery-authe/v2/mcp`:
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
# Production (no arguments needed)
|
|
530
|
+
dataquery mcp-connect
|
|
531
|
+
|
|
532
|
+
# Another environment
|
|
533
|
+
dataquery mcp-connect --url https://host/research/dataquery-authe/v2/mcp
|
|
534
|
+
DATAQUERY_MCP_URL=https://host/research/dataquery-authe/v2/mcp dataquery mcp-connect
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### Credentials
|
|
538
|
+
|
|
539
|
+
Credentials resolve exactly as they do everywhere else in the SDK — flags win,
|
|
540
|
+
then the process environment (what your MCP client exports), then a `.env`,
|
|
541
|
+
then the saved user-level file:
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
# From the environment (recommended)
|
|
545
|
+
dataquery mcp-connect
|
|
546
|
+
|
|
547
|
+
# From flags — visible in the process list, so avoid on shared machines
|
|
548
|
+
dataquery mcp-connect --client-id ID --client-secret SECRET
|
|
549
|
+
|
|
550
|
+
# From a non-default .env (top-level flag: before the subcommand)
|
|
551
|
+
dataquery --env-file .env.prod mcp-connect
|
|
552
|
+
|
|
553
|
+
# Bearer token instead of OAuth
|
|
554
|
+
dataquery mcp-connect --bearer-token TOKEN
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
Pass `--save-credentials` once and the resolved credentials are written to
|
|
558
|
+
`~/.dataquery/.env` (owner-only `0600` file in a `0700` directory; override the
|
|
559
|
+
directory with `DATAQUERY_CONFIG_DIR`). Every later SDK call and CLI run reads
|
|
560
|
+
that file as a last-resort fallback, so a plain `DataQuery()` in a script
|
|
561
|
+
authenticates with no environment of its own — while shell variables and a
|
|
562
|
+
local `.env` still take precedence over it.
|
|
563
|
+
|
|
564
|
+
### Flags
|
|
565
|
+
|
|
566
|
+
| Flag | Default | Purpose |
|
|
567
|
+
|---|---|---|
|
|
568
|
+
| `--url URL` | `DATAQUERY_MCP_URL`, else the PROD endpoint | Remote MCP endpoint |
|
|
569
|
+
| `--name NAME` | `dataquery-mcp` | Proxy server name reported to the MCP client |
|
|
570
|
+
| `--client-id ID` | _(from env)_ | OAuth client ID; exported as `DATAQUERY_CLIENT_ID` |
|
|
571
|
+
| `--client-secret SECRET` | _(from env)_ | OAuth client secret; exported as `DATAQUERY_CLIENT_SECRET` |
|
|
572
|
+
| `--bearer-token TOKEN` | _(from env)_ | Use a bearer token instead of OAuth |
|
|
573
|
+
| `--save-credentials` | off | Also persist the resolved credentials to `~/.dataquery/.env` |
|
|
574
|
+
|
|
575
|
+
Because stdout carries the JSON-RPC channel, all logging and diagnostics go to
|
|
576
|
+
stderr — look in your MCP client's server log when something fails.
|
|
444
577
|
|
|
445
578
|
## Configuration
|
|
446
579
|
|
|
@@ -457,6 +590,16 @@ All environment variables use the `DATAQUERY_` prefix.
|
|
|
457
590
|
| `DATAQUERY_BEARER_TOKEN` | _(none)_ | Alternative to OAuth |
|
|
458
591
|
| `DATAQUERY_OAUTH_ENABLED` | `true` | Set `false` to use bearer-token mode |
|
|
459
592
|
|
|
593
|
+
**Endpoints**
|
|
594
|
+
|
|
595
|
+
| Variable | Default | Notes |
|
|
596
|
+
|---|---|---|
|
|
597
|
+
| `DATAQUERY_BASE_URL` | `https://api-dataquery.jpmchase.com` | Host for both API surfaces |
|
|
598
|
+
| `DATAQUERY_FILES_BASE_URL` | same as `BASE_URL` | Override only if file endpoints live on another host |
|
|
599
|
+
| `DATAQUERY_OAUTH_TOKEN_URL` | `https://authe.jpmorgan.com/as/token.oauth2` | Token endpoint |
|
|
600
|
+
| `DATAQUERY_OAUTH_AUD` | PROD audience | Set to the value provisioned for your client |
|
|
601
|
+
| `DATAQUERY_MCP_URL` | PROD MCP endpoint | Endpoint used by [`mcp-connect`](#mcp-bridge-mcp-connect); `--url` overrides it |
|
|
602
|
+
|
|
460
603
|
**HTTP / retry / rate limit**
|
|
461
604
|
|
|
462
605
|
| Variable | Default |
|
|
@@ -621,6 +764,17 @@ async with DataQuery() as dq:
|
|
|
621
764
|
`manager.clear_event_id()` (or `dataquery download --watch --reset-event-id`)
|
|
622
765
|
only when you intentionally want a clean slate.
|
|
623
766
|
|
|
767
|
+
**MCP client shows the server as failed**
|
|
768
|
+
|
|
769
|
+
- `The MCP bridge requires the 'mcp' extra` in the server log means `fastmcp`
|
|
770
|
+
is missing — `pip install "dataquery-sdk[mcp]"`, or use the `uvx` form.
|
|
771
|
+
- MCP hosts usually launch the command with a minimal environment, so a
|
|
772
|
+
`.env` in your shell's working directory may not be visible. Put the
|
|
773
|
+
credentials in the server's `env` block, or run `dataquery mcp-connect
|
|
774
|
+
--save-credentials` once from a terminal where they do resolve.
|
|
775
|
+
- Auth failures surface as `Could not obtain an OAuth token`; verify the same
|
|
776
|
+
credentials with `dataquery auth test` before debugging the bridge.
|
|
777
|
+
|
|
624
778
|
## Date formats
|
|
625
779
|
|
|
626
780
|
```python
|
|
@@ -26,6 +26,7 @@ built in for both.
|
|
|
26
26
|
- [Quick start — JSON Data API](#quick-start--json-data-api)
|
|
27
27
|
- [Auto-download (SSE)](#auto-download-sse)
|
|
28
28
|
- [CLI](#cli)
|
|
29
|
+
- [MCP bridge (`mcp-connect`)](#mcp-bridge-mcp-connect)
|
|
29
30
|
- [Configuration](#configuration)
|
|
30
31
|
- [Logging](#logging)
|
|
31
32
|
- [Error handling](#error-handling)
|
|
@@ -68,6 +69,9 @@ through one `DataQuery` client — pick the methods that match what you need.
|
|
|
68
69
|
- **Retry + circuit breaker** — exponential backoff, configurable failure threshold
|
|
69
70
|
- **Sync and async APIs** — every operation has `_async` and sync variants
|
|
70
71
|
- **CLI** — `dataquery groups | files | availability | download | download-group | auth | config`
|
|
72
|
+
- **MCP bridge** — `dataquery mcp-connect` connects any stdio MCP client
|
|
73
|
+
(Claude Desktop, Claude Code, …) to the remote DataQuery MCP server, minting
|
|
74
|
+
OAuth tokens for it
|
|
71
75
|
|
|
72
76
|
## New here? Three steps to your first download
|
|
73
77
|
|
|
@@ -100,6 +104,9 @@ pip install dataquery-sdk
|
|
|
100
104
|
# With pandas DataFrame conversion
|
|
101
105
|
pip install "dataquery-sdk[pandas]"
|
|
102
106
|
|
|
107
|
+
# With the MCP bridge (dataquery mcp-connect)
|
|
108
|
+
pip install "dataquery-sdk[mcp]"
|
|
109
|
+
|
|
103
110
|
# With dev tooling (ruff, mypy, pytest)
|
|
104
111
|
pip install "dataquery-sdk[dev]"
|
|
105
112
|
```
|
|
@@ -367,8 +374,134 @@ dataquery config template --output .env
|
|
|
367
374
|
dataquery auth test
|
|
368
375
|
```
|
|
369
376
|
|
|
370
|
-
|
|
371
|
-
|
|
377
|
+
`--env-file PATH` (to point at a non-default `.env`) is a top-level flag, so it
|
|
378
|
+
goes *before* the subcommand: `dataquery --env-file .env.prod groups`. Most
|
|
379
|
+
subcommands accept `--json` for machine-readable output.
|
|
380
|
+
|
|
381
|
+
## MCP bridge (`mcp-connect`)
|
|
382
|
+
|
|
383
|
+
`dataquery mcp-connect` connects a desktop MCP client — Claude Desktop, Claude
|
|
384
|
+
Code, or any stdio MCP host — to the remote DataQuery MCP server. It speaks
|
|
385
|
+
stdio to the client and streamable HTTP to the server, stamping every outbound
|
|
386
|
+
request with a fresh OAuth (AuthE) bearer token minted from your `DATAQUERY_*`
|
|
387
|
+
credentials. Tokens are refreshed for the life of the session, and the MCP host
|
|
388
|
+
itself never handles your client secret.
|
|
389
|
+
|
|
390
|
+
It needs the `mcp` extra:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
pip install "dataquery-sdk[mcp]"
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Wire it into an MCP client
|
|
397
|
+
|
|
398
|
+
Add the server to your client's MCP config (`claude_desktop_config.json`,
|
|
399
|
+
`.mcp.json`, or the equivalent for your host):
|
|
400
|
+
|
|
401
|
+
```json
|
|
402
|
+
{
|
|
403
|
+
"mcpServers": {
|
|
404
|
+
"dataquery": {
|
|
405
|
+
"command": "dataquery",
|
|
406
|
+
"args": ["mcp-connect", "--save-credentials"],
|
|
407
|
+
"env": {
|
|
408
|
+
"DATAQUERY_CLIENT_ID": "your_client_id",
|
|
409
|
+
"DATAQUERY_CLIENT_SECRET": "your_client_secret"
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
`--save-credentials` copies the credentials it resolved into
|
|
417
|
+
`~/.dataquery/.env` on the first launch (see [Credentials](#credentials)). From
|
|
418
|
+
then on the bridge — and every other SDK call and CLI run on the machine —
|
|
419
|
+
finds them there, so you can drop the `env` block from the config and keep your
|
|
420
|
+
secret out of a file your MCP client reads on every start:
|
|
421
|
+
|
|
422
|
+
```json
|
|
423
|
+
{
|
|
424
|
+
"mcpServers": {
|
|
425
|
+
"dataquery": {
|
|
426
|
+
"command": "dataquery",
|
|
427
|
+
"args": ["mcp-connect"]
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
To skip installing anything, run it straight from PyPI with `uvx`:
|
|
434
|
+
|
|
435
|
+
```json
|
|
436
|
+
{
|
|
437
|
+
"mcpServers": {
|
|
438
|
+
"dataquery": {
|
|
439
|
+
"command": "uvx",
|
|
440
|
+
"args": ["--from", "dataquery-sdk[mcp]", "dataquery", "mcp-connect", "--save-credentials"],
|
|
441
|
+
"env": {
|
|
442
|
+
"DATAQUERY_CLIENT_ID": "your_client_id",
|
|
443
|
+
"DATAQUERY_CLIENT_SECRET": "your_client_secret"
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### Endpoint
|
|
451
|
+
|
|
452
|
+
`--url` is optional. The endpoint resolves as `--url` → `DATAQUERY_MCP_URL` →
|
|
453
|
+
the production server
|
|
454
|
+
`https://api-dataquery.jpmchase.com/research/dataquery-authe/v2/mcp`:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
# Production (no arguments needed)
|
|
458
|
+
dataquery mcp-connect
|
|
459
|
+
|
|
460
|
+
# Another environment
|
|
461
|
+
dataquery mcp-connect --url https://host/research/dataquery-authe/v2/mcp
|
|
462
|
+
DATAQUERY_MCP_URL=https://host/research/dataquery-authe/v2/mcp dataquery mcp-connect
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Credentials
|
|
466
|
+
|
|
467
|
+
Credentials resolve exactly as they do everywhere else in the SDK — flags win,
|
|
468
|
+
then the process environment (what your MCP client exports), then a `.env`,
|
|
469
|
+
then the saved user-level file:
|
|
470
|
+
|
|
471
|
+
```bash
|
|
472
|
+
# From the environment (recommended)
|
|
473
|
+
dataquery mcp-connect
|
|
474
|
+
|
|
475
|
+
# From flags — visible in the process list, so avoid on shared machines
|
|
476
|
+
dataquery mcp-connect --client-id ID --client-secret SECRET
|
|
477
|
+
|
|
478
|
+
# From a non-default .env (top-level flag: before the subcommand)
|
|
479
|
+
dataquery --env-file .env.prod mcp-connect
|
|
480
|
+
|
|
481
|
+
# Bearer token instead of OAuth
|
|
482
|
+
dataquery mcp-connect --bearer-token TOKEN
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
Pass `--save-credentials` once and the resolved credentials are written to
|
|
486
|
+
`~/.dataquery/.env` (owner-only `0600` file in a `0700` directory; override the
|
|
487
|
+
directory with `DATAQUERY_CONFIG_DIR`). Every later SDK call and CLI run reads
|
|
488
|
+
that file as a last-resort fallback, so a plain `DataQuery()` in a script
|
|
489
|
+
authenticates with no environment of its own — while shell variables and a
|
|
490
|
+
local `.env` still take precedence over it.
|
|
491
|
+
|
|
492
|
+
### Flags
|
|
493
|
+
|
|
494
|
+
| Flag | Default | Purpose |
|
|
495
|
+
|---|---|---|
|
|
496
|
+
| `--url URL` | `DATAQUERY_MCP_URL`, else the PROD endpoint | Remote MCP endpoint |
|
|
497
|
+
| `--name NAME` | `dataquery-mcp` | Proxy server name reported to the MCP client |
|
|
498
|
+
| `--client-id ID` | _(from env)_ | OAuth client ID; exported as `DATAQUERY_CLIENT_ID` |
|
|
499
|
+
| `--client-secret SECRET` | _(from env)_ | OAuth client secret; exported as `DATAQUERY_CLIENT_SECRET` |
|
|
500
|
+
| `--bearer-token TOKEN` | _(from env)_ | Use a bearer token instead of OAuth |
|
|
501
|
+
| `--save-credentials` | off | Also persist the resolved credentials to `~/.dataquery/.env` |
|
|
502
|
+
|
|
503
|
+
Because stdout carries the JSON-RPC channel, all logging and diagnostics go to
|
|
504
|
+
stderr — look in your MCP client's server log when something fails.
|
|
372
505
|
|
|
373
506
|
## Configuration
|
|
374
507
|
|
|
@@ -385,6 +518,16 @@ All environment variables use the `DATAQUERY_` prefix.
|
|
|
385
518
|
| `DATAQUERY_BEARER_TOKEN` | _(none)_ | Alternative to OAuth |
|
|
386
519
|
| `DATAQUERY_OAUTH_ENABLED` | `true` | Set `false` to use bearer-token mode |
|
|
387
520
|
|
|
521
|
+
**Endpoints**
|
|
522
|
+
|
|
523
|
+
| Variable | Default | Notes |
|
|
524
|
+
|---|---|---|
|
|
525
|
+
| `DATAQUERY_BASE_URL` | `https://api-dataquery.jpmchase.com` | Host for both API surfaces |
|
|
526
|
+
| `DATAQUERY_FILES_BASE_URL` | same as `BASE_URL` | Override only if file endpoints live on another host |
|
|
527
|
+
| `DATAQUERY_OAUTH_TOKEN_URL` | `https://authe.jpmorgan.com/as/token.oauth2` | Token endpoint |
|
|
528
|
+
| `DATAQUERY_OAUTH_AUD` | PROD audience | Set to the value provisioned for your client |
|
|
529
|
+
| `DATAQUERY_MCP_URL` | PROD MCP endpoint | Endpoint used by [`mcp-connect`](#mcp-bridge-mcp-connect); `--url` overrides it |
|
|
530
|
+
|
|
388
531
|
**HTTP / retry / rate limit**
|
|
389
532
|
|
|
390
533
|
| Variable | Default |
|
|
@@ -549,6 +692,17 @@ async with DataQuery() as dq:
|
|
|
549
692
|
`manager.clear_event_id()` (or `dataquery download --watch --reset-event-id`)
|
|
550
693
|
only when you intentionally want a clean slate.
|
|
551
694
|
|
|
695
|
+
**MCP client shows the server as failed**
|
|
696
|
+
|
|
697
|
+
- `The MCP bridge requires the 'mcp' extra` in the server log means `fastmcp`
|
|
698
|
+
is missing — `pip install "dataquery-sdk[mcp]"`, or use the `uvx` form.
|
|
699
|
+
- MCP hosts usually launch the command with a minimal environment, so a
|
|
700
|
+
`.env` in your shell's working directory may not be visible. Put the
|
|
701
|
+
credentials in the server's `env` block, or run `dataquery mcp-connect
|
|
702
|
+
--save-credentials` once from a terminal where they do resolve.
|
|
703
|
+
- Auth failures surface as `Could not obtain an OAuth token`; verify the same
|
|
704
|
+
credentials with `dataquery auth test` before debugging the bridge.
|
|
705
|
+
|
|
552
706
|
## Date formats
|
|
553
707
|
|
|
554
708
|
```python
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import argparse
|
|
4
4
|
import asyncio
|
|
5
5
|
import json
|
|
6
|
+
import os
|
|
6
7
|
import sys
|
|
7
8
|
from collections.abc import AsyncGenerator
|
|
8
9
|
from pathlib import Path
|
|
@@ -80,6 +81,64 @@ def _print_error(message: str, *, suggestion: Optional[str] = None) -> None:
|
|
|
80
81
|
print(json.dumps(envelope, indent=2))
|
|
81
82
|
|
|
82
83
|
|
|
84
|
+
_MCP_CREDENTIAL_FLAGS = (
|
|
85
|
+
("client_id", "CLIENT_ID"),
|
|
86
|
+
("client_secret", "CLIENT_SECRET"),
|
|
87
|
+
("bearer_token", "BEARER_TOKEN"),
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# Endpoint settings saved alongside the credentials, so a later DataQuery()
|
|
91
|
+
# mints tokens against the same environment instead of the PROD defaults.
|
|
92
|
+
_MCP_SAVED_SETTINGS = ("BASE_URL", "OAUTH_TOKEN_URL", "OAUTH_AUD")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _export_mcp_credentials(args: argparse.Namespace) -> List[str]:
|
|
96
|
+
"""Export ``mcp-connect`` credential flags into the ``DATAQUERY_*`` process env.
|
|
97
|
+
|
|
98
|
+
Flags win over anything already exported, so the rest of this process —
|
|
99
|
+
the token manager here, and any SDK use later on — resolves them the usual
|
|
100
|
+
way with no separate environment setup. Returns the unprefixed keys that
|
|
101
|
+
are actually set afterwards, in save order.
|
|
102
|
+
"""
|
|
103
|
+
from dataquery.config import EnvConfig
|
|
104
|
+
|
|
105
|
+
for attr, env_key in _MCP_CREDENTIAL_FLAGS:
|
|
106
|
+
value = getattr(args, attr, None)
|
|
107
|
+
if value:
|
|
108
|
+
os.environ[f"{EnvConfig.PREFIX}{env_key}"] = value
|
|
109
|
+
|
|
110
|
+
keys = [env_key for _, env_key in _MCP_CREDENTIAL_FLAGS] + list(_MCP_SAVED_SETTINGS)
|
|
111
|
+
# os.environ rather than get_env_var: model defaults must not be persisted
|
|
112
|
+
# as if the user had chosen them.
|
|
113
|
+
return [key for key in keys if os.environ.get(f"{EnvConfig.PREFIX}{key}")]
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def _save_mcp_credentials(keys: List[str]) -> None:
|
|
117
|
+
"""Persist the resolved credentials to the user-level ``.env``.
|
|
118
|
+
|
|
119
|
+
Best effort: a failure here is reported but never takes the MCP connection
|
|
120
|
+
down with it. Messages go to stderr — stdout is the JSON-RPC channel.
|
|
121
|
+
"""
|
|
122
|
+
from dataquery.config import EnvConfig
|
|
123
|
+
|
|
124
|
+
if not any(key in keys for key in ("CLIENT_ID", "CLIENT_SECRET", "BEARER_TOKEN")):
|
|
125
|
+
print(
|
|
126
|
+
"--save-credentials: nothing to save; pass --client-id/--client-secret "
|
|
127
|
+
"or set DATAQUERY_CLIENT_ID/DATAQUERY_CLIENT_SECRET.",
|
|
128
|
+
file=sys.stderr,
|
|
129
|
+
)
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
values = {key: os.environ.get(f"{EnvConfig.PREFIX}{key}") for key in keys}
|
|
133
|
+
try:
|
|
134
|
+
env_file = EnvConfig.save_user_env(values)
|
|
135
|
+
except OSError as exc:
|
|
136
|
+
print(f"--save-credentials: could not write credentials: {exc}", file=sys.stderr)
|
|
137
|
+
return
|
|
138
|
+
saved = ", ".join(f"{EnvConfig.PREFIX}{key}" for key in keys)
|
|
139
|
+
print(f"Saved {saved} to {env_file} (owner-only)", file=sys.stderr)
|
|
140
|
+
|
|
141
|
+
|
|
83
142
|
def create_parser() -> argparse.ArgumentParser:
|
|
84
143
|
"""Create the top-level CLI parser with subcommands."""
|
|
85
144
|
parser = argparse.ArgumentParser(description="Command Line Interface for the DataQuery SDK")
|
|
@@ -294,12 +353,42 @@ def create_parser() -> argparse.ArgumentParser:
|
|
|
294
353
|
"Bridge a desktop MCP client (stdio) to a remote streamable-HTTP MCP\n"
|
|
295
354
|
"server, authenticating with an OAuth client-credentials (AuthE) token\n"
|
|
296
355
|
"minted from the DATAQUERY_* environment. Point your MCP client's\n"
|
|
297
|
-
"`command` at: dataquery mcp-connect
|
|
356
|
+
"`command` at: dataquery mcp-connect\n"
|
|
357
|
+
"\n"
|
|
358
|
+
"The endpoint defaults to the PROD MCP server; override it with --url\n"
|
|
359
|
+
"or DATAQUERY_MCP_URL to reach a different environment.\n"
|
|
360
|
+
"\n"
|
|
361
|
+
"Credentials passed as flags are exported into the DATAQUERY_*\n"
|
|
362
|
+
"environment of this process; add --save-credentials to also write\n"
|
|
363
|
+
"them to ~/.dataquery/.env, which every later SDK call picks up so\n"
|
|
364
|
+
"no environment has to be set up again."
|
|
298
365
|
),
|
|
299
366
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
300
367
|
)
|
|
301
|
-
p_connect.add_argument(
|
|
368
|
+
p_connect.add_argument(
|
|
369
|
+
"--url",
|
|
370
|
+
default=None,
|
|
371
|
+
help="Remote MCP endpoint URL (default: DATAQUERY_MCP_URL, else the PROD MCP endpoint)",
|
|
372
|
+
)
|
|
302
373
|
p_connect.add_argument("--name", default="dataquery-mcp", help="Proxy server name (default: dataquery-mcp)")
|
|
374
|
+
p_connect.add_argument("--client-id", default=None, help="OAuth client ID (exported as DATAQUERY_CLIENT_ID)")
|
|
375
|
+
p_connect.add_argument(
|
|
376
|
+
"--client-secret",
|
|
377
|
+
default=None,
|
|
378
|
+
help="OAuth client secret (exported as DATAQUERY_CLIENT_SECRET); visible in the process list, "
|
|
379
|
+
"so prefer DATAQUERY_CLIENT_SECRET or --env-file on shared machines",
|
|
380
|
+
)
|
|
381
|
+
p_connect.add_argument(
|
|
382
|
+
"--bearer-token",
|
|
383
|
+
default=None,
|
|
384
|
+
help="Bearer token to use instead of OAuth credentials (exported as DATAQUERY_BEARER_TOKEN)",
|
|
385
|
+
)
|
|
386
|
+
p_connect.add_argument(
|
|
387
|
+
"--save-credentials",
|
|
388
|
+
action="store_true",
|
|
389
|
+
help="Also save the resolved credentials to ~/.dataquery/.env (owner-only) so later SDK use "
|
|
390
|
+
"needs no environment variables",
|
|
391
|
+
)
|
|
303
392
|
|
|
304
393
|
return parser
|
|
305
394
|
|
|
@@ -735,7 +824,7 @@ async def cmd_mcp_connect(args: argparse.Namespace) -> int:
|
|
|
735
824
|
"The MCP bridge requires the 'mcp' extra. Install it with:\n"
|
|
736
825
|
" pip install 'dataquery-sdk[mcp]'\n"
|
|
737
826
|
"or run it directly with:\n"
|
|
738
|
-
" uvx --from 'dataquery-sdk[mcp]' dataquery mcp-connect
|
|
827
|
+
" uvx --from 'dataquery-sdk[mcp]' dataquery mcp-connect",
|
|
739
828
|
file=sys.stderr,
|
|
740
829
|
)
|
|
741
830
|
return 1
|
|
@@ -743,7 +832,26 @@ async def cmd_mcp_connect(args: argparse.Namespace) -> int:
|
|
|
743
832
|
from dataquery.config import EnvConfig
|
|
744
833
|
from dataquery.transport.auth import TokenManager
|
|
745
834
|
|
|
746
|
-
|
|
835
|
+
if getattr(args, "env_file", None):
|
|
836
|
+
EnvConfig.load_env_file(Path(args.env_file))
|
|
837
|
+
# Load saved credentials before exporting, so they too land in the process
|
|
838
|
+
# env and a re-launch with --save-credentials rewrites them instead of
|
|
839
|
+
# reporting nothing to save. Loaded last, so it never wins over the above.
|
|
840
|
+
EnvConfig.load_user_env_file()
|
|
841
|
+
savable = _export_mcp_credentials(args)
|
|
842
|
+
if getattr(args, "save_credentials", False):
|
|
843
|
+
_save_mcp_credentials(savable)
|
|
844
|
+
|
|
845
|
+
config = EnvConfig.create_client_config()
|
|
846
|
+
# --url wins; otherwise DATAQUERY_MCP_URL, and failing that the model
|
|
847
|
+
# default (PROD). Only an explicitly emptied env var leaves it unset.
|
|
848
|
+
url = getattr(args, "url", None) or config.mcp_url
|
|
849
|
+
if not url:
|
|
850
|
+
print(
|
|
851
|
+
"No MCP endpoint configured: pass --url or set DATAQUERY_MCP_URL.",
|
|
852
|
+
file=sys.stderr,
|
|
853
|
+
)
|
|
854
|
+
return 1
|
|
747
855
|
token_manager = TokenManager(config)
|
|
748
856
|
|
|
749
857
|
class _AutheAuth(httpx.Auth):
|
|
@@ -760,7 +868,7 @@ async def cmd_mcp_connect(args: argparse.Namespace) -> int:
|
|
|
760
868
|
request.headers["Authorization"] = header
|
|
761
869
|
yield request
|
|
762
870
|
|
|
763
|
-
transport = StreamableHttpTransport(
|
|
871
|
+
transport = StreamableHttpTransport(url, auth=_AutheAuth())
|
|
764
872
|
proxy = FastMCP.as_proxy(transport, name=args.name)
|
|
765
873
|
await proxy.run_async(transport="stdio", show_banner=False)
|
|
766
874
|
return 0
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
+
import re
|
|
6
7
|
from pathlib import Path
|
|
7
|
-
from typing import Any, Dict, Optional, Union, get_args, get_origin
|
|
8
|
+
from typing import Any, Dict, List, Mapping, Optional, Union, get_args, get_origin
|
|
8
9
|
|
|
9
10
|
from dotenv import load_dotenv
|
|
10
11
|
from pydantic_core import PydanticUndefined
|
|
@@ -30,6 +31,37 @@ _SENSITIVE_FIELDS = frozenset(
|
|
|
30
31
|
}
|
|
31
32
|
)
|
|
32
33
|
|
|
34
|
+
# User-level config: credentials saved once (e.g. by `dataquery mcp-connect
|
|
35
|
+
# --save-credentials`) and reused by every later SDK call in any process.
|
|
36
|
+
_USER_CONFIG_DIR_ENV = "DATAQUERY_CONFIG_DIR"
|
|
37
|
+
_USER_CONFIG_DIR_DEFAULT = "~/.dataquery"
|
|
38
|
+
_USER_ENV_FILENAME = ".env"
|
|
39
|
+
|
|
40
|
+
_USER_ENV_HEADER = [
|
|
41
|
+
"# DataQuery SDK credentials.",
|
|
42
|
+
"# Written by `dataquery mcp-connect --save-credentials`; loaded as a",
|
|
43
|
+
"# fallback only, so shell env vars and a local .env still win.",
|
|
44
|
+
"# Values are read literally: ${VAR} is not expanded here.",
|
|
45
|
+
"",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
_ENV_LINE_RE = re.compile(r"^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=")
|
|
49
|
+
|
|
50
|
+
# Characters common in ids, secrets and URLs that need no .env quoting.
|
|
51
|
+
_UNQUOTED_EXTRA_CHARS = "._-:/@+~"
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _format_env_value(value: str) -> str:
|
|
55
|
+
"""Render a value for a ``.env`` line, quoting only when it needs it."""
|
|
56
|
+
if value and all(ch.isalnum() or ch in _UNQUOTED_EXTRA_CHARS for ch in value):
|
|
57
|
+
return value
|
|
58
|
+
if "'" not in value and "\n" not in value and "\r" not in value:
|
|
59
|
+
return f"'{value}'"
|
|
60
|
+
# Escapes keep the entry on a single physical line, which the line-based
|
|
61
|
+
# merge in ``save_user_env`` depends on.
|
|
62
|
+
escaped = value.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n").replace("\r", "\\r")
|
|
63
|
+
return f'"{escaped}"'
|
|
64
|
+
|
|
33
65
|
|
|
34
66
|
def _env_name_for(field_name: str) -> str:
|
|
35
67
|
"""Project a Pydantic field name to its env-var key (no PREFIX)."""
|
|
@@ -76,6 +108,77 @@ class EnvConfig:
|
|
|
76
108
|
if env_file.exists():
|
|
77
109
|
load_dotenv(env_file)
|
|
78
110
|
|
|
111
|
+
@classmethod
|
|
112
|
+
def user_config_dir(cls) -> Path:
|
|
113
|
+
"""Directory holding user-level SDK config (``$DATAQUERY_CONFIG_DIR`` or ``~/.dataquery``)."""
|
|
114
|
+
raw = os.getenv(_USER_CONFIG_DIR_ENV) or _USER_CONFIG_DIR_DEFAULT
|
|
115
|
+
return Path(raw).expanduser()
|
|
116
|
+
|
|
117
|
+
@classmethod
|
|
118
|
+
def user_env_file(cls) -> Path:
|
|
119
|
+
"""Path of the user-level ``.env`` holding saved credentials."""
|
|
120
|
+
return cls.user_config_dir() / _USER_ENV_FILENAME
|
|
121
|
+
|
|
122
|
+
@classmethod
|
|
123
|
+
def load_user_env_file(cls) -> bool:
|
|
124
|
+
"""Load the user-level ``.env`` as a fallback; never overrides what is already set."""
|
|
125
|
+
env_file = cls.user_env_file()
|
|
126
|
+
if not env_file.exists():
|
|
127
|
+
return False
|
|
128
|
+
# interpolate=False: values here are literal secrets, and dotenv's
|
|
129
|
+
# ${VAR} expansion runs after unquoting, so no quoting style escapes it.
|
|
130
|
+
load_dotenv(env_file, override=False, interpolate=False)
|
|
131
|
+
return True
|
|
132
|
+
|
|
133
|
+
@classmethod
|
|
134
|
+
def save_user_env(cls, values: Mapping[str, Optional[str]]) -> Path:
|
|
135
|
+
"""Merge ``DATAQUERY_<key>=<value>`` pairs into the user-level ``.env``.
|
|
136
|
+
|
|
137
|
+
Keys are unprefixed (``CLIENT_ID``) and empty values are skipped. Lines
|
|
138
|
+
for a key being saved are rewritten in place, anything else already in
|
|
139
|
+
the file is preserved, and the file is (re)written owner-readable only.
|
|
140
|
+
"""
|
|
141
|
+
updates: Dict[str, str] = {}
|
|
142
|
+
for key, value in values.items():
|
|
143
|
+
if value:
|
|
144
|
+
updates[f"{cls.PREFIX}{key}"] = value
|
|
145
|
+
|
|
146
|
+
env_file = cls.user_env_file()
|
|
147
|
+
env_file.parent.mkdir(parents=True, exist_ok=True)
|
|
148
|
+
try:
|
|
149
|
+
env_file.parent.chmod(0o700)
|
|
150
|
+
except OSError: # pragma: no cover - non-POSIX filesystem
|
|
151
|
+
pass
|
|
152
|
+
|
|
153
|
+
lines: List[str] = []
|
|
154
|
+
written: set[str] = set()
|
|
155
|
+
if env_file.exists():
|
|
156
|
+
for line in env_file.read_text().splitlines():
|
|
157
|
+
match = _ENV_LINE_RE.match(line)
|
|
158
|
+
line_key = match.group(1) if match else None
|
|
159
|
+
if line_key is None or line_key not in updates:
|
|
160
|
+
lines.append(line)
|
|
161
|
+
elif line_key not in written:
|
|
162
|
+
lines.append(f"{line_key}={_format_env_value(updates[line_key])}")
|
|
163
|
+
written.add(line_key)
|
|
164
|
+
# else: drop a stale duplicate of a key just rewritten above
|
|
165
|
+
else:
|
|
166
|
+
lines.extend(_USER_ENV_HEADER)
|
|
167
|
+
|
|
168
|
+
for key, value in updates.items():
|
|
169
|
+
if key not in written:
|
|
170
|
+
lines.append(f"{key}={_format_env_value(value)}")
|
|
171
|
+
|
|
172
|
+
# O_CREAT mode only applies to new files, so chmod covers the rest.
|
|
173
|
+
fd = os.open(env_file, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
|
|
174
|
+
with os.fdopen(fd, "w") as handle:
|
|
175
|
+
handle.write("\n".join(lines) + "\n")
|
|
176
|
+
try:
|
|
177
|
+
env_file.chmod(0o600)
|
|
178
|
+
except OSError: # pragma: no cover - non-POSIX filesystem
|
|
179
|
+
pass
|
|
180
|
+
return env_file
|
|
181
|
+
|
|
79
182
|
@classmethod
|
|
80
183
|
def get_env_var(cls, key: str, default: Optional[str] = None) -> Optional[str]:
|
|
81
184
|
"""Read ``$DATAQUERY_<key>`` with the model default as the fallback."""
|
|
@@ -132,6 +235,11 @@ class EnvConfig:
|
|
|
132
235
|
if env_file is not None:
|
|
133
236
|
cls.load_env_file(env_file)
|
|
134
237
|
|
|
238
|
+
# Lowest precedence, loaded last so it fills only what is still unset:
|
|
239
|
+
# credentials saved by `mcp-connect --save-credentials`, which let a
|
|
240
|
+
# later DataQuery() authenticate with no environment of its own.
|
|
241
|
+
cls.load_user_env_file()
|
|
242
|
+
|
|
135
243
|
if not cls.get_env_var("BASE_URL"):
|
|
136
244
|
raise ConfigurationError(f"{cls.PREFIX}BASE_URL environment variable is required")
|
|
137
245
|
|
|
@@ -212,10 +212,20 @@ def _emit_stdout(message: Dict[str, Any]) -> None:
|
|
|
212
212
|
sys.stdout.flush()
|
|
213
213
|
|
|
214
214
|
|
|
215
|
-
async def run_mcp_proxy(url: str, env_file: Optional[Path] = None) -> int:
|
|
216
|
-
"""Run the stdio <-> Streamable HTTP proxy until stdin closes.
|
|
215
|
+
async def run_mcp_proxy(url: Optional[str] = None, env_file: Optional[Path] = None) -> int:
|
|
216
|
+
"""Run the stdio <-> Streamable HTTP proxy until stdin closes.
|
|
217
|
+
|
|
218
|
+
``url`` defaults to ``DATAQUERY_MCP_URL``, and failing that to the PROD MCP
|
|
219
|
+
endpoint carried by :class:`ClientConfig`.
|
|
220
|
+
"""
|
|
217
221
|
_configure_stderr_logging()
|
|
218
222
|
try:
|
|
223
|
+
if env_file is not None:
|
|
224
|
+
EnvConfig.load_env_file(env_file)
|
|
225
|
+
EnvConfig.load_user_env_file()
|
|
226
|
+
url = url or EnvConfig.get_env_var("MCP_URL")
|
|
227
|
+
if not url:
|
|
228
|
+
raise ConfigurationError("No MCP endpoint configured: pass a url or set DATAQUERY_MCP_URL")
|
|
219
229
|
oauth = _build_oauth_manager(url, env_file)
|
|
220
230
|
await oauth.authenticate()
|
|
221
231
|
except (ConfigurationError, AuthenticationError) as exc:
|
|
@@ -157,6 +157,7 @@ class SSEClient:
|
|
|
157
157
|
async def _get_headers(self) -> dict:
|
|
158
158
|
headers = await self.auth_manager.get_headers()
|
|
159
159
|
headers["Accept"] = "text/event-stream"
|
|
160
|
+
headers.update(self.config.get_custom_headers())
|
|
160
161
|
if self._last_event_id is not None:
|
|
161
162
|
headers["Last-Event-ID"] = self._last_event_id
|
|
162
163
|
return headers
|
|
@@ -51,6 +51,10 @@ class ClientConfig(BaseModel):
|
|
|
51
51
|
)
|
|
52
52
|
context_path: Optional[str] = Field(default="/research/dataquery-authe/api/v2", description="API context path")
|
|
53
53
|
api_version: str = Field(default="2.0.0", description="API version")
|
|
54
|
+
x_user_agent: Optional[str] = Field(
|
|
55
|
+
default=None,
|
|
56
|
+
description="Optional value for the X-User-Agent header sent on each API request",
|
|
57
|
+
)
|
|
54
58
|
files_base_url: Optional[str] = Field(
|
|
55
59
|
default="https://api-dataquery.jpmchase.com",
|
|
56
60
|
description="Separate base URL for file endpoints",
|
|
@@ -59,6 +63,10 @@ class ClientConfig(BaseModel):
|
|
|
59
63
|
default="/research/dataquery-authe/api/v2",
|
|
60
64
|
description="Context path for the files host",
|
|
61
65
|
)
|
|
66
|
+
mcp_url: Optional[str] = Field(
|
|
67
|
+
default="https://api-dataquery.jpmchase.com/research/dataquery-authe/v2/mcp",
|
|
68
|
+
description="Remote MCP endpoint bridged by `dataquery mcp-connect`",
|
|
69
|
+
)
|
|
62
70
|
|
|
63
71
|
oauth_enabled: bool = Field(default=True, description="Enable OAuth authentication")
|
|
64
72
|
oauth_token_url: Optional[str] = Field(
|
|
@@ -242,6 +250,13 @@ class ClientConfig(BaseModel):
|
|
|
242
250
|
kwargs["proxy_headers"] = {"Proxy-Authorization": f"Basic {token}"}
|
|
243
251
|
return kwargs
|
|
244
252
|
|
|
253
|
+
def get_custom_headers(self) -> Dict[str, str]:
|
|
254
|
+
"""Return extra headers to attach to every API request (e.g. X-User-Agent)."""
|
|
255
|
+
headers: Dict[str, str] = {}
|
|
256
|
+
if self.x_user_agent:
|
|
257
|
+
headers["X-User-Agent"] = self.x_user_agent
|
|
258
|
+
return headers
|
|
259
|
+
|
|
245
260
|
@property
|
|
246
261
|
def api_base_url(self) -> str:
|
|
247
262
|
"""Get the complete API base URL including context path."""
|
|
@@ -52,6 +52,10 @@ DATAQUERY_BASE_URL=https://api-dataquery.jpmchase.com
|
|
|
52
52
|
# DATAQUERY_FILES_BASE_URL=https://api-dataquery.jpmchase.com
|
|
53
53
|
# DATAQUERY_FILES_CONTEXT_PATH=/research/dataquery-authe/api/v2
|
|
54
54
|
|
|
55
|
+
# Optional: remote MCP endpoint bridged by `dataquery mcp-connect`
|
|
56
|
+
# Defaults to the PROD endpoint below; override for another environment.
|
|
57
|
+
# DATAQUERY_MCP_URL=https://api-dataquery.jpmchase.com/research/dataquery-authe/v2/mcp
|
|
58
|
+
|
|
55
59
|
# =============================================================================
|
|
56
60
|
# AUTHENTICATION: OAuth 2.0 Configuration (Recommended)
|
|
57
61
|
# =============================================================================
|
|
@@ -171,6 +175,9 @@ DATAQUERY_DEFAULT_DIR=files
|
|
|
171
175
|
# Default: DATAQUERY-SDK/1.2.1
|
|
172
176
|
DATAQUERY_USER_AGENT=DATAQUERY-SDK/1.2.1
|
|
173
177
|
|
|
178
|
+
# Optional custom X-User-Agent header sent on every API request
|
|
179
|
+
# DATAQUERY_X_USER_AGENT=MyApp/1.0
|
|
180
|
+
|
|
174
181
|
# Enable HTTP/2 support (true/false)
|
|
175
182
|
# Default: true
|
|
176
183
|
DATAQUERY_ENABLE_HTTP2=true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataquery-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.5
|
|
4
4
|
Summary: Python SDK for DATAQUERY Data API - Query, download, and check availability of economic data files
|
|
5
5
|
Author-email: DATAQUERY SDK Team <dataquery_support@jpmorgan.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/jpmorganchase/dataquery-sdk
|
|
@@ -25,7 +25,7 @@ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
|
25
25
|
Requires-Python: >=3.12
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
|
-
Requires-Dist: aiohttp<4.0.0,>=3.
|
|
28
|
+
Requires-Dist: aiohttp<4.0.0,>=3.14.3
|
|
29
29
|
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
30
30
|
Requires-Dist: structlog>=23.0.0
|
|
31
31
|
Requires-Dist: python-dotenv>=1.0.0
|
|
@@ -46,7 +46,7 @@ Requires-Dist: mkdocs>=1.5.0; extra == "docs"
|
|
|
46
46
|
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
47
47
|
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == "docs"
|
|
48
48
|
Requires-Dist: mike>=1.1.0; extra == "docs"
|
|
49
|
-
Requires-Dist: pymdown-extensions>=
|
|
49
|
+
Requires-Dist: pymdown-extensions>=11.0.0; extra == "docs"
|
|
50
50
|
Provides-Extra: pandas
|
|
51
51
|
Requires-Dist: pandas>=2.0.0; extra == "pandas"
|
|
52
52
|
Provides-Extra: mcp
|
|
@@ -67,7 +67,7 @@ Requires-Dist: fastmcp>=2.14; extra == "all"
|
|
|
67
67
|
Requires-Dist: pip-audit>=2.7.0; extra == "all"
|
|
68
68
|
Requires-Dist: build>=1.3.0; extra == "all"
|
|
69
69
|
Requires-Dist: urllib3>=2.7.0; extra == "all"
|
|
70
|
-
Requires-Dist: pymdown-extensions>=
|
|
70
|
+
Requires-Dist: pymdown-extensions>=11.0.0; extra == "all"
|
|
71
71
|
Dynamic: license-file
|
|
72
72
|
|
|
73
73
|
# DataQuery SDK
|
|
@@ -98,6 +98,7 @@ built in for both.
|
|
|
98
98
|
- [Quick start — JSON Data API](#quick-start--json-data-api)
|
|
99
99
|
- [Auto-download (SSE)](#auto-download-sse)
|
|
100
100
|
- [CLI](#cli)
|
|
101
|
+
- [MCP bridge (`mcp-connect`)](#mcp-bridge-mcp-connect)
|
|
101
102
|
- [Configuration](#configuration)
|
|
102
103
|
- [Logging](#logging)
|
|
103
104
|
- [Error handling](#error-handling)
|
|
@@ -140,6 +141,9 @@ through one `DataQuery` client — pick the methods that match what you need.
|
|
|
140
141
|
- **Retry + circuit breaker** — exponential backoff, configurable failure threshold
|
|
141
142
|
- **Sync and async APIs** — every operation has `_async` and sync variants
|
|
142
143
|
- **CLI** — `dataquery groups | files | availability | download | download-group | auth | config`
|
|
144
|
+
- **MCP bridge** — `dataquery mcp-connect` connects any stdio MCP client
|
|
145
|
+
(Claude Desktop, Claude Code, …) to the remote DataQuery MCP server, minting
|
|
146
|
+
OAuth tokens for it
|
|
143
147
|
|
|
144
148
|
## New here? Three steps to your first download
|
|
145
149
|
|
|
@@ -172,6 +176,9 @@ pip install dataquery-sdk
|
|
|
172
176
|
# With pandas DataFrame conversion
|
|
173
177
|
pip install "dataquery-sdk[pandas]"
|
|
174
178
|
|
|
179
|
+
# With the MCP bridge (dataquery mcp-connect)
|
|
180
|
+
pip install "dataquery-sdk[mcp]"
|
|
181
|
+
|
|
175
182
|
# With dev tooling (ruff, mypy, pytest)
|
|
176
183
|
pip install "dataquery-sdk[dev]"
|
|
177
184
|
```
|
|
@@ -439,8 +446,134 @@ dataquery config template --output .env
|
|
|
439
446
|
dataquery auth test
|
|
440
447
|
```
|
|
441
448
|
|
|
442
|
-
|
|
443
|
-
|
|
449
|
+
`--env-file PATH` (to point at a non-default `.env`) is a top-level flag, so it
|
|
450
|
+
goes *before* the subcommand: `dataquery --env-file .env.prod groups`. Most
|
|
451
|
+
subcommands accept `--json` for machine-readable output.
|
|
452
|
+
|
|
453
|
+
## MCP bridge (`mcp-connect`)
|
|
454
|
+
|
|
455
|
+
`dataquery mcp-connect` connects a desktop MCP client — Claude Desktop, Claude
|
|
456
|
+
Code, or any stdio MCP host — to the remote DataQuery MCP server. It speaks
|
|
457
|
+
stdio to the client and streamable HTTP to the server, stamping every outbound
|
|
458
|
+
request with a fresh OAuth (AuthE) bearer token minted from your `DATAQUERY_*`
|
|
459
|
+
credentials. Tokens are refreshed for the life of the session, and the MCP host
|
|
460
|
+
itself never handles your client secret.
|
|
461
|
+
|
|
462
|
+
It needs the `mcp` extra:
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
pip install "dataquery-sdk[mcp]"
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### Wire it into an MCP client
|
|
469
|
+
|
|
470
|
+
Add the server to your client's MCP config (`claude_desktop_config.json`,
|
|
471
|
+
`.mcp.json`, or the equivalent for your host):
|
|
472
|
+
|
|
473
|
+
```json
|
|
474
|
+
{
|
|
475
|
+
"mcpServers": {
|
|
476
|
+
"dataquery": {
|
|
477
|
+
"command": "dataquery",
|
|
478
|
+
"args": ["mcp-connect", "--save-credentials"],
|
|
479
|
+
"env": {
|
|
480
|
+
"DATAQUERY_CLIENT_ID": "your_client_id",
|
|
481
|
+
"DATAQUERY_CLIENT_SECRET": "your_client_secret"
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
`--save-credentials` copies the credentials it resolved into
|
|
489
|
+
`~/.dataquery/.env` on the first launch (see [Credentials](#credentials)). From
|
|
490
|
+
then on the bridge — and every other SDK call and CLI run on the machine —
|
|
491
|
+
finds them there, so you can drop the `env` block from the config and keep your
|
|
492
|
+
secret out of a file your MCP client reads on every start:
|
|
493
|
+
|
|
494
|
+
```json
|
|
495
|
+
{
|
|
496
|
+
"mcpServers": {
|
|
497
|
+
"dataquery": {
|
|
498
|
+
"command": "dataquery",
|
|
499
|
+
"args": ["mcp-connect"]
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
To skip installing anything, run it straight from PyPI with `uvx`:
|
|
506
|
+
|
|
507
|
+
```json
|
|
508
|
+
{
|
|
509
|
+
"mcpServers": {
|
|
510
|
+
"dataquery": {
|
|
511
|
+
"command": "uvx",
|
|
512
|
+
"args": ["--from", "dataquery-sdk[mcp]", "dataquery", "mcp-connect", "--save-credentials"],
|
|
513
|
+
"env": {
|
|
514
|
+
"DATAQUERY_CLIENT_ID": "your_client_id",
|
|
515
|
+
"DATAQUERY_CLIENT_SECRET": "your_client_secret"
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Endpoint
|
|
523
|
+
|
|
524
|
+
`--url` is optional. The endpoint resolves as `--url` → `DATAQUERY_MCP_URL` →
|
|
525
|
+
the production server
|
|
526
|
+
`https://api-dataquery.jpmchase.com/research/dataquery-authe/v2/mcp`:
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
# Production (no arguments needed)
|
|
530
|
+
dataquery mcp-connect
|
|
531
|
+
|
|
532
|
+
# Another environment
|
|
533
|
+
dataquery mcp-connect --url https://host/research/dataquery-authe/v2/mcp
|
|
534
|
+
DATAQUERY_MCP_URL=https://host/research/dataquery-authe/v2/mcp dataquery mcp-connect
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### Credentials
|
|
538
|
+
|
|
539
|
+
Credentials resolve exactly as they do everywhere else in the SDK — flags win,
|
|
540
|
+
then the process environment (what your MCP client exports), then a `.env`,
|
|
541
|
+
then the saved user-level file:
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
# From the environment (recommended)
|
|
545
|
+
dataquery mcp-connect
|
|
546
|
+
|
|
547
|
+
# From flags — visible in the process list, so avoid on shared machines
|
|
548
|
+
dataquery mcp-connect --client-id ID --client-secret SECRET
|
|
549
|
+
|
|
550
|
+
# From a non-default .env (top-level flag: before the subcommand)
|
|
551
|
+
dataquery --env-file .env.prod mcp-connect
|
|
552
|
+
|
|
553
|
+
# Bearer token instead of OAuth
|
|
554
|
+
dataquery mcp-connect --bearer-token TOKEN
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
Pass `--save-credentials` once and the resolved credentials are written to
|
|
558
|
+
`~/.dataquery/.env` (owner-only `0600` file in a `0700` directory; override the
|
|
559
|
+
directory with `DATAQUERY_CONFIG_DIR`). Every later SDK call and CLI run reads
|
|
560
|
+
that file as a last-resort fallback, so a plain `DataQuery()` in a script
|
|
561
|
+
authenticates with no environment of its own — while shell variables and a
|
|
562
|
+
local `.env` still take precedence over it.
|
|
563
|
+
|
|
564
|
+
### Flags
|
|
565
|
+
|
|
566
|
+
| Flag | Default | Purpose |
|
|
567
|
+
|---|---|---|
|
|
568
|
+
| `--url URL` | `DATAQUERY_MCP_URL`, else the PROD endpoint | Remote MCP endpoint |
|
|
569
|
+
| `--name NAME` | `dataquery-mcp` | Proxy server name reported to the MCP client |
|
|
570
|
+
| `--client-id ID` | _(from env)_ | OAuth client ID; exported as `DATAQUERY_CLIENT_ID` |
|
|
571
|
+
| `--client-secret SECRET` | _(from env)_ | OAuth client secret; exported as `DATAQUERY_CLIENT_SECRET` |
|
|
572
|
+
| `--bearer-token TOKEN` | _(from env)_ | Use a bearer token instead of OAuth |
|
|
573
|
+
| `--save-credentials` | off | Also persist the resolved credentials to `~/.dataquery/.env` |
|
|
574
|
+
|
|
575
|
+
Because stdout carries the JSON-RPC channel, all logging and diagnostics go to
|
|
576
|
+
stderr — look in your MCP client's server log when something fails.
|
|
444
577
|
|
|
445
578
|
## Configuration
|
|
446
579
|
|
|
@@ -457,6 +590,16 @@ All environment variables use the `DATAQUERY_` prefix.
|
|
|
457
590
|
| `DATAQUERY_BEARER_TOKEN` | _(none)_ | Alternative to OAuth |
|
|
458
591
|
| `DATAQUERY_OAUTH_ENABLED` | `true` | Set `false` to use bearer-token mode |
|
|
459
592
|
|
|
593
|
+
**Endpoints**
|
|
594
|
+
|
|
595
|
+
| Variable | Default | Notes |
|
|
596
|
+
|---|---|---|
|
|
597
|
+
| `DATAQUERY_BASE_URL` | `https://api-dataquery.jpmchase.com` | Host for both API surfaces |
|
|
598
|
+
| `DATAQUERY_FILES_BASE_URL` | same as `BASE_URL` | Override only if file endpoints live on another host |
|
|
599
|
+
| `DATAQUERY_OAUTH_TOKEN_URL` | `https://authe.jpmorgan.com/as/token.oauth2` | Token endpoint |
|
|
600
|
+
| `DATAQUERY_OAUTH_AUD` | PROD audience | Set to the value provisioned for your client |
|
|
601
|
+
| `DATAQUERY_MCP_URL` | PROD MCP endpoint | Endpoint used by [`mcp-connect`](#mcp-bridge-mcp-connect); `--url` overrides it |
|
|
602
|
+
|
|
460
603
|
**HTTP / retry / rate limit**
|
|
461
604
|
|
|
462
605
|
| Variable | Default |
|
|
@@ -621,6 +764,17 @@ async with DataQuery() as dq:
|
|
|
621
764
|
`manager.clear_event_id()` (or `dataquery download --watch --reset-event-id`)
|
|
622
765
|
only when you intentionally want a clean slate.
|
|
623
766
|
|
|
767
|
+
**MCP client shows the server as failed**
|
|
768
|
+
|
|
769
|
+
- `The MCP bridge requires the 'mcp' extra` in the server log means `fastmcp`
|
|
770
|
+
is missing — `pip install "dataquery-sdk[mcp]"`, or use the `uvx` form.
|
|
771
|
+
- MCP hosts usually launch the command with a minimal environment, so a
|
|
772
|
+
`.env` in your shell's working directory may not be visible. Put the
|
|
773
|
+
credentials in the server's `env` block, or run `dataquery mcp-connect
|
|
774
|
+
--save-credentials` once from a terminal where they do resolve.
|
|
775
|
+
- Auth failures surface as `Could not obtain an OAuth token`; verify the same
|
|
776
|
+
credentials with `dataquery auth test` before debugging the bridge.
|
|
777
|
+
|
|
624
778
|
## Date formats
|
|
625
779
|
|
|
626
780
|
```python
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
aiohttp<4.0.0,>=3.
|
|
1
|
+
aiohttp<4.0.0,>=3.14.3
|
|
2
2
|
pydantic<3.0.0,>=2.0.0
|
|
3
3
|
structlog>=23.0.0
|
|
4
4
|
python-dotenv>=1.0.0
|
|
@@ -20,7 +20,7 @@ fastmcp>=2.14
|
|
|
20
20
|
pip-audit>=2.7.0
|
|
21
21
|
build>=1.3.0
|
|
22
22
|
urllib3>=2.7.0
|
|
23
|
-
pymdown-extensions>=
|
|
23
|
+
pymdown-extensions>=11.0.0
|
|
24
24
|
|
|
25
25
|
[dev]
|
|
26
26
|
pytest>=7.0.0
|
|
@@ -39,7 +39,7 @@ mkdocs>=1.5.0
|
|
|
39
39
|
mkdocs-material>=9.0.0
|
|
40
40
|
mkdocstrings[python]>=0.24.0
|
|
41
41
|
mike>=1.1.0
|
|
42
|
-
pymdown-extensions>=
|
|
42
|
+
pymdown-extensions>=11.0.0
|
|
43
43
|
|
|
44
44
|
[mcp]
|
|
45
45
|
fastmcp>=2.14
|
|
@@ -27,7 +27,7 @@ classifiers = [
|
|
|
27
27
|
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
28
28
|
]
|
|
29
29
|
dependencies = [
|
|
30
|
-
"aiohttp>=3.
|
|
30
|
+
"aiohttp>=3.14.3,<4.0.0",
|
|
31
31
|
"pydantic>=2.0.0,<3.0.0",
|
|
32
32
|
"structlog>=23.0.0",
|
|
33
33
|
"python-dotenv>=1.0.0",
|
|
@@ -71,7 +71,7 @@ docs = [
|
|
|
71
71
|
"mkdocs-material>=9.0.0",
|
|
72
72
|
"mkdocstrings[python]>=0.24.0",
|
|
73
73
|
"mike>=1.1.0",
|
|
74
|
-
"pymdown-extensions>=
|
|
74
|
+
"pymdown-extensions>=11.0.0",
|
|
75
75
|
]
|
|
76
76
|
pandas = [
|
|
77
77
|
"pandas>=2.0.0",
|
|
@@ -95,7 +95,7 @@ all = [
|
|
|
95
95
|
"pip-audit>=2.7.0",
|
|
96
96
|
"build>=1.3.0",
|
|
97
97
|
"urllib3>=2.7.0",
|
|
98
|
-
"pymdown-extensions>=
|
|
98
|
+
"pymdown-extensions>=11.0.0",
|
|
99
99
|
]
|
|
100
100
|
|
|
101
101
|
[project.scripts]
|
|
@@ -210,5 +210,5 @@ dev = [
|
|
|
210
210
|
"mypy>=1.17.1",
|
|
211
211
|
"pytest>=8.4.2",
|
|
212
212
|
"urllib3>=2.7.0",
|
|
213
|
-
"pymdown-extensions>=
|
|
213
|
+
"pymdown-extensions>=11.0.0",
|
|
214
214
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|