@mcp-z/mcp-sheets 2.4.1 → 2.5.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/README.md +45 -29
- package/dist/cjs/constants.d.cts +2 -0
- package/dist/cjs/constants.d.ts +2 -0
- package/dist/cjs/constants.js +27 -3
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/mcp/tools/cells-copy.d.cts +165 -0
- package/dist/cjs/mcp/tools/cells-copy.d.ts +165 -0
- package/dist/cjs/mcp/tools/cells-copy.js +388 -0
- package/dist/cjs/mcp/tools/cells-copy.js.map +1 -0
- package/dist/cjs/mcp/tools/csv-get-columns.js +107 -29
- package/dist/cjs/mcp/tools/csv-get-columns.js.map +1 -1
- package/dist/cjs/mcp/tools/index.d.cts +1 -0
- package/dist/cjs/mcp/tools/index.d.ts +1 -0
- package/dist/cjs/mcp/tools/index.js +4 -0
- package/dist/cjs/mcp/tools/index.js.map +1 -1
- package/dist/cjs/schemas/index.d.cts +1 -0
- package/dist/cjs/schemas/index.d.ts +1 -0
- package/dist/cjs/schemas/index.js +16 -0
- package/dist/cjs/schemas/index.js.map +1 -1
- package/dist/cjs/setup/config.js +26 -14
- package/dist/cjs/setup/config.js.map +1 -1
- package/dist/cjs/setup/version-help.js +1 -1
- package/dist/cjs/setup/version-help.js.map +1 -1
- package/dist/cjs/spreadsheet/data-operations.js +59 -164
- package/dist/cjs/spreadsheet/data-operations.js.map +1 -1
- package/dist/cjs/spreadsheet/range-operations.d.cts +26 -0
- package/dist/cjs/spreadsheet/range-operations.d.ts +26 -0
- package/dist/cjs/spreadsheet/range-operations.js +48 -0
- package/dist/cjs/spreadsheet/range-operations.js.map +1 -1
- package/dist/cjs/spreadsheet/sheet-operations.d.cts +6 -0
- package/dist/cjs/spreadsheet/sheet-operations.d.ts +6 -0
- package/dist/cjs/spreadsheet/sheet-operations.js +92 -52
- package/dist/cjs/spreadsheet/sheet-operations.js.map +1 -1
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.js +14 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/mcp/tools/cells-copy.d.ts +165 -0
- package/dist/esm/mcp/tools/cells-copy.js +190 -0
- package/dist/esm/mcp/tools/cells-copy.js.map +1 -0
- package/dist/esm/mcp/tools/csv-get-columns.js +44 -6
- package/dist/esm/mcp/tools/csv-get-columns.js.map +1 -1
- package/dist/esm/mcp/tools/index.d.ts +1 -0
- package/dist/esm/mcp/tools/index.js +1 -0
- package/dist/esm/mcp/tools/index.js.map +1 -1
- package/dist/esm/schemas/index.d.ts +1 -0
- package/dist/esm/schemas/index.js +9 -0
- package/dist/esm/schemas/index.js.map +1 -1
- package/dist/esm/setup/config.js +26 -14
- package/dist/esm/setup/config.js.map +1 -1
- package/dist/esm/setup/version-help.js +7 -0
- package/dist/esm/setup/version-help.js.map +1 -1
- package/dist/esm/spreadsheet/data-operations.js +40 -84
- package/dist/esm/spreadsheet/data-operations.js.map +1 -1
- package/dist/esm/spreadsheet/range-operations.d.ts +26 -0
- package/dist/esm/spreadsheet/range-operations.js +50 -0
- package/dist/esm/spreadsheet/range-operations.js.map +1 -1
- package/dist/esm/spreadsheet/sheet-operations.d.ts +6 -0
- package/dist/esm/spreadsheet/sheet-operations.js +69 -43
- package/dist/esm/spreadsheet/sheet-operations.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/tools/csv-get-columns.ts"],"sourcesContent":["/** Get column names from CSV file (peek at first row only) */\n\nimport type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { CallToolResult, ToolModule } from '@mcp-z/server';\nimport { ProtocolError, ProtocolErrorCode } from '@mcp-z/server';\nimport { parse } from 'csv-parse';\nimport { pipeline } from 'stream/promises';\nimport { z } from 'zod';\nimport { getCsvReadStream } from '../../spreadsheet/csv-streaming.ts';\n\nconst inputSchema = z.object({\n sourceUri: z.string().trim().min(1).describe('CSV file URI (file://, http://, https://)'),\n});\n\n// Success branch schema - uses columns: for consistency with standard vocabulary\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n columns: z.array(z.string()).describe('First row values (column names) or empty if no rows'),\n isEmpty: z.boolean().describe('True if CSV has zero rows'),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Get first row from CSV file (streaming, no memory overhead). Returns columns array and isEmpty flag.',\n inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ sourceUri }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n logger.debug?.('sheets.csv.get-columns called', { sourceUri });\n\n try {\n const parser = parse({\n columns: false,\n skip_empty_lines: true,\n trim: true,\n cast: true,\n relax_column_count: true,\n });\n const
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/tools/csv-get-columns.ts"],"sourcesContent":["/** Get column names from CSV file (peek at first row only) */\n\nimport type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { CallToolResult, ToolModule } from '@mcp-z/server';\nimport { ProtocolError, ProtocolErrorCode } from '@mcp-z/server';\nimport { parse } from 'csv-parse';\nimport type { Readable } from 'stream';\nimport { pipeline } from 'stream/promises';\nimport { z } from 'zod';\nimport { getCsvReadStream } from '../../spreadsheet/csv-streaming.ts';\n\nconst inputSchema = z.object({\n sourceUri: z.string().trim().min(1).describe('CSV file URI (file://, http://, https://)'),\n});\n\n// Success branch schema - uses columns: for consistency with standard vocabulary\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n columns: z.array(z.string()).describe('First row values (column names) or empty if no rows'),\n isEmpty: z.boolean().describe('True if CSV has zero rows'),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'Get first row from CSV file (streaming, no memory overhead). Returns columns array and isEmpty flag.',\n inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler({ sourceUri }: Input, extra: EnrichedExtra): Promise<CallToolResult> {\n const logger = extra.logger;\n logger.debug?.('sheets.csv.get-columns called', { sourceUri });\n\n try {\n const parser = parse({\n columns: false,\n skip_empty_lines: true,\n trim: true,\n cast: true,\n relax_column_count: true,\n });\n const firstRowRead = new Error('First CSV row read');\n const streamErrors: unknown[] = [];\n const onError = (error: unknown) => streamErrors.push(error);\n parser.on('error', onError);\n const parserClosed = new Promise<void>((resolve) => parser.once('close', resolve));\n let readStream: Readable | undefined;\n let sourceClosed: Promise<void> | undefined;\n let completed: Promise<unknown> | undefined;\n let failed = false;\n let primaryError: unknown;\n let firstRow: unknown[] = [];\n let rowCount = 0;\n try {\n readStream = await getCsvReadStream(sourceUri);\n readStream.on('error', onError);\n sourceClosed = readStream.closed ? Promise.resolve() : new Promise<void>((resolve) => readStream?.once('close', resolve));\n completed = pipeline(readStream, parser).then(\n () => undefined,\n (error: unknown) => error\n );\n const record = await parser[Symbol.asyncIterator]().next();\n if (!record.done) {\n firstRow = record.value;\n rowCount = 1;\n parser.destroy(firstRowRead);\n }\n const pipelineError = await completed;\n if (pipelineError !== undefined && pipelineError !== firstRowRead) throw pipelineError;\n } catch (error) {\n failed = true;\n primaryError = error;\n } finally {\n readStream?.destroy();\n parser.destroy();\n const pipelineError = await completed;\n if (pipelineError !== undefined && pipelineError !== firstRowRead) streamErrors.push(pipelineError);\n await Promise.all([sourceClosed, parserClosed]);\n readStream?.removeListener('error', onError);\n parser.removeListener('error', onError);\n }\n const failures = [...new Set([...(failed ? [primaryError] : []), ...streamErrors.filter((error) => error !== firstRowRead)])];\n if (failures.length === 1) throw failures[0];\n if (failures.length > 1) {\n const message = failures.map((error) => (error instanceof Error ? error.message : String(error))).join('; ');\n throw Object.assign(new Error(message), { errors: failures, primaryError: failures[0] });\n }\n\n // Convert first row to strings (column names)\n const columns = firstRow.map((value) => String(value ?? ''));\n const isEmpty = rowCount === 0;\n\n const result: Output = {\n type: 'success' as const,\n columns,\n isEmpty,\n };\n\n logger.info?.('sheets.csv.get-columns completed', { sourceUri, columnCount: columns.length, isEmpty });\n return {\n content: [{ type: 'text' as const, text: JSON.stringify(result) }],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error?.('sheets.csv.get-columns error', { error: message });\n throw new ProtocolError(ProtocolErrorCode.InternalError, `Error getting CSV columns: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'csv-get-columns',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","inputSchema","z","object","sourceUri","string","trim","min","describe","successBranchSchema","type","literal","columns","array","isEmpty","boolean","outputSchema","discriminatedUnion","config","description","result","handler","extra","logger","parser","firstRowRead","streamErrors","onError","parserClosed","readStream","sourceClosed","completed","failed","primaryError","firstRow","rowCount","record","pipelineError","error","failures","message","debug","parse","skip_empty_lines","cast","relax_column_count","Error","push","on","Promise","resolve","once","getCsvReadStream","closed","pipeline","then","undefined","Symbol","asyncIterator","next","done","value","destroy","all","removeListener","Set","filter","length","map","String","join","Object","assign","errors","info","columnCount","content","text","JSON","stringify","structuredContent","ProtocolError","ProtocolErrorCode","InternalError","stack","name"],"mappings":"AAAA,4DAA4D;;;;+BA0H5D;;;eAAwBA;;;2BAvHA;sBAKyB;wBAC3B;wBAEG;mBACP;8BACe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAACC,yBAAiB,CAACC,aAAa,EAAE,AAAC,8BAAqC,OAAR3C,WAAW;wBAChG4C,OAAO9C,AAAK,YAALA,QAAiBQ,SAAQR,OAAM8C,KAAK,GAAG5B;oBAChD;;;;;;;IAEJ;;AAEe,SAAS1D;IACtB,OAAO;QACLuF,MAAM;QACNnE,QAAAA;QACAG,SAAAA;IACF;AACF"}
|
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
get cellsCopy () {
|
|
13
|
+
return _cellscopyts.default;
|
|
14
|
+
},
|
|
12
15
|
get cellsFormat () {
|
|
13
16
|
return _cellsformatts.default;
|
|
14
17
|
},
|
|
@@ -97,6 +100,7 @@ _export(exports, {
|
|
|
97
100
|
return _valuessearchts.default;
|
|
98
101
|
}
|
|
99
102
|
});
|
|
103
|
+
var _cellscopyts = /*#__PURE__*/ _interop_require_default(require("./cells-copy.js"));
|
|
100
104
|
var _cellsformatts = /*#__PURE__*/ _interop_require_default(require("./cells-format.js"));
|
|
101
105
|
var _cellsmetadatagetts = /*#__PURE__*/ _interop_require_default(require("./cells-metadata-get.js"));
|
|
102
106
|
var _chartcreatets = /*#__PURE__*/ _interop_require_default(require("./chart-create.js"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/tools/index.ts"],"sourcesContent":["export { default as cellsFormat } from './cells-format.ts';\nexport { default as cellsMetadataGet } from './cells-metadata-get.ts';\nexport { default as chartCreate } from './chart-create.ts';\nexport { default as columnsGet } from './columns-get.ts';\nexport { default as columnsUpdate } from './columns-update.ts';\nexport { default as csvGetColumns } from './csv-get-columns.ts';\nexport { default as dimensionsBatchUpdate } from './dimensions-batch-update.ts';\nexport { default as dimensionsMove } from './dimensions-move.ts';\nexport { default as rowsAppend } from './rows-append.ts';\nexport { default as rowsCsvAppend } from './rows-csv-append.ts';\nexport { default as rowsGet } from './rows-get.ts';\nexport { default as sheetCopy } from './sheet-copy.ts';\nexport { default as sheetCopyTo } from './sheet-copy-to.ts';\nexport { default as sheetCreate } from './sheet-create.ts';\nexport { default as sheetDelete } from './sheet-delete.ts';\nexport { default as sheetFind } from './sheet-find.ts';\nexport { default as sheetRename } from './sheet-rename.ts';\nexport { default as spreadsheetCopy } from './spreadsheet-copy.ts';\nexport { default as spreadsheetCreate } from './spreadsheet-create.ts';\nexport { default as spreadsheetFind } from './spreadsheet-find.ts';\nexport { default as spreadsheetMetadataGet } from './spreadsheet-metadata-get.ts';\nexport { default as spreadsheetRename } from './spreadsheet-rename.ts';\nexport { default as validationSet } from './validation-set.ts';\nexport { default as valuesBatchUpdate } from './values-batch-update.ts';\nexport { default as valuesClear } from './values-clear.ts';\nexport { default as valuesCsvUpdate } from './values-csv-update.ts';\nexport { default as valuesMarkdownUpdate } from './values-markdown-update.ts';\nexport { default as valuesReplace } from './values-replace.ts';\nexport { default as valuesSearch } from './values-search.ts';\n"],"names":["cellsFormat","cellsMetadataGet","chartCreate","columnsGet","columnsUpdate","csvGetColumns","dimensionsBatchUpdate","dimensionsMove","rowsAppend","rowsCsvAppend","rowsGet","sheetCopy","sheetCopyTo","sheetCreate","sheetDelete","sheetFind","sheetRename","spreadsheetCopy","spreadsheetCreate","spreadsheetFind","spreadsheetMetadataGet","spreadsheetRename","validationSet","valuesBatchUpdate","valuesClear","valuesCsvUpdate","valuesMarkdownUpdate","valuesReplace","valuesSearch"],"mappings":";;;;;;;;;;;QAAoBA;eAAAA,sBAAW;;QACXC;eAAAA,2BAAgB;;QAChBC;eAAAA,sBAAW;;QACXC;eAAAA,qBAAU;;QACVC;eAAAA,wBAAa;;QACbC;eAAAA,wBAAa;;QACbC;eAAAA,gCAAqB;;QACrBC;eAAAA,yBAAc;;QACdC;eAAAA,qBAAU;;QACVC;eAAAA,wBAAa;;QACbC;eAAAA,kBAAO;;QACPC;eAAAA,oBAAS;;QACTC;eAAAA,sBAAW;;QACXC;eAAAA,sBAAW;;QACXC;eAAAA,sBAAW;;QACXC;eAAAA,oBAAS;;QACTC;eAAAA,sBAAW;;QACXC;eAAAA,0BAAe;;QACfC;eAAAA,4BAAiB;;QACjBC;eAAAA,0BAAe;;QACfC;eAAAA,iCAAsB;;QACtBC;eAAAA,4BAAiB;;QACjBC;eAAAA,wBAAa;;QACbC;eAAAA,4BAAiB;;QACjBC;eAAAA,sBAAW;;QACXC;eAAAA,0BAAe;;QACfC;eAAAA,+BAAoB;;QACpBC;eAAAA,wBAAa;;QACbC;eAAAA,uBAAY;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/mcp/tools/index.ts"],"sourcesContent":["export { default as cellsCopy } from './cells-copy.ts';\nexport { default as cellsFormat } from './cells-format.ts';\nexport { default as cellsMetadataGet } from './cells-metadata-get.ts';\nexport { default as chartCreate } from './chart-create.ts';\nexport { default as columnsGet } from './columns-get.ts';\nexport { default as columnsUpdate } from './columns-update.ts';\nexport { default as csvGetColumns } from './csv-get-columns.ts';\nexport { default as dimensionsBatchUpdate } from './dimensions-batch-update.ts';\nexport { default as dimensionsMove } from './dimensions-move.ts';\nexport { default as rowsAppend } from './rows-append.ts';\nexport { default as rowsCsvAppend } from './rows-csv-append.ts';\nexport { default as rowsGet } from './rows-get.ts';\nexport { default as sheetCopy } from './sheet-copy.ts';\nexport { default as sheetCopyTo } from './sheet-copy-to.ts';\nexport { default as sheetCreate } from './sheet-create.ts';\nexport { default as sheetDelete } from './sheet-delete.ts';\nexport { default as sheetFind } from './sheet-find.ts';\nexport { default as sheetRename } from './sheet-rename.ts';\nexport { default as spreadsheetCopy } from './spreadsheet-copy.ts';\nexport { default as spreadsheetCreate } from './spreadsheet-create.ts';\nexport { default as spreadsheetFind } from './spreadsheet-find.ts';\nexport { default as spreadsheetMetadataGet } from './spreadsheet-metadata-get.ts';\nexport { default as spreadsheetRename } from './spreadsheet-rename.ts';\nexport { default as validationSet } from './validation-set.ts';\nexport { default as valuesBatchUpdate } from './values-batch-update.ts';\nexport { default as valuesClear } from './values-clear.ts';\nexport { default as valuesCsvUpdate } from './values-csv-update.ts';\nexport { default as valuesMarkdownUpdate } from './values-markdown-update.ts';\nexport { default as valuesReplace } from './values-replace.ts';\nexport { default as valuesSearch } from './values-search.ts';\n"],"names":["cellsCopy","cellsFormat","cellsMetadataGet","chartCreate","columnsGet","columnsUpdate","csvGetColumns","dimensionsBatchUpdate","dimensionsMove","rowsAppend","rowsCsvAppend","rowsGet","sheetCopy","sheetCopyTo","sheetCreate","sheetDelete","sheetFind","sheetRename","spreadsheetCopy","spreadsheetCreate","spreadsheetFind","spreadsheetMetadataGet","spreadsheetRename","validationSet","valuesBatchUpdate","valuesClear","valuesCsvUpdate","valuesMarkdownUpdate","valuesReplace","valuesSearch"],"mappings":";;;;;;;;;;;QAAoBA;eAAAA,oBAAS;;QACTC;eAAAA,sBAAW;;QACXC;eAAAA,2BAAgB;;QAChBC;eAAAA,sBAAW;;QACXC;eAAAA,qBAAU;;QACVC;eAAAA,wBAAa;;QACbC;eAAAA,wBAAa;;QACbC;eAAAA,gCAAqB;;QACrBC;eAAAA,yBAAc;;QACdC;eAAAA,qBAAU;;QACVC;eAAAA,wBAAa;;QACbC;eAAAA,kBAAO;;QACPC;eAAAA,oBAAS;;QACTC;eAAAA,sBAAW;;QACXC;eAAAA,sBAAW;;QACXC;eAAAA,sBAAW;;QACXC;eAAAA,oBAAS;;QACTC;eAAAA,sBAAW;;QACXC;eAAAA,0BAAe;;QACfC;eAAAA,4BAAiB;;QACjBC;eAAAA,0BAAe;;QACfC;eAAAA,iCAAsB;;QACtBC;eAAAA,4BAAiB;;QACjBC;eAAAA,wBAAa;;QACbC;eAAAA,4BAAiB;;QACjBC;eAAAA,sBAAW;;QACXC;eAAAA,0BAAe;;QACfC;eAAAA,+BAAoB;;QACpBC;eAAAA,wBAAa;;QACbC;eAAAA,uBAAY;;;kEA7BK;oEACE;yEACK;oEACL;mEACD;sEACG;sEACA;8EACQ;uEACP;mEACJ;sEACG;gEACN;kEACE;oEACE;oEACA;oEACA;kEACF;oEACE;wEACI;0EACE;wEACF;+EACO;0EACL;sEACJ;0EACI;oEACN;wEACI;6EACK;sEACP;qEACD"}
|
|
@@ -3,6 +3,7 @@ export declare const SpreadsheetRefSchema: z.ZodString;
|
|
|
3
3
|
export declare const SheetRefSchema: z.ZodString;
|
|
4
4
|
export declare const SpreadsheetIdSchema: z.ZodString;
|
|
5
5
|
export declare const SheetGidSchema: z.ZodCoercedString<unknown>;
|
|
6
|
+
export declare const StrictSheetGidSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
6
7
|
export declare const SpreadsheetIdOutput: z.ZodString;
|
|
7
8
|
export declare const SheetGidOutput: z.ZodString;
|
|
8
9
|
export declare const SheetCellSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodLiteral<number>, z.ZodLiteral<number>, z.ZodBoolean, z.ZodNull]>;
|
|
@@ -3,6 +3,7 @@ export declare const SpreadsheetRefSchema: z.ZodString;
|
|
|
3
3
|
export declare const SheetRefSchema: z.ZodString;
|
|
4
4
|
export declare const SpreadsheetIdSchema: z.ZodString;
|
|
5
5
|
export declare const SheetGidSchema: z.ZodCoercedString<unknown>;
|
|
6
|
+
export declare const StrictSheetGidSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>, z.ZodTransform<string, string | number>>;
|
|
6
7
|
export declare const SpreadsheetIdOutput: z.ZodString;
|
|
7
8
|
export declare const SheetGidOutput: z.ZodString;
|
|
8
9
|
export declare const SheetCellSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodLiteral<number>, z.ZodLiteral<number>, z.ZodBoolean, z.ZodNull]>;
|
|
@@ -35,6 +35,9 @@ _export(exports, {
|
|
|
35
35
|
},
|
|
36
36
|
get SpreadsheetRefSchema () {
|
|
37
37
|
return SpreadsheetRefSchema;
|
|
38
|
+
},
|
|
39
|
+
get StrictSheetGidSchema () {
|
|
40
|
+
return StrictSheetGidSchema;
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
var _zod = require("zod");
|
|
@@ -45,6 +48,19 @@ var SPREADSHEET_ID_DESC = 'Spreadsheet ID (from URL d/{id})';
|
|
|
45
48
|
var SHEET_ID_DESC = 'Sheet ID (from URL gid={gid})';
|
|
46
49
|
var SpreadsheetIdSchema = _zod.z.string().min(1).describe(SPREADSHEET_ID_DESC);
|
|
47
50
|
var SheetGidSchema = _zod.z.coerce.string().min(1).describe(SHEET_ID_DESC);
|
|
51
|
+
// Strict sheet ID: a non-negative integer number or a string of digits (gid 0 and "0" both work).
|
|
52
|
+
// Unlike SheetGidSchema it does not coerce, so null, undefined, booleans, negatives, decimals and
|
|
53
|
+
// non-digit strings are rejected instead of becoming "null", "undefined", "true", etc.
|
|
54
|
+
// Sheet IDs are int32, so values above 2147483647 are rejected (keeps Number(gid) exact).
|
|
55
|
+
var MAX_SHEET_GID = 2147483647;
|
|
56
|
+
var StrictSheetGidSchema = _zod.z.union([
|
|
57
|
+
_zod.z.number().int().nonnegative().max(MAX_SHEET_GID),
|
|
58
|
+
_zod.z.string().regex(/^\d+$/, 'Sheet ID must be a non-negative integer').refine(function(value) {
|
|
59
|
+
return Number(value) <= MAX_SHEET_GID;
|
|
60
|
+
}, "Sheet ID must be at most ".concat(MAX_SHEET_GID))
|
|
61
|
+
]).transform(function(value) {
|
|
62
|
+
return String(typeof value === 'number' ? value : Number(value));
|
|
63
|
+
}).describe(SHEET_ID_DESC);
|
|
48
64
|
var SpreadsheetIdOutput = _zod.z.string().describe(SPREADSHEET_ID_DESC);
|
|
49
65
|
var SheetGidOutput = _zod.z.string().describe(SHEET_ID_DESC);
|
|
50
66
|
var SheetCellSchema = _zod.z.union([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\n// Spreadsheet and sheet reference schemas\nexport const SpreadsheetRefSchema = z.string().min(1).describe('Spreadsheet reference: full URL, exact name, or partial name (not ID - use spreadsheet-find to get ID)');\n\nexport const SheetRefSchema = z.string().min(1).describe('Sheet reference: exact title or partial name match (not ID - use sheet-find to get ID)');\n\n// Shared descriptions for consistency\nconst SPREADSHEET_ID_DESC = 'Spreadsheet ID (from URL d/{id})';\nconst SHEET_ID_DESC = 'Sheet ID (from URL gid={gid})';\n\n// Input schemas (with validation)\n// Note: z.coerce.string() converts numbers to strings, handling cases where MCP clients\n// pass gid: 0 (number) instead of gid: \"0\" (string). This is critical for gid=0 which\n// is the default sheet ID in new spreadsheets.\nexport const SpreadsheetIdSchema = z.string().min(1).describe(SPREADSHEET_ID_DESC);\nexport const SheetGidSchema = z.coerce.string().min(1).describe(SHEET_ID_DESC);\n\n// Output schemas (for use in output/response schemas)\nexport const SpreadsheetIdOutput = z.string().describe(SPREADSHEET_ID_DESC);\nexport const SheetGidOutput = z.string().describe(SHEET_ID_DESC);\n\n// Schema for individual sheet cells (can be string, number, boolean, or null)\n// null represents empty cells - JSON cannot represent undefined, and Google API uses null for empty cells\n// Infinity values are allowed as Google Sheets can contain them, but NaN is still rejected\nexport const SheetCellSchema = z.union([z.string(), z.number(), z.literal(Infinity), z.literal(-Infinity), z.boolean(), z.null()]);\n\n// Schema for a row in a sheet search result\nexport const SheetRowSchema = z.object({\n rowIndex: z.number().int().positive().describe('1-based row number in the sheet'),\n values: z.array(SheetCellSchema).optional().describe('Cell values for this row (included when includeData=true)'),\n range: z.string().optional().describe('A1 notation range for this row (e.g., A5:D5)'),\n});\n\n// A1 notation validation - simplified for zod compatibility\nexport const A1NotationSchema = z.string().min(1).describe('A1 notation for cell range (e.g., A1, A1:B2, A:B, 1:2)');\n"],"names":["A1NotationSchema","SheetCellSchema","SheetGidOutput","SheetGidSchema","SheetRefSchema","SheetRowSchema","SpreadsheetIdOutput","SpreadsheetIdSchema","SpreadsheetRefSchema","z","string","min","describe","SPREADSHEET_ID_DESC","SHEET_ID_DESC","coerce","union","number","literal","Infinity","boolean","null","object","rowIndex","
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\n// Spreadsheet and sheet reference schemas\nexport const SpreadsheetRefSchema = z.string().min(1).describe('Spreadsheet reference: full URL, exact name, or partial name (not ID - use spreadsheet-find to get ID)');\n\nexport const SheetRefSchema = z.string().min(1).describe('Sheet reference: exact title or partial name match (not ID - use sheet-find to get ID)');\n\n// Shared descriptions for consistency\nconst SPREADSHEET_ID_DESC = 'Spreadsheet ID (from URL d/{id})';\nconst SHEET_ID_DESC = 'Sheet ID (from URL gid={gid})';\n\n// Input schemas (with validation)\n// Note: z.coerce.string() converts numbers to strings, handling cases where MCP clients\n// pass gid: 0 (number) instead of gid: \"0\" (string). This is critical for gid=0 which\n// is the default sheet ID in new spreadsheets.\nexport const SpreadsheetIdSchema = z.string().min(1).describe(SPREADSHEET_ID_DESC);\nexport const SheetGidSchema = z.coerce.string().min(1).describe(SHEET_ID_DESC);\n\n// Strict sheet ID: a non-negative integer number or a string of digits (gid 0 and \"0\" both work).\n// Unlike SheetGidSchema it does not coerce, so null, undefined, booleans, negatives, decimals and\n// non-digit strings are rejected instead of becoming \"null\", \"undefined\", \"true\", etc.\n// Sheet IDs are int32, so values above 2147483647 are rejected (keeps Number(gid) exact).\nconst MAX_SHEET_GID = 2147483647;\nexport const StrictSheetGidSchema = z\n .union([\n z.number().int().nonnegative().max(MAX_SHEET_GID),\n z\n .string()\n .regex(/^\\d+$/, 'Sheet ID must be a non-negative integer')\n .refine((value) => Number(value) <= MAX_SHEET_GID, `Sheet ID must be at most ${MAX_SHEET_GID}`),\n ])\n .transform((value) => String(typeof value === 'number' ? value : Number(value)))\n .describe(SHEET_ID_DESC);\n\n// Output schemas (for use in output/response schemas)\nexport const SpreadsheetIdOutput = z.string().describe(SPREADSHEET_ID_DESC);\nexport const SheetGidOutput = z.string().describe(SHEET_ID_DESC);\n\n// Schema for individual sheet cells (can be string, number, boolean, or null)\n// null represents empty cells - JSON cannot represent undefined, and Google API uses null for empty cells\n// Infinity values are allowed as Google Sheets can contain them, but NaN is still rejected\nexport const SheetCellSchema = z.union([z.string(), z.number(), z.literal(Infinity), z.literal(-Infinity), z.boolean(), z.null()]);\n\n// Schema for a row in a sheet search result\nexport const SheetRowSchema = z.object({\n rowIndex: z.number().int().positive().describe('1-based row number in the sheet'),\n values: z.array(SheetCellSchema).optional().describe('Cell values for this row (included when includeData=true)'),\n range: z.string().optional().describe('A1 notation range for this row (e.g., A5:D5)'),\n});\n\n// A1 notation validation - simplified for zod compatibility\nexport const A1NotationSchema = z.string().min(1).describe('A1 notation for cell range (e.g., A1, A1:B2, A:B, 1:2)');\n"],"names":["A1NotationSchema","SheetCellSchema","SheetGidOutput","SheetGidSchema","SheetRefSchema","SheetRowSchema","SpreadsheetIdOutput","SpreadsheetIdSchema","SpreadsheetRefSchema","StrictSheetGidSchema","z","string","min","describe","SPREADSHEET_ID_DESC","SHEET_ID_DESC","coerce","MAX_SHEET_GID","union","number","int","nonnegative","max","regex","refine","value","Number","transform","String","literal","Infinity","boolean","null","object","rowIndex","positive","values","array","optional","range"],"mappings":";;;;;;;;;;;QAmDaA;eAAAA;;QAVAC;eAAAA;;QALAC;eAAAA;;QApBAC;eAAAA;;QAXAC;eAAAA;;QAuCAC;eAAAA;;QATAC;eAAAA;;QApBAC;eAAAA;;QAZAC;eAAAA;;QAoBAC;eAAAA;;;mBAvBK;AAGX,IAAMD,uBAAuBE,MAAC,CAACC,MAAM,GAAGC,GAAG,CAAC,GAAGC,QAAQ,CAAC;AAExD,IAAMT,iBAAiBM,MAAC,CAACC,MAAM,GAAGC,GAAG,CAAC,GAAGC,QAAQ,CAAC;AAEzD,sCAAsC;AACtC,IAAMC,sBAAsB;A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G2B,QAAQ,GAAGzB,QAAQ,CAAC;AACxC;AAGO,IAAMb,mBAAmBU,MAAC,CAACC,MAAM,GAAGC,GAAG,CAAC,GAAGC,QAAQ,CAAC"}
|
package/dist/cjs/setup/config.js
CHANGED
|
@@ -107,6 +107,7 @@ function _type_of(obj) {
|
|
|
107
107
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
108
108
|
}
|
|
109
109
|
var pkg = (0, _versionhelpts.readPkg)();
|
|
110
|
+
var SERVER_NAME = pkg.name.replace(/^@[^/]+\//, '');
|
|
110
111
|
// @mcp-z/oauth-google and @mcp-z/server are requireable at the >=20 floor; deferred so
|
|
111
112
|
// --version/--help (handled via version-help.ts, never this file) load neither package.
|
|
112
113
|
var _require = typeof require === 'undefined' ? _module.Module.createRequire(require("url").pathToFileURL(__filename).toString()) : require;
|
|
@@ -135,22 +136,11 @@ function parseConfig(args, env) {
|
|
|
135
136
|
strict: false,
|
|
136
137
|
allowPositionals: true
|
|
137
138
|
}).values;
|
|
138
|
-
var name =
|
|
139
|
+
var name = SERVER_NAME;
|
|
139
140
|
// Parse repository URL from package.json, stripping git+ prefix and .git suffix
|
|
140
141
|
var rawRepoUrl = _type_of(pkg.repository) === 'object' ? pkg.repository.url : pkg.repository;
|
|
141
142
|
var repositoryUrl = (_ref = rawRepoUrl === null || rawRepoUrl === void 0 ? void 0 : rawRepoUrl.replace(/^git\+/, '').replace(/\.git$/, '')) !== null && _ref !== void 0 ? _ref : "https://github.com/mcp-z/".concat(name);
|
|
142
|
-
var
|
|
143
|
-
try {
|
|
144
|
-
var configPath = mcpServer.findConfigPath({
|
|
145
|
-
config: '.mcp.json',
|
|
146
|
-
cwd: process.cwd(),
|
|
147
|
-
stopDir: (0, _os.homedir)()
|
|
148
|
-
});
|
|
149
|
-
rootDir = _path.dirname(configPath);
|
|
150
|
-
} catch (unused) {
|
|
151
|
-
rootDir = (0, _os.homedir)();
|
|
152
|
-
}
|
|
153
|
-
var baseDir = _path.join(rootDir, '.mcp-z');
|
|
143
|
+
var baseDir = resolveBaseDir();
|
|
154
144
|
var cliLogLevel = typeof values['log-level'] === 'string' ? values['log-level'] : undefined;
|
|
155
145
|
var envLogLevel = env.LOG_LEVEL;
|
|
156
146
|
var logLevel = (_ref1 = cliLogLevel !== null && cliLogLevel !== void 0 ? cliLogLevel : envLogLevel) !== null && _ref1 !== void 0 ? _ref1 : 'info';
|
|
@@ -188,7 +178,29 @@ function normalizeResourceStoreUri(resourceStoreUri) {
|
|
|
188
178
|
var expandedPath = resourceStoreUri.startsWith('~') ? resourceStoreUri.replace(/^~/, (0, _os.homedir)()) : resourceStoreUri;
|
|
189
179
|
return (0, _nodeurl.pathToFileURL)(_path.resolve(expandedPath)).href;
|
|
190
180
|
}
|
|
181
|
+
/** The server's data directory: `.mcp-z` beside the nearest .mcp.json (searched from cwd up to home), else in the home directory. */ function resolveBaseDir() {
|
|
182
|
+
var mcpServer = _require('@mcp-z/server');
|
|
183
|
+
try {
|
|
184
|
+
var configPath = mcpServer.findConfigPath({
|
|
185
|
+
config: '.mcp.json',
|
|
186
|
+
cwd: process.cwd(),
|
|
187
|
+
stopDir: (0, _os.homedir)()
|
|
188
|
+
});
|
|
189
|
+
return _path.join(_path.dirname(configPath), '.mcp-z');
|
|
190
|
+
} catch (unused) {
|
|
191
|
+
return _path.join((0, _os.homedir)(), '.mcp-z');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
191
194
|
function createConfig() {
|
|
192
|
-
|
|
195
|
+
var mcpServer = _require('@mcp-z/server');
|
|
196
|
+
var envResult = mcpServer.loadServerEnv({
|
|
197
|
+
name: SERVER_NAME,
|
|
198
|
+
baseDir: resolveBaseDir()
|
|
199
|
+
});
|
|
200
|
+
try {
|
|
201
|
+
return parseConfig(process.argv, process.env);
|
|
202
|
+
} catch (error) {
|
|
203
|
+
throw new Error("".concat(error.message, "\n").concat(mcpServer.formatServerEnvSearch(envResult)));
|
|
204
|
+
}
|
|
193
205
|
}
|
|
194
206
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/setup/config.ts"],"sourcesContent":["import { fileURLToPath, pathToFileURL } from 'node:url';\nimport type * as OAuthGoogle from '@mcp-z/oauth-google';\nimport type * as McpServer from '@mcp-z/server';\nimport { Module } from 'module';\nimport { homedir } from 'os';\nimport * as path from 'path';\nimport { parseArgs } from 'util';\nimport { GOOGLE_SCOPE } from '../constants.ts';\nimport type { ServerConfig } from '../types.ts';\nimport { readPkg } from './version-help.ts';\n\nconst pkg = readPkg();\n\n// @mcp-z/oauth-google and @mcp-z/server are requireable at the >=20 floor; deferred so\n// --version/--help (handled via version-help.ts, never this file) load neither package.\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Parse Sheets server configuration from CLI arguments and environment.\n *\n * CLI Arguments (all optional):\n * - --auth=<mode> Authentication mode (default: loopback-oauth)\n * Modes: loopback-oauth, service-account, dcr\n * - --headless Disable browser auto-open, return auth URL instead\n * - --redirect-uri=<uri> OAuth redirect URI (default: ephemeral loopback)\n * - --dcr-mode=<mode> DCR mode (self-hosted or external, default: self-hosted)\n * - --dcr-verify-url=<url> External verification endpoint (required for external mode)\n * - --dcr-store-uri=<uri> DCR client storage URI (required for self-hosted mode)\n * - --port=<port> Enable HTTP transport on specified port\n * - --stdio Enable stdio transport (default if no port)\n * - --log-level=<level> Logging level (default: info)\n * - --resource-store-uri=<uri> Resource store URI for CSV file storage (default: file://~/.mcp-z/mcp-sheets/files)\n * - --base-url=<url> Base URL for HTTP file serving (optional)\n *\n * Environment Variables:\n * - GOOGLE_CLIENT_ID OAuth client ID (REQUIRED)\n * - GOOGLE_CLIENT_SECRET OAuth client secret (optional)\n * - AUTH_MODE Default authentication mode (optional)\n * - HEADLESS Disable browser auto-open (optional)\n * - DCR_MODE DCR mode (optional, same format as --dcr-mode)\n * - DCR_VERIFY_URL External verification URL (optional, same as --dcr-verify-url)\n * - DCR_STORE_URI DCR storage URI (optional, same as --dcr-store-uri)\n * - TOKEN_STORE_URI Token storage URI (optional)\n * - PORT Default HTTP port (optional)\n * - LOG_LEVEL Default logging level (optional)\n * - RESOURCE_STORE_URI Resource store URI (optional, file://)\n * - BASE_URL Base URL for HTTP file serving (optional)\n *\n * OAuth Scopes (from constants.ts):\n * openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive\n */\nexport function parseConfig(args: string[], env: Record<string, string | undefined>): ServerConfig {\n const oauthGoogle = _require('@mcp-z/oauth-google') as typeof OAuthGoogle;\n const mcpServer = _require('@mcp-z/server') as typeof McpServer;\n\n const transportConfig = mcpServer.parseConfig(args, env);\n const oauthConfig = oauthGoogle.parseConfig(args, env);\n\n // Parse DCR configuration if DCR mode is enabled\n const dcrConfig = oauthConfig.auth === 'dcr' ? oauthGoogle.parseDcrConfig(args, env, GOOGLE_SCOPE) : undefined;\n\n // Parse application-level config (LOG_LEVEL, RESOURCE_STORE_URI, BASE_URL)\n const { values } = parseArgs({\n args,\n options: {\n 'log-level': { type: 'string' },\n 'base-url': { type: 'string' },\n 'resource-store-uri': { type: 'string' },\n },\n strict: false, // Allow other arguments\n allowPositionals: true,\n });\n\n const name = pkg.name.replace(/^@[^/]+\\//, '');\n // Parse repository URL from package.json, stripping git+ prefix and .git suffix\n const rawRepoUrl = typeof pkg.repository === 'object' ? pkg.repository.url : pkg.repository;\n const repositoryUrl = rawRepoUrl?.replace(/^git\\+/, '').replace(/\\.git$/, '') ?? `https://github.com/mcp-z/${name}`;\n let rootDir = homedir();\n try {\n const configPath = mcpServer.findConfigPath({ config: '.mcp.json', cwd: process.cwd(), stopDir: homedir() });\n rootDir = path.dirname(configPath);\n } catch {\n rootDir = homedir();\n }\n const baseDir = path.join(rootDir, '.mcp-z');\n const cliLogLevel = typeof values['log-level'] === 'string' ? values['log-level'] : undefined;\n const envLogLevel = env.LOG_LEVEL;\n const logLevel = cliLogLevel ?? envLogLevel ?? 'info';\n\n // Parse storage configuration\n const cliResourceStoreUri = typeof values['resource-store-uri'] === 'string' ? values['resource-store-uri'] : undefined;\n const envResourceStoreUri = env.RESOURCE_STORE_URI;\n const defaultResourceStorePath = path.join(baseDir, name, 'files');\n const resourceStoreUri = normalizeResourceStoreUri(cliResourceStoreUri ?? envResourceStoreUri ?? defaultResourceStorePath);\n\n const cliBaseUrl = typeof values['base-url'] === 'string' ? values['base-url'] : undefined;\n const envBaseUrl = env.BASE_URL;\n const baseUrl = cliBaseUrl ?? envBaseUrl;\n\n // Combine configs\n return {\n ...oauthConfig, // Includes clientId, auth, headless, redirectUri\n transport: transportConfig.transport,\n logLevel,\n baseDir,\n name,\n version: pkg.version,\n repositoryUrl,\n resourceStoreUri,\n ...(baseUrl && { baseUrl }),\n ...(dcrConfig && { dcrConfig }),\n };\n}\n\nfunction normalizeResourceStoreUri(resourceStoreUri: string): string {\n const filePrefix = 'file://';\n if (resourceStoreUri.startsWith(filePrefix)) {\n const rawPath = resourceStoreUri.slice(filePrefix.length);\n const filePath = rawPath.startsWith('~') ? rawPath.replace(/^~/, homedir()) : rawPath.startsWith('/') ? fileURLToPath(resourceStoreUri) : rawPath;\n return pathToFileURL(path.resolve(filePath)).href;\n }\n\n if (resourceStoreUri.includes('://')) return resourceStoreUri;\n\n const expandedPath = resourceStoreUri.startsWith('~') ? resourceStoreUri.replace(/^~/, homedir()) : resourceStoreUri;\n return pathToFileURL(path.resolve(expandedPath)).href;\n}\n\n/**\n * Build production configuration from process globals.\n * Entry point for production server.\n */\nexport function createConfig(): ServerConfig {\n return parseConfig(process.argv, process.env);\n}\n"],"names":["createConfig","parseConfig","pkg","readPkg","_require","require","Module","createRequire","args","env","cliLogLevel","cliResourceStoreUri","oauthGoogle","mcpServer","transportConfig","oauthConfig","dcrConfig","auth","parseDcrConfig","GOOGLE_SCOPE","undefined","values","parseArgs","options","type","strict","allowPositionals","name","replace","rawRepoUrl","repository","url","repositoryUrl","rootDir","homedir","configPath","findConfigPath","config","cwd","process","stopDir","path","dirname","baseDir","join","envLogLevel","LOG_LEVEL","logLevel","envResourceStoreUri","RESOURCE_STORE_URI","defaultResourceStorePath","resourceStoreUri","normalizeResourceStoreUri","cliBaseUrl","envBaseUrl","BASE_URL","baseUrl","transport","version","filePrefix","startsWith","rawPath","slice","length","filePath","fileURLToPath","pathToFileURL","resolve","href","includes","expandedPath","argv"],"mappings":";;;;;;;;;;;QAoIgBA;eAAAA;;QAjFAC;eAAAA;;;uBAnD6B;sBAGtB;kBACC;4DACF;oBACI;2BACG;6BAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,IAAMC,MAAMC,IAAAA,sBAAO;AAEnB,uFAAuF;AACvF,wFAAwF;AACxF,IAAMC,WAAW,OAAOC,YAAY,cAAcC,cAAM,CAACC,aAAa,CAAC,uDAAmBF;AAoCnF,SAASJ,YAAYO,IAAc,EAAEC,GAAuC;cAoChEC,OAMkCC;IAzCnD,IAAMC,cAAcR,SAAS;IAC7B,IAAMS,YAAYT,SAAS;IAE3B,IAAMU,kBAAkBD,UAAUZ,WAAW,CAACO,MAAMC;IACpD,IAAMM,cAAcH,YAAYX,WAAW,CAACO,MAAMC;IAElD,iDAAiD;IACjD,IAAMO,YAAYD,YAAYE,IAAI,KAAK,QAAQL,YAAYM,cAAc,CAACV,MAAMC,KAAKU,yBAAY,IAAIC;IAErG,2EAA2E;IAC3E,IAAM,AAAEC,SAAWC,IAAAA,eAAS,EAAC;QAC3Bd,MAAAA;QACAe,SAAS;YACP,aAAa;gBAAEC,MAAM;YAAS;YAC9B,YAAY;gBAAE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C,WAAW,KAAK,WAAWA,MAAM,CAAC,WAAW,GAAGD;IACjF,IAAMkC,aAAa7C,IAAI8C,QAAQ;IAC/B,IAAMC,UAAUH,uBAAAA,wBAAAA,aAAcC;IAE9B,kBAAkB;IAClB,OAAO,uDACFvC;QACH0C,WAAW3C,gBAAgB2C,SAAS;QACpCV,UAAAA;QACAJ,SAAAA;QACAhB,MAAAA;QACA+B,SAASxD,IAAIwD,OAAO;QACpB1B,eAAAA;QACAmB,kBAAAA;QACIK,WAAW;QAAEA,SAAAA;IAAQ,GACrBxC,aAAa;QAAEA,WAAAA;IAAU;AAEjC;AAEA,SAASoC,0BAA0BD,gBAAwB;IACzD,IAAMQ,aAAa;IACnB,IAAIR,iBAAiBS,UAAU,CAACD,aAAa;QAC3C,IAAME,UAAUV,iBAAiBW,KAAK,CAACH,WAAWI,MAAM;QACxD,IAAMC,WAAWH,QAAQD,UAAU,CAAC,OAAOC,QAAQjC,OAAO,CAAC,MAAMM,IAAAA,WAAO,OAAM2B,QAAQD,UAAU,CAAC,OAAOK,IAAAA,sBAAa,EAACd,oBAAoBU;QAC1I,OAAOK,IAAAA,sBAAa,EAACzB,MAAK0B,OAAO,CAACH,WAAWI,IAAI;IACnD;IAEA,IAAIjB,iBAAiBkB,QAAQ,CAAC,QAAQ,OAAOlB;IAE7C,IAAMmB,eAAenB,iBAAiBS,UAAU,CAAC,OAAOT,iBAAiBvB,OAAO,CAAC,MAAMM,IAAAA,WAAO,OAAMiB;IACpG,OAAOe,IAAAA,sBAAa,EAACzB,MAAK0B,OAAO,CAACG,eAAeF,IAAI;AACvD;AAMO,SAASpE;IACd,OAAOC,YAAYsC,QAAQgC,IAAI,EAAEhC,QAAQ9B,GAAG;AAC9C"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/setup/config.ts"],"sourcesContent":["import { fileURLToPath, pathToFileURL } from 'node:url';\nimport type * as OAuthGoogle from '@mcp-z/oauth-google';\nimport type * as McpServer from '@mcp-z/server';\nimport { Module } from 'module';\nimport { homedir } from 'os';\nimport * as path from 'path';\nimport { parseArgs } from 'util';\nimport { GOOGLE_SCOPE } from '../constants.ts';\nimport type { ServerConfig } from '../types.ts';\nimport { readPkg } from './version-help.ts';\n\nconst pkg = readPkg();\nconst SERVER_NAME = pkg.name.replace(/^@[^/]+\\//, '');\n\n// @mcp-z/oauth-google and @mcp-z/server are requireable at the >=20 floor; deferred so\n// --version/--help (handled via version-help.ts, never this file) load neither package.\nconst _require = typeof require === 'undefined' ? Module.createRequire(import.meta.url) : require;\n\n/**\n * Parse Sheets server configuration from CLI arguments and environment.\n *\n * CLI Arguments (all optional):\n * - --auth=<mode> Authentication mode (default: loopback-oauth)\n * Modes: loopback-oauth, service-account, dcr\n * - --headless Disable browser auto-open, return auth URL instead\n * - --redirect-uri=<uri> OAuth redirect URI (default: ephemeral loopback)\n * - --dcr-mode=<mode> DCR mode (self-hosted or external, default: self-hosted)\n * - --dcr-verify-url=<url> External verification endpoint (required for external mode)\n * - --dcr-store-uri=<uri> DCR client storage URI (required for self-hosted mode)\n * - --port=<port> Enable HTTP transport on specified port\n * - --stdio Enable stdio transport (default if no port)\n * - --log-level=<level> Logging level (default: info)\n * - --resource-store-uri=<uri> Resource store URI for CSV file storage (default: file://~/.mcp-z/mcp-sheets/files)\n * - --base-url=<url> Base URL for HTTP file serving (optional)\n *\n * Environment Variables:\n * - GOOGLE_CLIENT_ID OAuth client ID (REQUIRED)\n * - GOOGLE_CLIENT_SECRET OAuth client secret (optional)\n * - AUTH_MODE Default authentication mode (optional)\n * - HEADLESS Disable browser auto-open (optional)\n * - DCR_MODE DCR mode (optional, same format as --dcr-mode)\n * - DCR_VERIFY_URL External verification URL (optional, same as --dcr-verify-url)\n * - DCR_STORE_URI DCR storage URI (optional, same as --dcr-store-uri)\n * - TOKEN_STORE_URI Token storage URI (optional)\n * - PORT Default HTTP port (optional)\n * - LOG_LEVEL Default logging level (optional)\n * - RESOURCE_STORE_URI Resource store URI (optional, file://)\n * - BASE_URL Base URL for HTTP file serving (optional)\n *\n * OAuth Scopes (from constants.ts):\n * openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive\n */\nexport function parseConfig(args: string[], env: Record<string, string | undefined>): ServerConfig {\n const oauthGoogle = _require('@mcp-z/oauth-google') as typeof OAuthGoogle;\n const mcpServer = _require('@mcp-z/server') as typeof McpServer;\n\n const transportConfig = mcpServer.parseConfig(args, env);\n const oauthConfig = oauthGoogle.parseConfig(args, env);\n\n // Parse DCR configuration if DCR mode is enabled\n const dcrConfig = oauthConfig.auth === 'dcr' ? oauthGoogle.parseDcrConfig(args, env, GOOGLE_SCOPE) : undefined;\n\n // Parse application-level config (LOG_LEVEL, RESOURCE_STORE_URI, BASE_URL)\n const { values } = parseArgs({\n args,\n options: {\n 'log-level': { type: 'string' },\n 'base-url': { type: 'string' },\n 'resource-store-uri': { type: 'string' },\n },\n strict: false, // Allow other arguments\n allowPositionals: true,\n });\n\n const name = SERVER_NAME;\n // Parse repository URL from package.json, stripping git+ prefix and .git suffix\n const rawRepoUrl = typeof pkg.repository === 'object' ? pkg.repository.url : pkg.repository;\n const repositoryUrl = rawRepoUrl?.replace(/^git\\+/, '').replace(/\\.git$/, '') ?? `https://github.com/mcp-z/${name}`;\n const baseDir = resolveBaseDir();\n const cliLogLevel = typeof values['log-level'] === 'string' ? values['log-level'] : undefined;\n const envLogLevel = env.LOG_LEVEL;\n const logLevel = cliLogLevel ?? envLogLevel ?? 'info';\n\n // Parse storage configuration\n const cliResourceStoreUri = typeof values['resource-store-uri'] === 'string' ? values['resource-store-uri'] : undefined;\n const envResourceStoreUri = env.RESOURCE_STORE_URI;\n const defaultResourceStorePath = path.join(baseDir, name, 'files');\n const resourceStoreUri = normalizeResourceStoreUri(cliResourceStoreUri ?? envResourceStoreUri ?? defaultResourceStorePath);\n\n const cliBaseUrl = typeof values['base-url'] === 'string' ? values['base-url'] : undefined;\n const envBaseUrl = env.BASE_URL;\n const baseUrl = cliBaseUrl ?? envBaseUrl;\n\n // Combine configs\n return {\n ...oauthConfig, // Includes clientId, auth, headless, redirectUri\n transport: transportConfig.transport,\n logLevel,\n baseDir,\n name,\n version: pkg.version,\n repositoryUrl,\n resourceStoreUri,\n ...(baseUrl && { baseUrl }),\n ...(dcrConfig && { dcrConfig }),\n };\n}\n\nfunction normalizeResourceStoreUri(resourceStoreUri: string): string {\n const filePrefix = 'file://';\n if (resourceStoreUri.startsWith(filePrefix)) {\n const rawPath = resourceStoreUri.slice(filePrefix.length);\n const filePath = rawPath.startsWith('~') ? rawPath.replace(/^~/, homedir()) : rawPath.startsWith('/') ? fileURLToPath(resourceStoreUri) : rawPath;\n return pathToFileURL(path.resolve(filePath)).href;\n }\n\n if (resourceStoreUri.includes('://')) return resourceStoreUri;\n\n const expandedPath = resourceStoreUri.startsWith('~') ? resourceStoreUri.replace(/^~/, homedir()) : resourceStoreUri;\n return pathToFileURL(path.resolve(expandedPath)).href;\n}\n\n/** The server's data directory: `.mcp-z` beside the nearest .mcp.json (searched from cwd up to home), else in the home directory. */\nfunction resolveBaseDir(): string {\n const mcpServer = _require('@mcp-z/server') as typeof McpServer;\n try {\n const configPath = mcpServer.findConfigPath({ config: '.mcp.json', cwd: process.cwd(), stopDir: homedir() });\n return path.join(path.dirname(configPath), '.mcp-z');\n } catch {\n return path.join(homedir(), '.mcp-z');\n }\n}\n\n/**\n * Build production configuration from process globals.\n * Entry point for production server.\n */\nexport function createConfig(): ServerConfig {\n const mcpServer = _require('@mcp-z/server') as typeof McpServer;\n const envResult = mcpServer.loadServerEnv({ name: SERVER_NAME, baseDir: resolveBaseDir() });\n try {\n return parseConfig(process.argv, process.env);\n } catch (error) {\n throw new Error(`${(error as Error).message}\\n${mcpServer.formatServerEnvSearch(envResult)}`);\n }\n}\n"],"names":["createConfig","parseConfig","pkg","readPkg","SERVER_NAME","name","replace","_require","require","Module","createRequire","args","env","cliLogLevel","cliResourceStoreUri","oauthGoogle","mcpServer","transportConfig","oauthConfig","dcrConfig","auth","parseDcrConfig","GOOGLE_SCOPE","undefined","values","parseArgs","options","type","strict","allowPositionals","rawRepoUrl","repository","url","repositoryUrl","baseDir","resolveBaseDir","envLogLevel","LOG_LEVEL","logLevel","envResourceStoreUri","RESOURCE_STORE_URI","defaultResourceStorePath","path","join","resourceStoreUri","normalizeResourceStoreUri","cliBaseUrl","envBaseUrl","BASE_URL","baseUrl","transport","version","filePrefix","startsWith","rawPath","slice","length","filePath","homedir","fileURLToPath","pathToFileURL","resolve","href","includes","expandedPath","configPath","findConfigPath","config","cwd","process","stopDir","dirname","envResult","loadServerEnv","argv","error","Error","message","formatServerEnvSearch"],"mappings":";;;;;;;;;;;QAyIgBA;eAAAA;;QArFAC;eAAAA;;;uBApD6B;sBAGtB;kBACC;4DACF;oBACI;2BACG;6BAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExB,IAAMC,MAAMC,IAAAA,sBAAO;AACnB,IAAMC,cAAcF,IAAIG,IAAI,CAACC,OAAO,CAAC,aAAa;AAElD,uFAAuF;AACvF,wFAAwF;AACxF,IAAMC,WAAW,OAAOC,YAAY,cAAcC,cAAM,CAACC,aAAa,CAAC,uDAAmBF;AAoCnF,SAASP,YAAYU,IAAc,EAAEC,GAAuC;cA6BhEC,OAMkCC;IAlCnD,IAAMC,cAAcR,SAAS;IAC7B,IAAMS,YAAYT,SAAS;IAE3B,IAAMU,kBAAkBD,UAAUf,WAAW,CAACU,MAAMC;IACpD,IAAMM,cAAcH,YAAYd,WAAW,CAACU,MAAMC;IAElD,iDAAiD;IACjD,IAAMO,YAAYD,YAAYE,IAAI,KAAK,QAAQL,YAAYM,cAAc,CAACV,MAAMC,KAAKU,yBAAY,IAAIC;IAErG,2EAA2E;IAC3E,IAAM,AAAEC,SAAWC,IA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IACzF,IAAI;QACF,OAAOlC,YAAYoE,QAAQK,IAAI,EAAEL,QAAQzD,GAAG;IAC9C,EAAE,OAAO+D,OAAO;QACd,MAAM,IAAIC,MAAM,AAAC,GAA+B5D,OAA7B,AAAC2D,MAAgBE,OAAO,EAAC,MAA+C,OAA3C7D,UAAU8D,qBAAqB,CAACN;IAClF;AACF"}
|
|
@@ -60,7 +60,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
60
60
|
// resolve nothing beyond Node startup: config.ts's parseConfig pulls in @mcp-z/oauth-google and
|
|
61
61
|
// @mcp-z/server, which this path must not touch.
|
|
62
62
|
var pkg = JSON.parse(_fs.readFileSync(_path.join((0, _modulerootsync.default)(_url.fileURLToPath(require("url").pathToFileURL(__filename).toString())), 'package.json'), 'utf-8'));
|
|
63
|
-
var HELP_TEXT =
|
|
63
|
+
var HELP_TEXT = '\nUsage: mcp-sheets [options]\n\nMCP server for Google Sheets spreadsheet management with OAuth authentication.\n\nOptions:\n --version, -v Show version number\n --help, -h Show this help message\n --auth=<mode> Authentication mode (default: loopback-oauth)\n Modes: loopback-oauth, service-account, dcr\n --headless Disable browser auto-open, return auth URL instead\n --redirect-uri=<uri> OAuth redirect URI (default: ephemeral loopback)\n --dcr-mode=<mode> DCR mode (self-hosted or external, default: self-hosted)\n --dcr-verify-url=<url> External verification endpoint (required for external mode)\n --dcr-store-uri=<uri> DCR client storage URI (required for self-hosted mode)\n --port=<port> Enable HTTP transport on specified port\n --stdio Enable stdio transport (default if no port)\n --log-level=<level> Logging level (default: info)\n --resource-store-uri=<uri> Resource store URI for CSV file storage (default: file://~/.mcp-z/mcp-sheets/files)\n --base-url=<url> Base URL for HTTP file serving (optional)\n\nEnvironment Variables:\n GOOGLE_CLIENT_ID OAuth client ID (REQUIRED)\n GOOGLE_CLIENT_SECRET OAuth client secret (optional)\n AUTH_MODE Default authentication mode (optional)\n HEADLESS Disable browser auto-open (optional)\n DCR_MODE DCR mode (optional, same format as --dcr-mode)\n DCR_VERIFY_URL External verification URL (optional, same as --dcr-verify-url)\n DCR_STORE_URI DCR storage URI (optional, same as --dcr-store-uri)\n TOKEN_STORE_URI Token storage URI (optional)\n PORT Default HTTP port (optional)\n LOG_LEVEL Default logging level (optional)\n RESOURCE_STORE_URI Resource store URI (optional, file://)\n BASE_URL Base URL for HTTP file serving (optional)\n\nConfiguration Files:\n Variables may also be set in the first of these files that exists:\n 1. .mcp-z/mcp-sheets/.env beside the nearest .mcp.json (else ~/.mcp-z/mcp-sheets/.env)\n 2. ~/.config/mcp-z/mcp-sheets/.env (~ is your home directory, on every OS)\n Values already in the environment, including .mcp.json "env", take precedence.\n On macOS and Linux the file must be private (chmod 600), or the server will not start.\n\nStorage Backends:\n TOKEN_STORE_URI and DCR_STORE_URI accept any keyv-registry protocol.\n file:// (the default) and memory:// work out of the box. Any other backend\n needs its adapter installed alongside this server:\n npm install -g @keyv/redis\n TOKEN_STORE_URI=redis://localhost:6379 mcp-sheets\n\nOAuth Scopes:\n openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive\n\nExamples:\n mcp-sheets # Use default settings\n mcp-sheets --auth=service-account # Use service account auth\n mcp-sheets --port=3000 # HTTP transport on port 3000\n mcp-sheets --resource-store-uri=file:///tmp/sheets # Custom resource store URI\n GOOGLE_CLIENT_ID=xxx mcp-sheets # Set client ID via env var\n'.trim();
|
|
64
64
|
function readPkg() {
|
|
65
65
|
return pkg;
|
|
66
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/setup/version-help.ts"],"sourcesContent":["import * as fs from 'fs';\nimport moduleRoot from 'module-root-sync';\nimport * as path from 'path';\nimport * as url from 'url';\nimport { parseArgs } from 'util';\n\n// Kept dependency-free (fs/path/url/module-root-sync only) so `--version`/`--help`\n// resolve nothing beyond Node startup: config.ts's parseConfig pulls in @mcp-z/oauth-google and\n// @mcp-z/server, which this path must not touch.\nconst pkg = JSON.parse(fs.readFileSync(path.join(moduleRoot(url.fileURLToPath(import.meta.url)), 'package.json'), 'utf-8'));\n\nconst HELP_TEXT = `\nUsage: mcp-sheets [options]\n\nMCP server for Google Sheets spreadsheet management with OAuth authentication.\n\nOptions:\n --version, -v Show version number\n --help, -h Show this help message\n --auth=<mode> Authentication mode (default: loopback-oauth)\n Modes: loopback-oauth, service-account, dcr\n --headless Disable browser auto-open, return auth URL instead\n --redirect-uri=<uri> OAuth redirect URI (default: ephemeral loopback)\n --dcr-mode=<mode> DCR mode (self-hosted or external, default: self-hosted)\n --dcr-verify-url=<url> External verification endpoint (required for external mode)\n --dcr-store-uri=<uri> DCR client storage URI (required for self-hosted mode)\n --port=<port> Enable HTTP transport on specified port\n --stdio Enable stdio transport (default if no port)\n --log-level=<level> Logging level (default: info)\n --resource-store-uri=<uri> Resource store URI for CSV file storage (default: file://~/.mcp-z/mcp-sheets/files)\n --base-url=<url> Base URL for HTTP file serving (optional)\n\nEnvironment Variables:\n GOOGLE_CLIENT_ID OAuth client ID (REQUIRED)\n GOOGLE_CLIENT_SECRET OAuth client secret (optional)\n AUTH_MODE Default authentication mode (optional)\n HEADLESS Disable browser auto-open (optional)\n DCR_MODE DCR mode (optional, same format as --dcr-mode)\n DCR_VERIFY_URL External verification URL (optional, same as --dcr-verify-url)\n DCR_STORE_URI DCR storage URI (optional, same as --dcr-store-uri)\n TOKEN_STORE_URI Token storage URI (optional)\n PORT Default HTTP port (optional)\n LOG_LEVEL Default logging level (optional)\n RESOURCE_STORE_URI Resource store URI (optional, file://)\n BASE_URL Base URL for HTTP file serving (optional)\n\nStorage Backends:\n TOKEN_STORE_URI and DCR_STORE_URI accept any keyv-registry protocol.\n file:// (the default) and memory:// work out of the box. Any other backend\n needs its adapter installed alongside this server:\n npm install -g @keyv/redis\n TOKEN_STORE_URI=redis://localhost:6379 mcp-sheets\n\nOAuth Scopes:\n openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive\n\nExamples:\n mcp-sheets # Use default settings\n mcp-sheets --auth=service-account # Use service account auth\n mcp-sheets --port=3000 # HTTP transport on port 3000\n mcp-sheets --resource-store-uri=file:///tmp/sheets # Custom resource store URI\n GOOGLE_CLIENT_ID=xxx mcp-sheets # Set client ID via env var\n`.trim();\n\n/** Package metadata read from package.json, resolved relative to this file. */\nexport function readPkg(): { name: string; version: string; repository?: string | { url?: string } } {\n return pkg;\n}\n\n/**\n * Handle --version/--help flags before config parsing.\n * These must work without requiring any configuration or heavy dependency.\n */\nexport function handleVersionHelp(args: string[]): { handled: boolean; output?: string } {\n const { values } = parseArgs({\n args,\n options: {\n version: { type: 'boolean', short: 'v' },\n help: { type: 'boolean', short: 'h' },\n },\n strict: false,\n allowPositionals: true,\n });\n\n if (values.version) return { handled: true, output: pkg.version };\n if (values.help) return { handled: true, output: HELP_TEXT };\n return { handled: false };\n}\n"],"names":["handleVersionHelp","readPkg","pkg","JSON","parse","fs","readFileSync","path","join","moduleRoot","url","fileURLToPath","HELP_TEXT","trim","args","values","parseArgs","options","version","type","short","help","strict","allowPositionals","handled","output"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/mcp-z/mcp-sheets/src/setup/version-help.ts"],"sourcesContent":["import * as fs from 'fs';\nimport moduleRoot from 'module-root-sync';\nimport * as path from 'path';\nimport * as url from 'url';\nimport { parseArgs } from 'util';\n\n// Kept dependency-free (fs/path/url/module-root-sync only) so `--version`/`--help`\n// resolve nothing beyond Node startup: config.ts's parseConfig pulls in @mcp-z/oauth-google and\n// @mcp-z/server, which this path must not touch.\nconst pkg = JSON.parse(fs.readFileSync(path.join(moduleRoot(url.fileURLToPath(import.meta.url)), 'package.json'), 'utf-8'));\n\nconst HELP_TEXT = `\nUsage: mcp-sheets [options]\n\nMCP server for Google Sheets spreadsheet management with OAuth authentication.\n\nOptions:\n --version, -v Show version number\n --help, -h Show this help message\n --auth=<mode> Authentication mode (default: loopback-oauth)\n Modes: loopback-oauth, service-account, dcr\n --headless Disable browser auto-open, return auth URL instead\n --redirect-uri=<uri> OAuth redirect URI (default: ephemeral loopback)\n --dcr-mode=<mode> DCR mode (self-hosted or external, default: self-hosted)\n --dcr-verify-url=<url> External verification endpoint (required for external mode)\n --dcr-store-uri=<uri> DCR client storage URI (required for self-hosted mode)\n --port=<port> Enable HTTP transport on specified port\n --stdio Enable stdio transport (default if no port)\n --log-level=<level> Logging level (default: info)\n --resource-store-uri=<uri> Resource store URI for CSV file storage (default: file://~/.mcp-z/mcp-sheets/files)\n --base-url=<url> Base URL for HTTP file serving (optional)\n\nEnvironment Variables:\n GOOGLE_CLIENT_ID OAuth client ID (REQUIRED)\n GOOGLE_CLIENT_SECRET OAuth client secret (optional)\n AUTH_MODE Default authentication mode (optional)\n HEADLESS Disable browser auto-open (optional)\n DCR_MODE DCR mode (optional, same format as --dcr-mode)\n DCR_VERIFY_URL External verification URL (optional, same as --dcr-verify-url)\n DCR_STORE_URI DCR storage URI (optional, same as --dcr-store-uri)\n TOKEN_STORE_URI Token storage URI (optional)\n PORT Default HTTP port (optional)\n LOG_LEVEL Default logging level (optional)\n RESOURCE_STORE_URI Resource store URI (optional, file://)\n BASE_URL Base URL for HTTP file serving (optional)\n\nConfiguration Files:\n Variables may also be set in the first of these files that exists:\n 1. .mcp-z/mcp-sheets/.env beside the nearest .mcp.json (else ~/.mcp-z/mcp-sheets/.env)\n 2. ~/.config/mcp-z/mcp-sheets/.env (~ is your home directory, on every OS)\n Values already in the environment, including .mcp.json \"env\", take precedence.\n On macOS and Linux the file must be private (chmod 600), or the server will not start.\n\nStorage Backends:\n TOKEN_STORE_URI and DCR_STORE_URI accept any keyv-registry protocol.\n file:// (the default) and memory:// work out of the box. Any other backend\n needs its adapter installed alongside this server:\n npm install -g @keyv/redis\n TOKEN_STORE_URI=redis://localhost:6379 mcp-sheets\n\nOAuth Scopes:\n openid https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive\n\nExamples:\n mcp-sheets # Use default settings\n mcp-sheets --auth=service-account # Use service account auth\n mcp-sheets --port=3000 # HTTP transport on port 3000\n mcp-sheets --resource-store-uri=file:///tmp/sheets # Custom resource store URI\n GOOGLE_CLIENT_ID=xxx mcp-sheets # Set client ID via env var\n`.trim();\n\n/** Package metadata read from package.json, resolved relative to this file. */\nexport function readPkg(): { name: string; version: string; repository?: string | { url?: string } } {\n return pkg;\n}\n\n/**\n * Handle --version/--help flags before config parsing.\n * These must work without requiring any configuration or heavy dependency.\n */\nexport function handleVersionHelp(args: string[]): { handled: boolean; output?: string } {\n const { values } = parseArgs({\n args,\n options: {\n version: { type: 'boolean', short: 'v' },\n help: { type: 'boolean', short: 'h' },\n },\n strict: false,\n allowPositionals: true,\n });\n\n if (values.version) return { handled: true, output: pkg.version };\n if (values.help) return { handled: true, output: HELP_TEXT };\n return { handled: false };\n}\n"],"names":["handleVersionHelp","readPkg","pkg","JSON","parse","fs","readFileSync","path","join","moduleRoot","url","fileURLToPath","HELP_TEXT","trim","args","values","parseArgs","options","version","type","short","help","strict","allowPositionals","handled","output"],"mappings":";;;;;;;;;;;QAgFgBA;eAAAA;;QARAC;eAAAA;;;0DAxEI;qEACG;4DACD;2DACD;oBACK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1B,mFAAmF;AACnF,gGAAgG;AAChG,iDAAiD;AACjD,IAAMC,MAAMC,KAAKC,KAAK,CAACC,IAAGC,YAAY,CAACC,MAAKC,IAAI,CAACC,IAAAA,uBAAU,EAACC,KAAIC,aAAa,CAAC,uDAAmB,iBAAiB;AAElH,IAAMC,YAAY,itGA0DhBC,IAAI;AAGC,SAASZ;IACd,OAAOC;AACT;AAMO,SAASF,kBAAkBc,IAAc;IAC9C,IAAM,AAAEC,SAAWC,IAAAA,eAAS,EAAC;QAC3BF,MAAAA;QACAG,SAAS;YACPC,SAAS;gBAAEC,MAAM;gBAAWC,OAAO;YAAI;YACvCC,MAAM;gBAAEF,MAAM;gBAAWC,OAAO;YAAI;QACtC;QACAE,QAAQ;QACRC,kBAAkB;IACpB,GARQR;IAUR,IAAIA,OAAOG,OAAO,EAAE,OAAO;QAAEM,SAAS;QAAMC,QAAQvB,IAAIgB,OAAO;IAAC;IAChE,IAAIH,OAAOM,IAAI,EAAE,OAAO;QAAEG,SAAS;QAAMC,QAAQb;IAAU;IAC3D,OAAO;QAAEY,SAAS;IAAM;AAC1B"}
|