@continuumdao/continuum-node-sdk 1.2.29 → 1.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.
@@ -0,0 +1,193 @@
1
+ export function maxSeriesLength() {
2
+ const raw = process.env.TA_MCP_MAX_SERIES_LENGTH;
3
+ if (raw === undefined || raw === '') {
4
+ return 50_000;
5
+ }
6
+ const parsed = Number.parseInt(raw, 10);
7
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 50_000;
8
+ }
9
+ function assertMaxLength(label, length, max) {
10
+ if (length > max) {
11
+ throw new Error(`${label} length ${length} exceeds TA_MCP_MAX_SERIES_LENGTH (${max})`);
12
+ }
13
+ }
14
+ function assertEqualLengths(fields) {
15
+ if (fields.length === 0) {
16
+ return;
17
+ }
18
+ const expected = fields[0].values.length;
19
+ const parts = fields.map(f => `${f.name}=${f.values.length}`).join(', ');
20
+ for (const field of fields) {
21
+ if (field.values.length !== expected) {
22
+ throw new Error(`Array length mismatch (expected equal lengths, got ${parts})`);
23
+ }
24
+ }
25
+ }
26
+ function deriveFromCandles(candles) {
27
+ return {
28
+ open: candles.map(c => c.open),
29
+ high: candles.map(c => c.high),
30
+ low: candles.map(c => c.low),
31
+ close: candles.map(c => c.close),
32
+ volume: candles.every(c => c.volume !== undefined)
33
+ ? candles.map(c => c.volume)
34
+ : undefined,
35
+ candles,
36
+ inputLength: candles.length,
37
+ };
38
+ }
39
+ function requireField(value, profile, field, indicatorId) {
40
+ if (value === undefined) {
41
+ throw new Error(`${indicatorId} requires inputProfile "${profile}" — provide ${field}. Call list_technical_indicators for requirements.`);
42
+ }
43
+ return value;
44
+ }
45
+ export function normalizeInput(indicatorId, profile, input) {
46
+ const max = maxSeriesLength();
47
+ if (input.candles && input.candles.length > 0) {
48
+ const derived = deriveFromCandles(input.candles);
49
+ assertMaxLength('candles', derived.inputLength, max);
50
+ return mergeWithExplicit(input, derived, profile, indicatorId, max);
51
+ }
52
+ switch (profile) {
53
+ case 'close_series': {
54
+ const values = requireField(input.values ?? input.close, profile, 'values or close (or candles)', indicatorId);
55
+ assertMaxLength('values', values.length, max);
56
+ return { values, inputLength: values.length };
57
+ }
58
+ case 'ohl_series': {
59
+ const high = requireField(input.high, profile, 'high', indicatorId);
60
+ const low = requireField(input.low, profile, 'low', indicatorId);
61
+ assertEqualLengths([
62
+ { name: 'high', values: high },
63
+ { name: 'low', values: low },
64
+ ]);
65
+ assertMaxLength('high', high.length, max);
66
+ return { high, low, inputLength: high.length };
67
+ }
68
+ case 'ohlc_series': {
69
+ const high = requireField(input.high, profile, 'high', indicatorId);
70
+ const low = requireField(input.low, profile, 'low', indicatorId);
71
+ const close = requireField(input.close, profile, 'close', indicatorId);
72
+ assertEqualLengths([
73
+ { name: 'high', values: high },
74
+ { name: 'low', values: low },
75
+ { name: 'close', values: close },
76
+ ]);
77
+ assertMaxLength('high', high.length, max);
78
+ return { high, low, close, inputLength: high.length };
79
+ }
80
+ case 'hlcv_series': {
81
+ const high = requireField(input.high, profile, 'high', indicatorId);
82
+ const low = requireField(input.low, profile, 'low', indicatorId);
83
+ const close = requireField(input.close, profile, 'close', indicatorId);
84
+ const volume = requireField(input.volume, profile, 'volume', indicatorId);
85
+ assertEqualLengths([
86
+ { name: 'high', values: high },
87
+ { name: 'low', values: low },
88
+ { name: 'close', values: close },
89
+ { name: 'volume', values: volume },
90
+ ]);
91
+ assertMaxLength('high', high.length, max);
92
+ return { high, low, close, volume, inputLength: high.length };
93
+ }
94
+ case 'close_volume_series': {
95
+ const close = requireField(input.close ?? input.values, profile, 'close or values', indicatorId);
96
+ const volume = requireField(input.volume, profile, 'volume', indicatorId);
97
+ assertEqualLengths([
98
+ { name: 'close', values: close },
99
+ { name: 'volume', values: volume },
100
+ ]);
101
+ assertMaxLength('close', close.length, max);
102
+ return { close, volume, inputLength: close.length };
103
+ }
104
+ case 'ohlcv_series': {
105
+ const open = requireField(input.open, profile, 'open', indicatorId);
106
+ const high = requireField(input.high, profile, 'high', indicatorId);
107
+ const low = requireField(input.low, profile, 'low', indicatorId);
108
+ const close = requireField(input.close, profile, 'close', indicatorId);
109
+ const volume = requireField(input.volume, profile, 'volume', indicatorId);
110
+ assertEqualLengths([
111
+ { name: 'open', values: open },
112
+ { name: 'high', values: high },
113
+ { name: 'low', values: low },
114
+ { name: 'close', values: close },
115
+ { name: 'volume', values: volume },
116
+ ]);
117
+ assertMaxLength('open', open.length, max);
118
+ return { open, high, low, close, volume, inputLength: open.length };
119
+ }
120
+ case 'candle_objects': {
121
+ throw new Error(`${indicatorId} requires inputProfile "candle_objects" — provide candles[]. Call list_technical_indicators for requirements.`);
122
+ }
123
+ case 'range_scalar': {
124
+ const range = requireField(input.range, profile, 'range { high, low }', indicatorId);
125
+ return { range, inputLength: 1 };
126
+ }
127
+ case 'dual_series': {
128
+ const lineA = requireField(input.valuesA, profile, 'valuesA', indicatorId);
129
+ const lineB = requireField(input.valuesB, profile, 'valuesB', indicatorId);
130
+ assertEqualLengths([
131
+ { name: 'valuesA', values: lineA },
132
+ { name: 'valuesB', values: lineB },
133
+ ]);
134
+ assertMaxLength('valuesA', lineA.length, max);
135
+ return { lineA, lineB, inputLength: lineA.length };
136
+ }
137
+ case 'special':
138
+ return normalizeSpecial(indicatorId, input, max);
139
+ default:
140
+ throw new Error(`Unsupported input profile: ${profile}`);
141
+ }
142
+ }
143
+ function mergeWithExplicit(input, derived, profile, indicatorId, max) {
144
+ const merged = {
145
+ ...input,
146
+ open: input.open ?? derived.open,
147
+ high: input.high ?? derived.high,
148
+ low: input.low ?? derived.low,
149
+ close: input.close ?? derived.close,
150
+ volume: input.volume ?? derived.volume,
151
+ values: input.values ?? input.close ?? derived.close,
152
+ candles: derived.candles,
153
+ };
154
+ const withoutCandles = { ...merged, candles: undefined };
155
+ switch (profile) {
156
+ case 'candle_objects':
157
+ return {
158
+ candles: derived.candles,
159
+ inputLength: derived.inputLength,
160
+ };
161
+ case 'close_series':
162
+ case 'ohl_series':
163
+ case 'ohlc_series':
164
+ case 'hlcv_series':
165
+ case 'close_volume_series':
166
+ case 'ohlcv_series':
167
+ case 'range_scalar':
168
+ case 'dual_series':
169
+ return normalizeInput(indicatorId, profile, withoutCandles);
170
+ case 'special':
171
+ return normalizeSpecial(indicatorId, merged, max);
172
+ default:
173
+ return normalizeInput(indicatorId, profile, withoutCandles);
174
+ }
175
+ }
176
+ function normalizeSpecial(indicatorId, input, max) {
177
+ if (indicatorId === 'renko') {
178
+ const candles = input.candles;
179
+ if (!candles || candles.length === 0) {
180
+ throw new Error('renko requires candles[] (or derive from explicit OHLC arrays via candles)');
181
+ }
182
+ assertMaxLength('candles', candles.length, max);
183
+ return { candles, inputLength: candles.length };
184
+ }
185
+ if (indicatorId === 'fibonacciProjection') {
186
+ const prices = requireField(input.values ?? input.close, 'special', 'values or close as prices', indicatorId);
187
+ const swingPoints = requireField(input.swingPoints, 'special', 'swingPoints', indicatorId);
188
+ assertMaxLength('values', prices.length, max);
189
+ return { prices, swingPoints, inputLength: prices.length };
190
+ }
191
+ throw new Error(`Special input handling is not defined for ${indicatorId}`);
192
+ }
193
+ //# sourceMappingURL=normalize-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-input.js","sourceRoot":"","sources":["../../../src/core/ta/normalize-input.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,eAAe;IAC9B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;IACjD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;QACrC,OAAO,MAAM,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;AAChE,CAAC;AAED,SAAS,eAAe,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AM,EAAE,GAAG,CAAC,CAAC;QACnD;YACC,OAAO,cAAc,CAAC,WAAW,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9D,CAAC;AACF,CAAC;AAED,SAAS,gBAAgB,CACxB,WAAmB,EACnB,KAAoB,EACpB,GAAW;IAEX,IAAI,WAAW,KAAK,OAAO,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACd,4EAA4E,CAC5E,CAAC;QACH,CAAC;QACD,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,EAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAC,CAAC;IAC/C,CAAC;IACD,IAAI,WAAW,KAAK,qBAAqB,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,YAAY,CAC1B,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,EAC3B,SAAS,EACT,2BAA2B,EAC3B,WAAW,CACX,CAAC;QACF,MAAM,WAAW,GAAG,YAAY,CAC/B,KAAK,CAAC,WAAW,EACjB,SAAS,EACT,aAAa,EACb,WAAW,CACX,CAAC;QACF,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC9C,OAAO,EAAC,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAC,CAAC;IAC1D,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,6CAA6C,WAAW,EAAE,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,151 @@
1
+ import { z } from 'zod';
2
+ export declare const InputProfileSchema: z.ZodEnum<{
3
+ close_series: "close_series";
4
+ ohl_series: "ohl_series";
5
+ ohlc_series: "ohlc_series";
6
+ hlcv_series: "hlcv_series";
7
+ ohlcv_series: "ohlcv_series";
8
+ close_volume_series: "close_volume_series";
9
+ candle_objects: "candle_objects";
10
+ range_scalar: "range_scalar";
11
+ dual_series: "dual_series";
12
+ special: "special";
13
+ }>;
14
+ export type InputProfile = z.infer<typeof InputProfileSchema>;
15
+ export declare const OutputKindSchema: z.ZodEnum<{
16
+ numbers: "numbers";
17
+ objects: "objects";
18
+ booleans: "booleans";
19
+ levels: "levels";
20
+ }>;
21
+ export type OutputKind = z.infer<typeof OutputKindSchema>;
22
+ export declare const CandleInputSchema: z.ZodObject<{
23
+ open: z.ZodNumber;
24
+ high: z.ZodNumber;
25
+ low: z.ZodNumber;
26
+ close: z.ZodNumber;
27
+ volume: z.ZodOptional<z.ZodNumber>;
28
+ }, z.core.$strict>;
29
+ export declare const TaSeriesInputSchema: z.ZodObject<{
30
+ values: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
31
+ open: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
32
+ high: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
33
+ low: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
34
+ close: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
35
+ volume: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
36
+ candles: z.ZodOptional<z.ZodArray<z.ZodObject<{
37
+ open: z.ZodNumber;
38
+ high: z.ZodNumber;
39
+ low: z.ZodNumber;
40
+ close: z.ZodNumber;
41
+ volume: z.ZodOptional<z.ZodNumber>;
42
+ }, z.core.$strict>>>;
43
+ range: z.ZodOptional<z.ZodObject<{
44
+ high: z.ZodNumber;
45
+ low: z.ZodNumber;
46
+ trend: z.ZodOptional<z.ZodEnum<{
47
+ up: "up";
48
+ down: "down";
49
+ }>>;
50
+ }, z.core.$strict>>;
51
+ valuesA: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
52
+ valuesB: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
53
+ swingPoints: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
54
+ }, z.core.$strict>;
55
+ export type TaSeriesInput = z.infer<typeof TaSeriesInputSchema>;
56
+ export declare const CalculateTechnicalIndicatorInputSchema: z.ZodObject<{
57
+ indicator: z.ZodString;
58
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodBoolean]>>>;
59
+ input: z.ZodObject<{
60
+ values: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
61
+ open: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
62
+ high: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
63
+ low: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
64
+ close: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
65
+ volume: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
66
+ candles: z.ZodOptional<z.ZodArray<z.ZodObject<{
67
+ open: z.ZodNumber;
68
+ high: z.ZodNumber;
69
+ low: z.ZodNumber;
70
+ close: z.ZodNumber;
71
+ volume: z.ZodOptional<z.ZodNumber>;
72
+ }, z.core.$strict>>>;
73
+ range: z.ZodOptional<z.ZodObject<{
74
+ high: z.ZodNumber;
75
+ low: z.ZodNumber;
76
+ trend: z.ZodOptional<z.ZodEnum<{
77
+ up: "up";
78
+ down: "down";
79
+ }>>;
80
+ }, z.core.$strict>>;
81
+ valuesA: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
82
+ valuesB: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
83
+ swingPoints: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
84
+ }, z.core.$strict>;
85
+ options: z.ZodOptional<z.ZodObject<{
86
+ trimWarmup: z.ZodOptional<z.ZodBoolean>;
87
+ maxPoints: z.ZodOptional<z.ZodNumber>;
88
+ }, z.core.$strict>>;
89
+ }, z.core.$strict>;
90
+ export type CalculateTechnicalIndicatorInput = z.infer<typeof CalculateTechnicalIndicatorInputSchema>;
91
+ export declare const IndicatorCatalogEntrySchema: z.ZodObject<{
92
+ id: z.ZodString;
93
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
94
+ category: z.ZodString;
95
+ inputProfile: z.ZodEnum<{
96
+ close_series: "close_series";
97
+ ohl_series: "ohl_series";
98
+ ohlc_series: "ohlc_series";
99
+ hlcv_series: "hlcv_series";
100
+ ohlcv_series: "ohlcv_series";
101
+ close_volume_series: "close_volume_series";
102
+ candle_objects: "candle_objects";
103
+ range_scalar: "range_scalar";
104
+ dual_series: "dual_series";
105
+ special: "special";
106
+ }>;
107
+ defaultParams: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodBoolean]>>;
108
+ outputKind: z.ZodEnum<{
109
+ numbers: "numbers";
110
+ objects: "objects";
111
+ booleans: "booleans";
112
+ levels: "levels";
113
+ }>;
114
+ description: z.ZodString;
115
+ }, z.core.$strict>;
116
+ export declare const ListTechnicalIndicatorsOutputSchema: z.ZodObject<{
117
+ indicators: z.ZodArray<z.ZodObject<{
118
+ id: z.ZodString;
119
+ aliases: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
+ category: z.ZodString;
121
+ inputProfile: z.ZodEnum<{
122
+ close_series: "close_series";
123
+ ohl_series: "ohl_series";
124
+ ohlc_series: "ohlc_series";
125
+ hlcv_series: "hlcv_series";
126
+ ohlcv_series: "ohlcv_series";
127
+ close_volume_series: "close_volume_series";
128
+ candle_objects: "candle_objects";
129
+ range_scalar: "range_scalar";
130
+ dual_series: "dual_series";
131
+ special: "special";
132
+ }>;
133
+ defaultParams: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodNumber, z.ZodBoolean]>>;
134
+ outputKind: z.ZodEnum<{
135
+ numbers: "numbers";
136
+ objects: "objects";
137
+ booleans: "booleans";
138
+ levels: "levels";
139
+ }>;
140
+ description: z.ZodString;
141
+ }, z.core.$strict>>;
142
+ }, z.core.$strict>;
143
+ export declare const CalculateTechnicalIndicatorOutputSchema: z.ZodObject<{
144
+ indicator: z.ZodString;
145
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
146
+ inputLength: z.ZodNumber;
147
+ outputLength: z.ZodNumber;
148
+ warmupCount: z.ZodNumber;
149
+ result: z.ZodUnion<readonly [z.ZodArray<z.ZodNumber>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>, z.ZodArray<z.ZodBoolean>]>;
150
+ }, z.core.$strict>;
151
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/core/ta/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,kBAAkB;;;;;;;;;;;EAW7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,gBAAgB;;;;;EAK3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,iBAAiB;;;;;;kBAQpB,CAAC;AAEX,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;kBAqBtB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAazC,CAAC;AAEX,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CACrD,OAAO,sCAAsC,CAC7C,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;kBAU9B,CAAC;AAEX,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;kBAItC,CAAC;AAEX,eAAO,MAAM,uCAAuC;;;;;;;kBAa1C,CAAC"}
@@ -0,0 +1,95 @@
1
+ import { z } from 'zod';
2
+ export const InputProfileSchema = z.enum([
3
+ 'close_series',
4
+ 'ohl_series',
5
+ 'ohlc_series',
6
+ 'hlcv_series',
7
+ 'ohlcv_series',
8
+ 'close_volume_series',
9
+ 'candle_objects',
10
+ 'range_scalar',
11
+ 'dual_series',
12
+ 'special',
13
+ ]);
14
+ export const OutputKindSchema = z.enum([
15
+ 'numbers',
16
+ 'objects',
17
+ 'booleans',
18
+ 'levels',
19
+ ]);
20
+ export const CandleInputSchema = z
21
+ .object({
22
+ open: z.number(),
23
+ high: z.number(),
24
+ low: z.number(),
25
+ close: z.number(),
26
+ volume: z.number().optional(),
27
+ })
28
+ .strict();
29
+ export const TaSeriesInputSchema = z
30
+ .object({
31
+ values: z.array(z.number()).optional(),
32
+ open: z.array(z.number()).optional(),
33
+ high: z.array(z.number()).optional(),
34
+ low: z.array(z.number()).optional(),
35
+ close: z.array(z.number()).optional(),
36
+ volume: z.array(z.number()).optional(),
37
+ candles: z.array(CandleInputSchema).optional(),
38
+ range: z
39
+ .object({
40
+ high: z.number(),
41
+ low: z.number(),
42
+ trend: z.enum(['up', 'down']).optional(),
43
+ })
44
+ .strict()
45
+ .optional(),
46
+ valuesA: z.array(z.number()).optional(),
47
+ valuesB: z.array(z.number()).optional(),
48
+ swingPoints: z.array(z.number()).optional(),
49
+ })
50
+ .strict();
51
+ export const CalculateTechnicalIndicatorInputSchema = z
52
+ .object({
53
+ indicator: z.string().min(1),
54
+ params: z.record(z.string(), z.union([z.number(), z.boolean()])).optional(),
55
+ input: TaSeriesInputSchema,
56
+ options: z
57
+ .object({
58
+ trimWarmup: z.boolean().optional(),
59
+ maxPoints: z.number().int().positive().optional(),
60
+ })
61
+ .strict()
62
+ .optional(),
63
+ })
64
+ .strict();
65
+ export const IndicatorCatalogEntrySchema = z
66
+ .object({
67
+ id: z.string(),
68
+ aliases: z.array(z.string()).optional(),
69
+ category: z.string(),
70
+ inputProfile: InputProfileSchema,
71
+ defaultParams: z.record(z.string(), z.union([z.number(), z.boolean()])),
72
+ outputKind: OutputKindSchema,
73
+ description: z.string(),
74
+ })
75
+ .strict();
76
+ export const ListTechnicalIndicatorsOutputSchema = z
77
+ .object({
78
+ indicators: z.array(IndicatorCatalogEntrySchema),
79
+ })
80
+ .strict();
81
+ export const CalculateTechnicalIndicatorOutputSchema = z
82
+ .object({
83
+ indicator: z.string(),
84
+ params: z.record(z.string(), z.unknown()),
85
+ inputLength: z.number().int().nonnegative(),
86
+ outputLength: z.number().int().nonnegative(),
87
+ warmupCount: z.number().int().nonnegative(),
88
+ result: z.union([
89
+ z.array(z.number()),
90
+ z.array(z.record(z.string(), z.unknown())),
91
+ z.array(z.boolean()),
92
+ ]),
93
+ })
94
+ .strict();
95
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/core/ta/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACxC,cAAc;IACd,YAAY;IACZ,aAAa;IACb,aAAa;IACb,cAAc;IACd,qBAAqB;IACrB,gBAAgB;IAChB,cAAc;IACd,aAAa;IACb,SAAS;CACT,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACtC,SAAS;IACT,SAAS;IACT,UAAU;IACV,QAAQ;CACR,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAChC,MAAM,CAAC;IACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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AAC;KACD,MAAM,EAAE,CAAC;AAEX,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC;KAClD,MAAM,CAAC;IACP,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC;CAChD,CAAC;KACD,MAAM,EAAE,CAAC;AAEX,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC;KACtD,MAAM,CAAC;IACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC3C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC5C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC3C,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC;QACf,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;QACnB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;KACpB,CAAC;CACF,CAAC;KACD,MAAM,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { mcpStructuredContent } from '../tool-utils.js';
3
+ export declare function registerTaTools(server: McpServer): void;
4
+ export declare function createTaMcpServer(): McpServer;
5
+ export { mcpStructuredContent };
6
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/mcp/ta/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAclE,OAAO,EAAC,oBAAoB,EAA4B,MAAM,kBAAkB,CAAC;AAIjF,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuBvD;AAED,wBAAgB,iBAAiB,IAAI,SAAS,CAuC7C;AAED,OAAO,EAAC,oBAAoB,EAAC,CAAC"}
@@ -0,0 +1,51 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { promises as fs } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { z } from 'zod';
6
+ import { calculateTechnicalIndicator, listTechnicalIndicators, } from '../../core/ta/calculate.js';
7
+ import { CalculateTechnicalIndicatorInputSchema, CalculateTechnicalIndicatorOutputSchema, ListTechnicalIndicatorsOutputSchema, } from '../../core/ta/schemas.js';
8
+ import { mcpStructuredContent, sdkResultToCallToolResult } from '../tool-utils.js';
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ export function registerTaTools(server) {
11
+ server.registerTool('list_technical_indicators', {
12
+ description: 'List technical indicators available via calculate_technical_indicator: id, category, inputProfile, defaultParams, outputKind. Call this before computing.',
13
+ inputSchema: z.object({}).strict(),
14
+ outputSchema: ListTechnicalIndicatorsOutputSchema,
15
+ }, async () => sdkResultToCallToolResult(listTechnicalIndicators()));
16
+ server.registerTool('calculate_technical_indicator', {
17
+ description: 'Compute one technical indicator from time series or OHLC(V) arrays. Use list_technical_indicators for inputProfile requirements. Supports params (period, stdDev, etc.), options.trimWarmup, options.maxPoints.',
18
+ inputSchema: CalculateTechnicalIndicatorInputSchema,
19
+ outputSchema: CalculateTechnicalIndicatorOutputSchema,
20
+ }, async (input) => sdkResultToCallToolResult(calculateTechnicalIndicator(input)));
21
+ }
22
+ export function createTaMcpServer() {
23
+ const server = new McpServer({
24
+ name: 'continuum-ta-mcp',
25
+ version: '1.0.0',
26
+ }, {
27
+ capabilities: {
28
+ tools: {},
29
+ },
30
+ });
31
+ registerTaTools(server);
32
+ const resourcePath = path.join(__dirname, 'resources', 'indicators.md');
33
+ server.registerResource('technical-indicators', 'docs://technical-indicators', {
34
+ description: 'Technical indicators MCP usage: input profiles, warmup semantics, and examples.',
35
+ mimeType: 'text/markdown',
36
+ }, async () => {
37
+ const text = await fs.readFile(resourcePath, 'utf8');
38
+ return {
39
+ contents: [
40
+ {
41
+ uri: 'docs://technical-indicators',
42
+ mimeType: 'text/markdown',
43
+ text,
44
+ },
45
+ ],
46
+ };
47
+ });
48
+ return server;
49
+ }
50
+ export { mcpStructuredContent };
51
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/mcp/ta/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAC,QAAQ,IAAI,EAAE,EAAC,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AACvC,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EACN,2BAA2B,EAC3B,uBAAuB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACN,sCAAsC,EACtC,uCAAuC,EACvC,mCAAmC,GACnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAC,oBAAoB,EAAE,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AAEjF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,UAAU,eAAe,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CAClB,2BAA2B,EAC3B;QACC,WAAW,EACV,2JAA2J;QAC5J,WAAW,EAAE,CAAC,CAA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.npmjs.com/package/fast-technical-indicators). Call **`list_technical_indicators`** first to see required input profiles, then **`calculate_technical_indicator`**.
4
+
5
+ ## Input profiles
6
+
7
+ | Profile | Provide in `input` |
8
+ |---------|-------------------|
9
+ | `close_series` | `values` or `close`, or `candles[]` (close extracted) |
10
+ | `ohl_series` | `high`, `low` |
11
+ | `ohlc_series` | `high`, `low`, `close` |
12
+ | `hlcv_series` | `high`, `low`, `close`, `volume` |
13
+ | `ohlcv_series` | `open`, `high`, `low`, `close`, `volume` |
14
+ | `close_volume_series` | `close` (or `values`), `volume` |
15
+ | `candle_objects` | `candles[]` with `{ open, high, low, close, volume? }` |
16
+ | `range_scalar` | `range: { high, low, trend? }` |
17
+ | `dual_series` | `valuesA`, `valuesB` |
18
+ | `special` | `renko`: `candles[]` + `params.brickSize`; `fibonacciProjection`: `values`/`close` + `swingPoints` |
19
+
20
+ All array fields must have equal length where applicable. Max series length defaults to **50_000** (`TA_MCP_MAX_SERIES_LENGTH`).
21
+
22
+ ## Warmup
23
+
24
+ Many indicators return `undefined` for initial bars until enough history exists. The response includes **`warmupCount`**. Set **`options.trimWarmup: true`** to drop leading empty slots from **`result`**.
25
+
26
+ ## Examples
27
+
28
+ ### SMA (close series)
29
+
30
+ ```json
31
+ {
32
+ "indicator": "sma",
33
+ "params": { "period": 3 },
34
+ "input": { "values": [1, 2, 3, 4, 5] },
35
+ "options": { "trimWarmup": true }
36
+ }
37
+ ```
38
+
39
+ ### Stochastic (OHLC)
40
+
41
+ ```json
42
+ {
43
+ "indicator": "stochastic",
44
+ "params": { "period": 14, "signalPeriod": 3 },
45
+ "input": {
46
+ "high": [48.7, 48.9, 49.0],
47
+ "low": [47.8, 48.1, 48.2],
48
+ "close": [48.2, 48.6, 48.8]
49
+ }
50
+ }
51
+ ```
52
+
53
+ ### MACD (objects output)
54
+
55
+ ```json
56
+ {
57
+ "indicator": "macd",
58
+ "input": { "values": [44, 44.5, 45, 44.8, 45.2] }
59
+ }
60
+ ```
61
+
62
+ ### Fibonacci retracement (levels)
63
+
64
+ ```json
65
+ {
66
+ "indicator": "fibonacci",
67
+ "input": { "range": { "high": 100, "low": 80, "trend": "up" } }
68
+ }
69
+ ```
70
+
71
+ ### Doji pattern (booleans)
72
+
73
+ ```json
74
+ {
75
+ "indicator": "doji",
76
+ "input": {
77
+ "candles": [
78
+ { "open": 10, "high": 11, "low": 9, "close": 10.05 }
79
+ ]
80
+ }
81
+ }
82
+ ```
83
+
84
+ ## Aliases
85
+
86
+ Some indicators accept alternate names (e.g. `ichimokucloud` → `ichimokukinkouhyou`, `keltnerchannels` → `keltnerchannel`, `fibonacciretracement` → `fibonacci`). The response **`indicator`** field always uses the canonical id.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/ta-server/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
2
+ import { createTaMcpServer } from '../ta/register.js';
3
+ async function main() {
4
+ const server = createTaMcpServer();
5
+ const transport = new StdioServerTransport();
6
+ await server.connect(transport);
7
+ }
8
+ main().catch(error => {
9
+ console.error('Fatal error in ta-mcp main():', error);
10
+ process.exit(1);
11
+ });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/ta-server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAEpD,KAAK,UAAU,IAAI;IAClB,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACpB,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}