tradeblocks-mcp 2.2.6 → 2.3.0

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/manifest.json CHANGED
@@ -7,15 +7,15 @@
7
7
  "long_description": "TradeBlocks MCP server provides comprehensive options trading analysis capabilities. Import your trade logs and get detailed performance statistics, run walk-forward analysis to detect overfitting, perform Monte Carlo simulations for risk assessment, calculate optimal position sizing with Kelly criterion, and compare backtest results against actual trading performance. All analysis runs locally on your machine.",
8
8
  "author": {
9
9
  "name": "David Romeo",
10
- "url": "https://gitlab.com/davidromeo"
10
+ "url": "https://github.com/davidromeo"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
14
- "url": "https://gitlab.com/davidromeo/tradeblocks"
14
+ "url": "https://github.com/davidromeo/tradeblocks"
15
15
  },
16
- "homepage": "https://gitlab.com/davidromeo/tradeblocks",
17
- "documentation": "https://gitlab.com/davidromeo/tradeblocks/-/tree/master/packages/mcp-server",
18
- "support": "https://gitlab.com/davidromeo/tradeblocks/-/issues",
16
+ "homepage": "https://github.com/davidromeo/tradeblocks",
17
+ "documentation": "https://github.com/davidromeo/tradeblocks/tree/master/packages/mcp-server",
18
+ "support": "https://github.com/davidromeo/tradeblocks/issues",
19
19
  "server": {
20
20
  "type": "node",
21
21
  "entry_point": "server/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tradeblocks-mcp",
3
- "version": "2.2.6",
3
+ "version": "2.3.0",
4
4
  "description": "MCP server for options trade analysis",
5
5
  "author": "David Romeo <davidmromeo@gmail.com>",
6
6
  "type": "module",
@@ -55,7 +55,7 @@
55
55
  "license": "MIT",
56
56
  "repository": {
57
57
  "type": "git",
58
- "url": "https://gitlab.com/davidromeo/tradeblocks",
58
+ "url": "https://github.com/davidromeo/tradeblocks",
59
59
  "directory": "packages/mcp-server"
60
60
  }
61
61
  }
@@ -54,6 +54,25 @@ async function ensureSyncTables(conn) {
54
54
  sync_version INTEGER DEFAULT 1
55
55
  )
56
56
  `);
57
+ const result = await conn.run(`
58
+ SELECT COUNT(*) AS cnt FROM duckdb_constraints()
59
+ WHERE schema_name = 'trades' AND table_name = '_sync_metadata'
60
+ AND constraint_type = 'PRIMARY KEY'
61
+ `);
62
+ const rows = await result.getRows();
63
+ if (Number(rows[0][0]) === 0) {
64
+ await conn.run(`DROP TABLE trades._sync_metadata`);
65
+ await conn.run(`
66
+ CREATE TABLE trades._sync_metadata (
67
+ block_id VARCHAR PRIMARY KEY,
68
+ tradelog_hash VARCHAR NOT NULL,
69
+ dailylog_hash VARCHAR,
70
+ reportinglog_hash VARCHAR,
71
+ synced_at TIMESTAMP NOT NULL,
72
+ sync_version INTEGER DEFAULT 1
73
+ )
74
+ `);
75
+ }
57
76
  }
58
77
  async function ensureTradeDataTable(conn) {
59
78
  await conn.run(`
@@ -316,6 +335,30 @@ async function ensureMarketTables(conn) {
316
335
  } catch {
317
336
  }
318
337
  }
338
+ await conn.run(`
339
+ CREATE TABLE IF NOT EXISTS market.option_chain (
340
+ underlying VARCHAR NOT NULL,
341
+ date VARCHAR NOT NULL,
342
+ ticker VARCHAR NOT NULL,
343
+ contract_type VARCHAR NOT NULL,
344
+ strike DOUBLE NOT NULL,
345
+ expiration VARCHAR NOT NULL,
346
+ dte INTEGER,
347
+ exercise_style VARCHAR,
348
+ PRIMARY KEY (underlying, date, ticker)
349
+ )
350
+ `);
351
+ await conn.run(`
352
+ CREATE TABLE IF NOT EXISTS market.data_coverage (
353
+ ticker VARCHAR NOT NULL,
354
+ date VARCHAR NOT NULL,
355
+ source VARCHAR NOT NULL, -- 'flatfile', 'api_trade', 'api_quote', 'csv_import'
356
+ bar_count INTEGER NOT NULL,
357
+ has_quotes BOOLEAN DEFAULT FALSE,
358
+ imported_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
359
+ PRIMARY KEY (ticker, date, source)
360
+ )
361
+ `);
319
362
  await conn.run(`
320
363
  CREATE TABLE IF NOT EXISTS market._sync_metadata (
321
364
  source VARCHAR NOT NULL,
@@ -755,6 +798,15 @@ async function openReadWriteConnection(dbPath, threads, memoryLimit) {
755
798
  await ensureReportingDataTable(connection);
756
799
  await ensureMarketTables(connection);
757
800
  await ensureProfilesSchema(connection);
801
+ try {
802
+ const ext = await import("./connection.ext.js");
803
+ const ctx = await ext.default(connection, {
804
+ baseDir: path.dirname(dbPath),
805
+ marketDbPath: storedMarketDbPath
806
+ });
807
+ if (ctx?.intradayWriteTable) _intradayWriteTable = ctx.intradayWriteTable;
808
+ } catch {
809
+ }
758
810
  connectionMode = "read_write";
759
811
  return connection;
760
812
  }
@@ -899,6 +951,10 @@ async function downgradeToReadOnly(dataDir) {
899
951
  function getConnectionMode() {
900
952
  return connectionMode;
901
953
  }
954
+ var _intradayWriteTable = "market.intraday";
955
+ function getIntradayWriteTable() {
956
+ return _intradayWriteTable;
957
+ }
902
958
 
903
959
  // src/sync/block-sync.ts
904
960
  import * as fs5 from "fs/promises";
@@ -26305,7 +26361,7 @@ async function detectBlockChanges(conn, baseDir) {
26305
26361
  for (const entry of entries) {
26306
26362
  if (!entry.isDirectory()) continue;
26307
26363
  if (entry.name.startsWith(".") || entry.name.startsWith("_")) continue;
26308
- if (entry.name.includes(".")) continue;
26364
+ if (entry.name.endsWith(".tmp") || entry.name.endsWith(".duckdb") || entry.name.endsWith(".duckdb.tmp")) continue;
26309
26365
  const blockId = entry.name;
26310
26366
  folderNames.add(blockId);
26311
26367
  const blockPath = path4.join(baseDir, blockId);
@@ -26469,6 +26525,7 @@ export {
26469
26525
  upgradeToReadWrite,
26470
26526
  downgradeToReadOnly,
26471
26527
  getConnectionMode,
26528
+ getIntradayWriteTable,
26472
26529
  loadBlock,
26473
26530
  listBlocks,
26474
26531
  loadReportingLog,
@@ -26499,4 +26556,4 @@ decimal.js/decimal.mjs:
26499
26556
  * MIT Licence
26500
26557
  *)
26501
26558
  */
26502
- //# sourceMappingURL=chunk-IBEPOZZK.js.map
26559
+ //# sourceMappingURL=chunk-XNRLTNPB.js.map