tradeblocks-mcp 2.2.5 → 2.2.6

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.
package/README.md CHANGED
@@ -147,8 +147,29 @@ tradeblocks-mcp ~/backtests
147
147
  # HTTP mode
148
148
  tradeblocks-mcp --http ~/backtests
149
149
  tradeblocks-mcp --http --port 8080 ~/backtests
150
+
151
+ # Separate CSV blocks from DuckDB storage
152
+ tradeblocks-mcp --directory ./data --blocks-dir ~/backtests
150
153
  ```
151
154
 
155
+ ### Options
156
+
157
+ | Flag | Description | Default |
158
+ |------|-------------|---------|
159
+ | `--http` | Start HTTP server instead of stdio | stdio |
160
+ | `--port <n>` | HTTP server port | 3100 |
161
+ | `--blocks-dir <path>` | Directory containing CSV block folders | same as data directory |
162
+ | `--market-db <path>` | Path to market.duckdb | `<directory>/market.duckdb` |
163
+ | `--no-auth` | Disable authentication (HTTP mode) | auth enabled |
164
+
165
+ ### Environment Variables
166
+
167
+ | Variable | Description |
168
+ |----------|-------------|
169
+ | `BLOCKS_DIRECTORY` | Default data directory if not specified as argument |
170
+ | `TRADEBLOCKS_BLOCKS_DIR` | Directory for CSV block folders (overridden by `--blocks-dir`) |
171
+ | `MARKET_DB_PATH` | Path to market.duckdb (overridden by `--market-db`) |
172
+
152
173
  ## Docker Deployment
153
174
 
154
175
  Run the MCP server in a container for remote/server deployments.
@@ -175,7 +196,7 @@ docker build -t tradeblocks-mcp .
175
196
  docker compose up -d
176
197
  ```
177
198
 
178
- Place your block folders (each containing CSV files) in the `data/` directory. The container runs in HTTP mode on port 3100 by default. See [Authentication](#authentication) below for configuring credentials.
199
+ Place your block folders (each containing CSV files) in the `data/` directory, or use `--blocks-dir` to point at a separate folder. The container runs in HTTP mode on port 3100 by default. See [Authentication](#authentication) below for configuring credentials.
179
200
 
180
201
  Connect any MCP client to `http://<your-host>:3100/mcp`. How you expose this endpoint (reverse proxy, tunnel, VPN, etc.) is up to you.
181
202
 
@@ -22616,13 +22616,16 @@ async function detectBlockChanges(conn, baseDir) {
22616
22616
  const folderNames = /* @__PURE__ */ new Set();
22617
22617
  for (const entry of entries) {
22618
22618
  if (!entry.isDirectory()) continue;
22619
- if (entry.name.startsWith(".")) continue;
22620
- if (entry.name === "_marketdata") continue;
22619
+ if (entry.name.startsWith(".") || entry.name.startsWith("_")) continue;
22620
+ if (entry.name.includes(".")) continue;
22621
22621
  const blockId = entry.name;
22622
22622
  folderNames.add(blockId);
22623
22623
  const blockPath = path4.join(baseDir, blockId);
22624
22624
  if (!syncedBlockIds.has(blockId)) {
22625
- toSync.push(blockId);
22625
+ const tradelog = await findTradelogFile(blockPath);
22626
+ if (tradelog) {
22627
+ toSync.push(blockId);
22628
+ }
22626
22629
  continue;
22627
22630
  }
22628
22631
  const tradelogFilename = await findTradelogFile(blockPath);
@@ -22681,11 +22684,19 @@ async function cleanupDeletedBlocks(conn, deletedBlockIds) {
22681
22684
  }
22682
22685
 
22683
22686
  // src/sync/index.ts
22687
+ var _blocksDir = null;
22688
+ function setBlocksDir(dir) {
22689
+ _blocksDir = dir;
22690
+ }
22691
+ function getBlocksDir(baseDir) {
22692
+ return _blocksDir ?? baseDir;
22693
+ }
22684
22694
  async function syncAllBlocks(baseDir) {
22685
22695
  const conn = await getConnection(baseDir);
22696
+ const blocksDir = getBlocksDir(baseDir);
22686
22697
  const results = [];
22687
22698
  const errors = [];
22688
- const { toSync, toDelete } = await detectBlockChanges(conn, baseDir);
22699
+ const { toSync, toDelete } = await detectBlockChanges(conn, blocksDir);
22689
22700
  for (const blockId of toDelete) {
22690
22701
  try {
22691
22702
  await cleanupDeletedBlocks(conn, [blockId]);
@@ -22696,7 +22707,7 @@ async function syncAllBlocks(baseDir) {
22696
22707
  }
22697
22708
  }
22698
22709
  for (const blockId of toSync) {
22699
- const blockPath = path5.join(baseDir, blockId);
22710
+ const blockPath = path5.join(blocksDir, blockId);
22700
22711
  const result = await syncBlockInternal(conn, blockId, blockPath);
22701
22712
  results.push(result);
22702
22713
  if (result.status === "error" && result.error) {
@@ -22714,7 +22725,8 @@ async function syncAllBlocks(baseDir) {
22714
22725
  }
22715
22726
  async function syncBlock(blockId, baseDir) {
22716
22727
  const conn = await getConnection(baseDir);
22717
- const blockPath = path5.join(baseDir, blockId);
22728
+ const blocksDir = getBlocksDir(baseDir);
22729
+ const blockPath = path5.join(blocksDir, blockId);
22718
22730
  try {
22719
22731
  await fs6.access(blockPath);
22720
22732
  } catch {
@@ -22760,6 +22772,8 @@ export {
22760
22772
  normalizeTicker,
22761
22773
  resolveTradeTicker,
22762
22774
  marketTickerDateKey,
22775
+ setBlocksDir,
22776
+ getBlocksDir,
22763
22777
  syncAllBlocks,
22764
22778
  syncBlock
22765
22779
  };
@@ -22774,4 +22788,4 @@ decimal.js/decimal.mjs:
22774
22788
  * MIT Licence
22775
22789
  *)
22776
22790
  */
22777
- //# sourceMappingURL=chunk-UGHXXLLR.js.map
22791
+ //# sourceMappingURL=chunk-FIKAXL2L.js.map