@mcp-z/mcp-gmail 1.0.1 → 1.0.2

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.
@@ -1,6 +1,10 @@
1
1
  import type { ServerConfig } from './types.js';
2
2
  export { GOOGLE_SCOPE } from './constants.js';
3
3
  export * as mcp from './mcp/index.js';
4
+ export type { Input as CategoriesListInput } from './mcp/tools/categories-list.js';
5
+ export { inputSchema as CategoriesListInputSchema } from './mcp/tools/categories-list.js';
6
+ export type { Input as LabelsListInput } from './mcp/tools/labels-list.js';
7
+ export { inputSchema as LabelsListInputSchema } from './mcp/tools/labels-list.js';
4
8
  export * as schemas from './schemas/index.js';
5
9
  export * as setup from './setup/index.js';
6
10
  export * from './types.js';
@@ -1,6 +1,10 @@
1
1
  import type { ServerConfig } from './types.js';
2
2
  export { GOOGLE_SCOPE } from './constants.js';
3
3
  export * as mcp from './mcp/index.js';
4
+ export type { Input as CategoriesListInput } from './mcp/tools/categories-list.js';
5
+ export { inputSchema as CategoriesListInputSchema } from './mcp/tools/categories-list.js';
6
+ export type { Input as LabelsListInput } from './mcp/tools/labels-list.js';
7
+ export { inputSchema as LabelsListInputSchema } from './mcp/tools/labels-list.js';
4
8
  export * as schemas from './schemas/index.js';
5
9
  export * as setup from './setup/index.js';
6
10
  export * from './types.js';
package/dist/cjs/index.js CHANGED
@@ -9,9 +9,15 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
+ get CategoriesListInputSchema () {
13
+ return _categorieslistts.inputSchema;
14
+ },
12
15
  get GOOGLE_SCOPE () {
13
16
  return _constantsts.GOOGLE_SCOPE;
14
17
  },
18
+ get LabelsListInputSchema () {
19
+ return _labelslistts.inputSchema;
20
+ },
15
21
  get default () {
16
22
  return main;
17
23
  },
@@ -33,6 +39,8 @@ var _httpts = require("./setup/http.js");
33
39
  var _stdiots = require("./setup/stdio.js");
34
40
  var _constantsts = require("./constants.js");
35
41
  var _indexts = /*#__PURE__*/ _interop_require_wildcard(require("./mcp/index.js"));
42
+ var _categorieslistts = require("./mcp/tools/categories-list.js");
43
+ var _labelslistts = require("./mcp/tools/labels-list.js");
36
44
  var _indexts1 = /*#__PURE__*/ _interop_require_wildcard(require("./schemas/index.js"));
37
45
  var _indexts2 = /*#__PURE__*/ _interop_require_wildcard(require("./setup/index.js"));
38
46
  _export_star(require("./types.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/index.ts"],"sourcesContent":["import { createConfig, handleVersionHelp } from './setup/config.ts';\nimport { createHTTPServer } from './setup/http.ts';\nimport { createStdioServer } from './setup/stdio.ts';\nimport type { ServerConfig } from './types.ts';\n\nexport { GOOGLE_SCOPE } from './constants.ts';\nexport * as mcp from './mcp/index.ts';\nexport * as schemas from './schemas/index.ts';\nexport * as setup from './setup/index.ts';\nexport * from './types.ts';\n\nexport async function startServer(config: ServerConfig): Promise<void> {\n const { logger, close } = config.transport.type === 'stdio' ? await createStdioServer(config) : await createHTTPServer(config);\n\n process.on('SIGINT', async () => {\n await close();\n process.exit(0);\n });\n\n logger.info(`Server started with ${config.transport.type} transport`);\n await new Promise(() => {});\n}\n\nexport default async function main(): Promise<void> {\n // Check for help/version flags FIRST, before config parsing\n const versionHelpResult = handleVersionHelp(process.argv);\n if (versionHelpResult.handled) {\n console.log(versionHelpResult.output);\n process.exit(0);\n }\n\n // Only parse config if no help/version flags\n const config = createConfig();\n await startServer(config);\n}\n\nif (process.argv[1] === new URL(import.meta.url).pathname) {\n main();\n}\n"],"names":["GOOGLE_SCOPE","main","mcp","schemas","setup","startServer","config","logger","close","transport","type","createStdioServer","createHTTPServer","process","on","exit","info","Promise","versionHelpResult","handleVersionHelp","argv","handled","console","log","output","createConfig","URL","pathname"],"mappings":";;;;;;;;;;;QAKSA;eAAAA,yBAAY;;QAkBrB;eAA8BC;;QAjBlBC;;;QACAC;;;QACAC;;;QAGUC;eAAAA;;;wBAX0B;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evin/Dev/Projects/mcp-z/mcp-gmail/src/index.ts"],"sourcesContent":["import { createConfig, handleVersionHelp } from './setup/config.ts';\nimport { createHTTPServer } from './setup/http.ts';\nimport { createStdioServer } from './setup/stdio.ts';\nimport type { ServerConfig } from './types.ts';\n\nexport { GOOGLE_SCOPE } from './constants.ts';\nexport * as mcp from './mcp/index.ts';\n// Export types and schemas for documentation\nexport type { Input as CategoriesListInput } from './mcp/tools/categories-list.ts';\nexport { inputSchema as CategoriesListInputSchema } from './mcp/tools/categories-list.ts';\nexport type { Input as LabelsListInput } from './mcp/tools/labels-list.ts';\nexport { inputSchema as LabelsListInputSchema } from './mcp/tools/labels-list.ts';\nexport * as schemas from './schemas/index.ts';\nexport * as setup from './setup/index.ts';\nexport * from './types.ts';\n\nexport async function startServer(config: ServerConfig): Promise<void> {\n const { logger, close } = config.transport.type === 'stdio' ? await createStdioServer(config) : await createHTTPServer(config);\n\n process.on('SIGINT', async () => {\n await close();\n process.exit(0);\n });\n\n logger.info(`Server started with ${config.transport.type} transport`);\n await new Promise(() => {});\n}\n\nexport default async function main(): Promise<void> {\n // Check for help/version flags FIRST, before config parsing\n const versionHelpResult = handleVersionHelp(process.argv);\n if (versionHelpResult.handled) {\n console.log(versionHelpResult.output);\n process.exit(0);\n }\n\n // Only parse config if no help/version flags\n const config = createConfig();\n await startServer(config);\n}\n\nif (process.argv[1] === new URL(import.meta.url).pathname) {\n main();\n}\n"],"names":["CategoriesListInputSchema","inputSchema","GOOGLE_SCOPE","LabelsListInputSchema","main","mcp","schemas","setup","startServer","config","logger","close","transport","type","createStdioServer","createHTTPServer","process","on","exit","info","Promise","versionHelpResult","handleVersionHelp","argv","handled","console","log","output","createConfig","URL","pathname"],"mappings":";;;;;;;;;;;QASwBA;eAAfC,6BAAW;;QAJXC;eAAAA,yBAAY;;QAMGC;eAAfF,yBAAW;;QAiBpB;eAA8BG;;QAtBlBC;;;QAMAC;;;QACAC;;;QAGUC;eAAAA;;;wBAhB0B;sBACf;uBAC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 @@
1
1
  import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
2
  import { z } from 'zod';
3
- declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
3
+ /**
4
+ * Input schema for the categories-list tool (currently empty as this tool takes no parameters).
5
+ */
6
+ export declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
4
7
  declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
8
  type: z.ZodLiteral<"success">;
6
9
  items: z.ZodArray<z.ZodObject<{
@@ -14,9 +17,12 @@ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
14
17
  message: z.ZodString;
15
18
  url: z.ZodOptional<z.ZodString>;
16
19
  }, z.core.$strip>], "type">;
20
+ /**
21
+ * Input parameters for the categories-list tool.
22
+ */
17
23
  export type Input = z.infer<typeof inputSchema>;
18
24
  export type Output = z.infer<typeof outputSchema>;
19
- declare function handler(_args: Input, extra: EnrichedExtra): Promise<{
25
+ declare function handler(_: Input, extra: EnrichedExtra): Promise<{
20
26
  content: {
21
27
  type: "text";
22
28
  text: string;
@@ -1,6 +1,9 @@
1
1
  import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
2
  import { z } from 'zod';
3
- declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
3
+ /**
4
+ * Input schema for the categories-list tool (currently empty as this tool takes no parameters).
5
+ */
6
+ export declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
4
7
  declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
8
  type: z.ZodLiteral<"success">;
6
9
  items: z.ZodArray<z.ZodObject<{
@@ -14,9 +17,12 @@ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
14
17
  message: z.ZodString;
15
18
  url: z.ZodOptional<z.ZodString>;
16
19
  }, z.core.$strip>], "type">;
20
+ /**
21
+ * Input parameters for the categories-list tool.
22
+ */
17
23
  export type Input = z.infer<typeof inputSchema>;
18
24
  export type Output = z.infer<typeof outputSchema>;
19
- declare function handler(_args: Input, extra: EnrichedExtra): Promise<{
25
+ declare function handler(_: Input, extra: EnrichedExtra): Promise<{
20
26
  content: {
21
27
  type: "text";
22
28
  text: string;
@@ -2,10 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get default () {
8
13
  return createTool;
14
+ },
15
+ get inputSchema () {
16
+ return inputSchema;
9
17
  }
10
18
  });
11
19
  var _oauthgoogle = require("@mcp-z/oauth-google");
@@ -172,7 +180,7 @@ var config = {
172
180
  result: outputSchema
173
181
  })
174
182
  };
175
- function handler(_args, extra) {
183
+ function handler(_, extra) {
176
184
  return _async_to_generator(function() {
177
185
  var logger, gmail, started, response, labels, categories, durationMs, result, error, message;
178
186
  return _ts_generator(this, function(_state) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/categories-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual category items\nconst CategorySchema = z.object({\n id: z.string().describe('Gmail category ID (e.g., CATEGORY_PERSONAL)'),\n name: z.string().describe('Human-readable category name'),\n description: z.string().describe('Description of what emails belong in this category'),\n});\n\nconst inputSchema = z.object({});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(CategorySchema),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail category labels (CATEGORY_*) with IDs and descriptions.',\n inputSchema: 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(_args: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.categories.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter for CATEGORY_* system labels and map to our schema\n const categories = labels\n .filter((label) => label.id?.startsWith('CATEGORY_'))\n .map((label) => {\n const id = label.id as string;\n let name = label.name || id;\n let description = '';\n\n // Map known category types to user-friendly names and descriptions\n switch (id) {\n case 'CATEGORY_PERSONAL':\n name = 'Primary';\n description = 'Important emails from people you know';\n break;\n case 'CATEGORY_SOCIAL':\n name = 'Social';\n description = 'Social networks and social websites';\n break;\n case 'CATEGORY_PROMOTIONS':\n name = 'Promotions';\n description = 'Deals, offers, and marketing emails';\n break;\n case 'CATEGORY_UPDATES':\n name = 'Updates';\n description = 'Confirmations, receipts, bills, and statements';\n break;\n case 'CATEGORY_FORUMS':\n name = 'Forums';\n description = 'Online groups, discussion boards, mailing lists';\n break;\n default:\n // For any unknown CATEGORY_* labels, use the label name as-is\n name = label.name || id.replace('CATEGORY_', '');\n description = `Gmail category: ${name}`;\n }\n\n return {\n id,\n name,\n description,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)); // Sort alphabetically by name\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.categories.list results', { categoryCount: categories.length, totalLabels: labels.length });\n logger.info('gmail.categories.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: categories,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.categories.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing categories: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'categories-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","CategorySchema","z","object","id","string","describe","name","description","inputSchema","successBranchSchema","type","literal","items","array","outputSchema","discriminatedUnion","config","result","handler","_args","extra","logger","gmail","started","response","labels","categories","durationMs","error","message","info","google","version","auth","authContext","Date","now","users","list","userId","data","filter","label","startsWith","map","replace","sort","a","b","localeCompare","categoryCount","length","totalLabels","content","text","JSON","stringify","structuredContent","Error","String","McpError","ErrorCode","InternalError","stack","undefined"],"mappings":";;;;+BA4HA;;;eAAwBA;;;2BA3HA;qBAKY;0BACb;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALlB,IAAM,AAAEC,2BAA6BC,oBAAO,CAApCD;AAOR,uCAAuC;AACvC,IAAME,iBAAiBC,MAAC,CAACC,MAAM,CAAC;IAC9BC,IAAIF,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IACxBC,MAAML,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IAC1BE,aAAaN,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;AACnC;AAEA,IAAMG,cAAcP,MAAC,CAACC,MAAM,CAAC,CAAC;AAE9B,wBAAwB;AACxB,IAAMO,sBAAsBR,MAAC,CAACC,MAAM,CAAC;IACnCQ,MAAMT,MAAC,CAACU,OAAO,CAAC;IAChBC,OAAOX,MAAC,CAACY,KAAK,CAACb;AACjB;AAEA,2CAA2C;AAC3C,IAAMc,eAAeb,MA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Ac,AAAC,mBAAuB,OAALD;wBACrC;wBAEA,OAAO;4BACLH,IAAAA;4BACAG,MAAAA;4BACAC,aAAAA;wBACF;oBACF,GACCuC,IAAI,CAAC,SAACC,GAAGC;+BAAMD,EAAEzC,IAAI,CAAC2C,aAAa,CAACD,EAAE1C,IAAI;wBAAI,8BAA8B;oBAEzEqB,aAAaQ,KAAKC,GAAG,KAAKb;oBAEhCF,OAAOS,IAAI,CAAC,iCAAiC;wBAAEoB,eAAexB,WAAWyB,MAAM;wBAAEC,aAAa3B,OAAO0B,MAAM;oBAAC;oBAC5G9B,OAAOS,IAAI,CAAC,iCAAiC;wBAAEH,YAAAA;oBAAW;oBAEpDV,SAAiB;wBACrBP,MAAM;wBACNE,OAAOc;oBACT;oBAEA;;wBAAO;4BACL2B,OAAO;gCACL;oCACE3C,MAAM;oCACN4C,MAAMC,KAAKC,SAAS,CAACvC;gCACvB;;4BAEFwC,mBAAmB;gCAAExC,QAAAA;4BAAO;wBAC9B;;;oBACOW;oBACDC,UAAUD,AAAK,YAALA,OAAiB8B,SAAQ9B,MAAMC,OAAO,GAAG8B,OAAO/B;oBAChEP,OAAOO,KAAK,CAAC,+BAA+B;wBAAEA,OAAOC;oBAAQ;oBAE7D,MAAM,IAAI+B,eAAQ,CAACC,gBAAS,CAACC,aAAa,EAAE,AAAC,6BAAoC,OAARjC,UAAW;wBAClFkC,OAAOnC,AAAK,YAALA,OAAiB8B,SAAQ9B,MAAMmC,KAAK,GAAGC;oBAChD;;;;;;;IAEJ;;AAEe,SAASnE;IACtB,OAAO;QACLS,MAAM;QACNU,QAAAA;QACAE,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/categories-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual category items\nconst CategorySchema = z.object({\n id: z.string().describe('Gmail category ID (e.g., CATEGORY_PERSONAL)'),\n name: z.string().describe('Human-readable category name'),\n description: z.string().describe('Description of what emails belong in this category'),\n});\n\n/**\n * Input schema for the categories-list tool (currently empty as this tool takes no parameters).\n */\nexport const inputSchema = z.object({});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(CategorySchema),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail category labels (CATEGORY_*) with IDs and descriptions.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\n/**\n * Input parameters for the categories-list tool.\n */\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler(_: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.categories.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter for CATEGORY_* system labels and map to our schema\n const categories = labels\n .filter((label) => label.id?.startsWith('CATEGORY_'))\n .map((label) => {\n const id = label.id as string;\n let name = label.name || id;\n let description = '';\n\n // Map known category types to user-friendly names and descriptions\n switch (id) {\n case 'CATEGORY_PERSONAL':\n name = 'Primary';\n description = 'Important emails from people you know';\n break;\n case 'CATEGORY_SOCIAL':\n name = 'Social';\n description = 'Social networks and social websites';\n break;\n case 'CATEGORY_PROMOTIONS':\n name = 'Promotions';\n description = 'Deals, offers, and marketing emails';\n break;\n case 'CATEGORY_UPDATES':\n name = 'Updates';\n description = 'Confirmations, receipts, bills, and statements';\n break;\n case 'CATEGORY_FORUMS':\n name = 'Forums';\n description = 'Online groups, discussion boards, mailing lists';\n break;\n default:\n // For any unknown CATEGORY_* labels, use the label name as-is\n name = label.name || id.replace('CATEGORY_', '');\n description = `Gmail category: ${name}`;\n }\n\n return {\n id,\n name,\n description,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)); // Sort alphabetically by name\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.categories.list results', { categoryCount: categories.length, totalLabels: labels.length });\n logger.info('gmail.categories.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: categories,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.categories.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing categories: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'categories-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","inputSchema","AuthRequiredBranchSchema","schemas","CategorySchema","z","object","id","string","describe","name","description","successBranchSchema","type","literal","items","array","outputSchema","discriminatedUnion","config","result","handler","_","extra","logger","gmail","started","response","labels","categories","durationMs","error","message","info","google","version","auth","authContext","Date","now","users","list","userId","data","filter","label","startsWith","map","replace","sort","a","b","localeCompare","categoryCount","length","totalLabels","content","text","JSON","stringify","structuredContent","Error","String","McpError","ErrorCode","InternalError","stack","undefined"],"mappings":";;;;;;;;;;;QAkIA;eAAwBA;;QA9GXC;eAAAA;;;2BAnBW;qBAKY;0BACb;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALlB,IAAM,AAAEC,2BAA6BC,oBAAO,CAApCD;AAOR,uCAAuC;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AQ,CAACC,gBAAS,CAACC,aAAa,EAAE,AAAC,6BAAoC,OAARjC,UAAW;wBAClFkC,OAAOnC,AAAK,YAALA,OAAiB8B,SAAQ9B,MAAMmC,KAAK,GAAGC;oBAChD;;;;;;;IAEJ;;AAEe,SAASnE;IACtB,OAAO;QACLU,MAAM;QACNS,QAAAA;QACAE,SAAAA;IACF;AACF"}
@@ -1,6 +1,9 @@
1
1
  import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
2
  import { z } from 'zod';
3
- declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
3
+ /**
4
+ * Input schema for the labels-list tool (currently empty as this tool takes no parameters).
5
+ */
6
+ export declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
4
7
  declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
8
  type: z.ZodLiteral<"success">;
6
9
  items: z.ZodArray<z.ZodObject<{
@@ -22,9 +25,12 @@ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
25
  message: z.ZodString;
23
26
  url: z.ZodOptional<z.ZodString>;
24
27
  }, z.core.$strip>], "type">;
28
+ /**
29
+ * Input parameters for the labels-list tool.
30
+ */
25
31
  export type Input = z.infer<typeof inputSchema>;
26
32
  export type Output = z.infer<typeof outputSchema>;
27
- declare function handler(_args: Input, extra: EnrichedExtra): Promise<{
33
+ declare function handler(_: Input, extra: EnrichedExtra): Promise<{
28
34
  content: {
29
35
  type: "text";
30
36
  text: string;
@@ -1,6 +1,9 @@
1
1
  import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
2
  import { z } from 'zod';
3
- declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
3
+ /**
4
+ * Input schema for the labels-list tool (currently empty as this tool takes no parameters).
5
+ */
6
+ export declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
4
7
  declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
8
  type: z.ZodLiteral<"success">;
6
9
  items: z.ZodArray<z.ZodObject<{
@@ -22,9 +25,12 @@ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
25
  message: z.ZodString;
23
26
  url: z.ZodOptional<z.ZodString>;
24
27
  }, z.core.$strip>], "type">;
28
+ /**
29
+ * Input parameters for the labels-list tool.
30
+ */
25
31
  export type Input = z.infer<typeof inputSchema>;
26
32
  export type Output = z.infer<typeof outputSchema>;
27
- declare function handler(_args: Input, extra: EnrichedExtra): Promise<{
33
+ declare function handler(_: Input, extra: EnrichedExtra): Promise<{
28
34
  content: {
29
35
  type: "text";
30
36
  text: string;
@@ -2,10 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
6
- enumerable: true,
7
- get: function() {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: Object.getOwnPropertyDescriptor(all, name).get
9
+ });
10
+ }
11
+ _export(exports, {
12
+ get default () {
8
13
  return createTool;
14
+ },
15
+ get inputSchema () {
16
+ return inputSchema;
9
17
  }
10
18
  });
11
19
  var _oauthgoogle = require("@mcp-z/oauth-google");
@@ -178,7 +186,7 @@ var config = {
178
186
  result: outputSchema
179
187
  })
180
188
  };
181
- function handler(_args, extra) {
189
+ function handler(_, extra) {
182
190
  return _async_to_generator(function() {
183
191
  var logger, gmail, started, response, labels, availableLabels, durationMs, result, error, message;
184
192
  return _ts_generator(this, function(_state) {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/labels-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual label items\nconst LabelSchema = z.object({\n id: z.string().describe('Gmail label ID'),\n name: z.string().describe('Label name for use in queries (case-sensitive)'),\n type: z.enum(['user', 'system']).describe('Whether this is a user-created or system label'),\n visibility: z.enum(['labelShow', 'labelHide', 'labelShowIfUnread']).describe('Label visibility in Gmail UI'),\n});\n\nconst inputSchema = z.object({});\n\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(LabelSchema),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail labels for label: query syntax. Case-sensitive.',\n inputSchema: 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(_args: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.labels.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter out CATEGORY_* labels (handled by categories tool) and map to our schema\n const availableLabels = labels\n .filter((label) => {\n // Exclude CATEGORY_* labels as they're handled by the categories tool\n return !label.id?.startsWith('CATEGORY_');\n })\n .map((label) => {\n const id = label.id as string;\n const name = label.name || id;\n\n // Determine label type\n const type: 'user' | 'system' = label.type === 'user' ? 'user' : 'system';\n\n // Map label visibility\n let visibility: 'labelShow' | 'labelHide' | 'labelShowIfUnread' = 'labelShow';\n if (label.labelListVisibility === 'labelHide') {\n visibility = 'labelHide';\n } else if (label.labelListVisibility === 'labelShowIfUnread') {\n visibility = 'labelShowIfUnread';\n }\n\n return {\n id,\n name,\n type,\n visibility,\n };\n })\n .sort((a, b) => {\n // Sort user labels first, then system labels, both alphabetically\n if (a.type !== b.type) {\n return a.type === 'user' ? -1 : 1;\n }\n // Use simple ASCII comparison for consistent, case-sensitive sorting\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;\n });\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.labels.list results', {\n labelCount: availableLabels.length,\n userLabels: availableLabels.filter((l) => l.type === 'user').length,\n systemLabels: availableLabels.filter((l) => l.type === 'system').length,\n totalLabels: labels.length,\n });\n logger.info('gmail.labels.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: availableLabels,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.labels.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing labels: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'labels-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","AuthRequiredBranchSchema","schemas","LabelSchema","z","object","id","string","describe","name","type","enum","visibility","inputSchema","successBranchSchema","literal","items","array","outputSchema","discriminatedUnion","config","description","result","handler","_args","extra","logger","gmail","started","response","labels","availableLabels","durationMs","error","message","info","google","version","auth","authContext","Date","now","users","list","userId","data","filter","label","startsWith","map","labelListVisibility","sort","a","b","labelCount","length","userLabels","l","systemLabels","totalLabels","content","text","JSON","stringify","structuredContent","Error","String","McpError","ErrorCode","InternalError","stack","undefined"],"mappings":";;;;+BAyHA;;;eAAwBA;;;2BAxHA;qBAKY;0BACb;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALlB,IAAM,AAAEC,2BAA6BC,oBAAO,CAApCD;AAOR,oCAAoC;AACpC,IAAME,cAAcC,MAAC,CAACC,MAAM,CAAC;IAC3BC,IAAIF,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IAC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KAAKC,SAAS,CAACzC;gCACvB;;4BAEF0C,mBAAmB;gCAAE1C,QAAAA;4BAAO;wBAC9B;;;oBACOW;oBACDC,UAAUD,AAAK,YAALA,OAAiBgC,SAAQhC,MAAMC,OAAO,GAAGgC,OAAOjC;oBAChEP,OAAOO,KAAK,CAAC,2BAA2B;wBAAEA,OAAOC;oBAAQ;oBAEzD,MAAM,IAAIiC,eAAQ,CAACC,gBAAS,CAACC,aAAa,EAAE,AAAC,yBAAgC,OAARnC,UAAW;wBAC9EoC,OAAOrC,AAAK,YAALA,OAAiBgC,SAAQhC,MAAMqC,KAAK,GAAGC;oBAChD;;;;;;;IAEJ;;AAEe,SAASvE;IACtB,OAAO;QACLS,MAAM;QACNW,QAAAA;QACAG,SAAAA;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/labels-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual label items\nconst LabelSchema = z.object({\n id: z.string().describe('Gmail label ID'),\n name: z.string().describe('Label name for use in queries (case-sensitive)'),\n type: z.enum(['user', 'system']).describe('Whether this is a user-created or system label'),\n visibility: z.enum(['labelShow', 'labelHide', 'labelShowIfUnread']).describe('Label visibility in Gmail UI'),\n});\n\n/**\n * Input schema for the labels-list tool (currently empty as this tool takes no parameters).\n */\nexport const inputSchema = z.object({});\n\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(LabelSchema),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail labels for label: query syntax. Case-sensitive.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\n/**\n * Input parameters for the labels-list tool.\n */\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler(_: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.labels.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter out CATEGORY_* labels (handled by categories tool) and map to our schema\n const availableLabels = labels\n .filter((label) => {\n // Exclude CATEGORY_* labels as they're handled by the categories tool\n return !label.id?.startsWith('CATEGORY_');\n })\n .map((label) => {\n const id = label.id as string;\n const name = label.name || id;\n\n // Determine label type\n const type: 'user' | 'system' = label.type === 'user' ? 'user' : 'system';\n\n // Map label visibility\n let visibility: 'labelShow' | 'labelHide' | 'labelShowIfUnread' = 'labelShow';\n if (label.labelListVisibility === 'labelHide') {\n visibility = 'labelHide';\n } else if (label.labelListVisibility === 'labelShowIfUnread') {\n visibility = 'labelShowIfUnread';\n }\n\n return {\n id,\n name,\n type,\n visibility,\n };\n })\n .sort((a, b) => {\n // Sort user labels first, then system labels, both alphabetically\n if (a.type !== b.type) {\n return a.type === 'user' ? -1 : 1;\n }\n // Use simple ASCII comparison for consistent, case-sensitive sorting\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;\n });\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.labels.list results', {\n labelCount: availableLabels.length,\n userLabels: availableLabels.filter((l) => l.type === 'user').length,\n systemLabels: availableLabels.filter((l) => l.type === 'system').length,\n totalLabels: labels.length,\n });\n logger.info('gmail.labels.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: availableLabels,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.labels.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing labels: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'labels-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["createTool","inputSchema","AuthRequiredBranchSchema","schemas","LabelSchema","z","object","id","string","describe","name","type","enum","visibility","successBranchSchema","literal","items","array","outputSchema","discriminatedUnion","config","description","result","handler","_","extra","logger","gmail","started","response","labels","availableLabels","durationMs","error","message","info","google","version","auth","authContext","Date","now","users","list","userId","data","filter","label","startsWith","map","labelListVisibility","sort","a","b","labelCount","length","userLabels","l","systemLabels","totalLabels","content","text","JSON","stringify","structuredContent","Error","String","McpError","ErrorCode","InternalError","stack","undefined"],"mappings":";;;;;;;;;;;QA+HA;eAAwBA;;QA1GXC;eAAAA;;;2BApBW;qBAKY;0BACb;mBACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AALlB,IAAM,AAAEC,2BAA6BC,oBAAO,CAApCD;AAOR,oCAAoC;AACpC,IAAME,cAAcC,MAAC,CAACC,MAAM,CAAC;IAC3BC,IAAIF,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IACxBC,MAAML,MAAC,CAACG,MAAM,GAAGC,QAAQ,CAAC;IAC1BE,MAAMN,MAAC,CAACO,IAAI,CAAC;QAAC;QAAQ;KAAS,EAAEH,QAAQ,CAAC;IAC1CI,YAAYR,MAAC,CAACO,IAAI,CAAC;QAAC;QAAa;QAAa;KAAoB,EAAEH,QAAQ,CAAC;AAC/E;AAKO,IAAMR,cAAcI,MAAC,CAACC,MAAM,CAAC,CAAC;AAErC,IAAMQ,sBAAsBT,MAAC,CAACC,MAAM,CAAC;IACnCK,MAAMN,MA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rC,AAAK,YAALA,OAAiBgC,SAAQhC,MAAMqC,KAAK,GAAGC;oBAChD;;;;;;;IAEJ;;AAEe,SAASvE;IACtB,OAAO;QACLU,MAAM;QACNU,QAAAA;QACAG,SAAAA;IACF;AACF"}
@@ -1,5 +1,6 @@
1
1
  export { createConfig, parseConfig } from './config.js';
2
2
  export { createHTTPServer } from './http.js';
3
+ export type { AuthMiddleware, OAuthAdapters, OAuthRuntimeDeps } from './oauth-google.js';
3
4
  export { createOAuthAdapters } from './oauth-google.js';
4
5
  export * from './runtime.js';
5
6
  export { createStdioServer } from './stdio.js';
@@ -1,5 +1,6 @@
1
1
  export { createConfig, parseConfig } from './config.js';
2
2
  export { createHTTPServer } from './http.js';
3
+ export type { AuthMiddleware, OAuthAdapters, OAuthRuntimeDeps } from './oauth-google.js';
3
4
  export { createOAuthAdapters } from './oauth-google.js';
4
5
  export * from './runtime.js';
5
6
  export { createStdioServer } from './stdio.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/setup/index.ts"],"sourcesContent":["export { createConfig, parseConfig } from './config.ts';\nexport { createHTTPServer } from './http.ts';\nexport { createOAuthAdapters } from './oauth-google.ts';\nexport * from './runtime.ts';\nexport { createStdioServer } from './stdio.ts';\n"],"names":["createConfig","createHTTPServer","createOAuthAdapters","createStdioServer","parseConfig"],"mappings":";;;;;;;;;;;QAASA;eAAAA,sBAAY;;QACZC;eAAAA,wBAAgB;;QAChBC;eAAAA,kCAAmB;;QAEnBC;eAAAA,0BAAiB;;QAJHC;eAAAA,qBAAW;;;wBAAQ;sBACT;6BACG;qBACtB;uBACoB"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/setup/index.ts"],"sourcesContent":["export { createConfig, parseConfig } from './config.ts';\nexport { createHTTPServer } from './http.ts';\nexport type { AuthMiddleware, OAuthAdapters, OAuthRuntimeDeps } from './oauth-google.ts';\nexport { createOAuthAdapters } from './oauth-google.ts';\nexport * from './runtime.ts';\nexport { createStdioServer } from './stdio.ts';\n"],"names":["createConfig","createHTTPServer","createOAuthAdapters","createStdioServer","parseConfig"],"mappings":";;;;;;;;;;;QAASA;eAAAA,sBAAY;;QACZC;eAAAA,wBAAgB;;QAEhBC;eAAAA,kCAAmB;;QAEnBC;eAAAA,0BAAiB;;QALHC;eAAAA,qBAAW;;;wBAAQ;sBACT;6BAEG;qBACtB;uBACoB"}
@@ -1,6 +1,10 @@
1
1
  import type { ServerConfig } from './types.js';
2
2
  export { GOOGLE_SCOPE } from './constants.js';
3
3
  export * as mcp from './mcp/index.js';
4
+ export type { Input as CategoriesListInput } from './mcp/tools/categories-list.js';
5
+ export { inputSchema as CategoriesListInputSchema } from './mcp/tools/categories-list.js';
6
+ export type { Input as LabelsListInput } from './mcp/tools/labels-list.js';
7
+ export { inputSchema as LabelsListInputSchema } from './mcp/tools/labels-list.js';
4
8
  export * as schemas from './schemas/index.js';
5
9
  export * as setup from './setup/index.js';
6
10
  export * from './types.js';
package/dist/esm/index.js CHANGED
@@ -4,6 +4,8 @@ import { createStdioServer } from './setup/stdio.js';
4
4
  export { GOOGLE_SCOPE } from './constants.js';
5
5
  import * as _mcp from './mcp/index.js';
6
6
  export { _mcp as mcp };
7
+ export { inputSchema as CategoriesListInputSchema } from './mcp/tools/categories-list.js';
8
+ export { inputSchema as LabelsListInputSchema } from './mcp/tools/labels-list.js';
7
9
  import * as _schemas from './schemas/index.js';
8
10
  export { _schemas as schemas };
9
11
  import * as _setup from './setup/index.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/index.ts"],"sourcesContent":["import { createConfig, handleVersionHelp } from './setup/config.ts';\nimport { createHTTPServer } from './setup/http.ts';\nimport { createStdioServer } from './setup/stdio.ts';\nimport type { ServerConfig } from './types.ts';\n\nexport { GOOGLE_SCOPE } from './constants.ts';\nexport * as mcp from './mcp/index.ts';\nexport * as schemas from './schemas/index.ts';\nexport * as setup from './setup/index.ts';\nexport * from './types.ts';\n\nexport async function startServer(config: ServerConfig): Promise<void> {\n const { logger, close } = config.transport.type === 'stdio' ? await createStdioServer(config) : await createHTTPServer(config);\n\n process.on('SIGINT', async () => {\n await close();\n process.exit(0);\n });\n\n logger.info(`Server started with ${config.transport.type} transport`);\n await new Promise(() => {});\n}\n\nexport default async function main(): Promise<void> {\n // Check for help/version flags FIRST, before config parsing\n const versionHelpResult = handleVersionHelp(process.argv);\n if (versionHelpResult.handled) {\n console.log(versionHelpResult.output);\n process.exit(0);\n }\n\n // Only parse config if no help/version flags\n const config = createConfig();\n await startServer(config);\n}\n\nif (process.argv[1] === new URL(import.meta.url).pathname) {\n main();\n}\n"],"names":["createConfig","handleVersionHelp","createHTTPServer","createStdioServer","GOOGLE_SCOPE","mcp","schemas","setup","startServer","config","logger","close","transport","type","process","on","exit","info","Promise","main","versionHelpResult","argv","handled","console","log","output","URL","url","pathname"],"mappings":"AAAA,SAASA,YAAY,EAAEC,iBAAiB,QAAQ,oBAAoB;AACpE,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,iBAAiB,QAAQ,mBAAmB;AAGrD,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,sBAAqB,iBAAiB;AAAtC,SAAO,QAAKC,GAAG,GAAuB;AACtC,0BAAyB,qBAAqB;AAA9C,SAAO,YAAKC,OAAO,GAA2B;AAC9C,wBAAuB,mBAAmB;AAA1C,SAAO,UAAKC,KAAK,GAAyB;AAC1C,cAAc,aAAa;AAE3B,OAAO,eAAeC,YAAYC,MAAoB;IACpD,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGF,OAAOG,SAAS,CAACC,IAAI,KAAK,UAAU,MAAMV,kBAAkBM,UAAU,MAAMP,iBAAiBO;IAEvHK,QAAQC,EAAE,CAAC,UAAU;QACnB,MAAMJ;QACNG,QAAQE,IAAI,CAAC;IACf;IAEAN,OAAOO,IAAI,CAAC,CAAC,oBAAoB,EAAER,OAAOG,SAAS,CAACC,IAAI,CAAC,UAAU,CAAC;IACpE,MAAM,IAAIK,QAAQ,KAAO;AAC3B;AAEA,eAAe,eAAeC;IAC5B,4DAA4D;IAC5D,MAAMC,oBAAoBnB,kBAAkBa,QAAQO,IAAI;IACxD,IAAID,kBAAkBE,OAAO,EAAE;QAC7BC,QAAQC,GAAG,CAACJ,kBAAkBK,MAAM;QACpCX,QAAQE,IAAI,CAAC;IACf;IAEA,6CAA6C;IAC7C,MAAMP,SAAST;IACf,MAAMQ,YAAYC;AACpB;AAEA,IAAIK,QAAQO,IAAI,CAAC,EAAE,KAAK,IAAIK,IAAI,YAAYC,GAAG,EAAEC,QAAQ,EAAE;IACzDT;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/index.ts"],"sourcesContent":["import { createConfig, handleVersionHelp } from './setup/config.ts';\nimport { createHTTPServer } from './setup/http.ts';\nimport { createStdioServer } from './setup/stdio.ts';\nimport type { ServerConfig } from './types.ts';\n\nexport { GOOGLE_SCOPE } from './constants.ts';\nexport * as mcp from './mcp/index.ts';\n// Export types and schemas for documentation\nexport type { Input as CategoriesListInput } from './mcp/tools/categories-list.ts';\nexport { inputSchema as CategoriesListInputSchema } from './mcp/tools/categories-list.ts';\nexport type { Input as LabelsListInput } from './mcp/tools/labels-list.ts';\nexport { inputSchema as LabelsListInputSchema } from './mcp/tools/labels-list.ts';\nexport * as schemas from './schemas/index.ts';\nexport * as setup from './setup/index.ts';\nexport * from './types.ts';\n\nexport async function startServer(config: ServerConfig): Promise<void> {\n const { logger, close } = config.transport.type === 'stdio' ? await createStdioServer(config) : await createHTTPServer(config);\n\n process.on('SIGINT', async () => {\n await close();\n process.exit(0);\n });\n\n logger.info(`Server started with ${config.transport.type} transport`);\n await new Promise(() => {});\n}\n\nexport default async function main(): Promise<void> {\n // Check for help/version flags FIRST, before config parsing\n const versionHelpResult = handleVersionHelp(process.argv);\n if (versionHelpResult.handled) {\n console.log(versionHelpResult.output);\n process.exit(0);\n }\n\n // Only parse config if no help/version flags\n const config = createConfig();\n await startServer(config);\n}\n\nif (process.argv[1] === new URL(import.meta.url).pathname) {\n main();\n}\n"],"names":["createConfig","handleVersionHelp","createHTTPServer","createStdioServer","GOOGLE_SCOPE","mcp","inputSchema","CategoriesListInputSchema","LabelsListInputSchema","schemas","setup","startServer","config","logger","close","transport","type","process","on","exit","info","Promise","main","versionHelpResult","argv","handled","console","log","output","URL","url","pathname"],"mappings":"AAAA,SAASA,YAAY,EAAEC,iBAAiB,QAAQ,oBAAoB;AACpE,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,iBAAiB,QAAQ,mBAAmB;AAGrD,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,sBAAqB,iBAAiB;AAAtC,SAAO,QAAKC,GAAG,GAAuB;AAGtC,SAASC,eAAeC,yBAAyB,QAAQ,iCAAiC;AAE1F,SAASD,eAAeE,qBAAqB,QAAQ,6BAA6B;AAClF,0BAAyB,qBAAqB;AAA9C,SAAO,YAAKC,OAAO,GAA2B;AAC9C,wBAAuB,mBAAmB;AAA1C,SAAO,UAAKC,KAAK,GAAyB;AAC1C,cAAc,aAAa;AAE3B,OAAO,eAAeC,YAAYC,MAAoB;IACpD,MAAM,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGF,OAAOG,SAAS,CAACC,IAAI,KAAK,UAAU,MAAMb,kBAAkBS,UAAU,MAAMV,iBAAiBU;IAEvHK,QAAQC,EAAE,CAAC,UAAU;QACnB,MAAMJ;QACNG,QAAQE,IAAI,CAAC;IACf;IAEAN,OAAOO,IAAI,CAAC,CAAC,oBAAoB,EAAER,OAAOG,SAAS,CAACC,IAAI,CAAC,UAAU,CAAC;IACpE,MAAM,IAAIK,QAAQ,KAAO;AAC3B;AAEA,eAAe,eAAeC;IAC5B,4DAA4D;IAC5D,MAAMC,oBAAoBtB,kBAAkBgB,QAAQO,IAAI;IACxD,IAAID,kBAAkBE,OAAO,EAAE;QAC7BC,QAAQC,GAAG,CAACJ,kBAAkBK,MAAM;QACpCX,QAAQE,IAAI,CAAC;IACf;IAEA,6CAA6C;IAC7C,MAAMP,SAASZ;IACf,MAAMW,YAAYC;AACpB;AAEA,IAAIK,QAAQO,IAAI,CAAC,EAAE,KAAK,IAAIK,IAAI,YAAYC,GAAG,EAAEC,QAAQ,EAAE;IACzDT;AACF"}
@@ -1,6 +1,9 @@
1
1
  import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
2
  import { z } from 'zod';
3
- declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
3
+ /**
4
+ * Input schema for the categories-list tool (currently empty as this tool takes no parameters).
5
+ */
6
+ export declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
4
7
  declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
8
  type: z.ZodLiteral<"success">;
6
9
  items: z.ZodArray<z.ZodObject<{
@@ -14,9 +17,12 @@ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
14
17
  message: z.ZodString;
15
18
  url: z.ZodOptional<z.ZodString>;
16
19
  }, z.core.$strip>], "type">;
20
+ /**
21
+ * Input parameters for the categories-list tool.
22
+ */
17
23
  export type Input = z.infer<typeof inputSchema>;
18
24
  export type Output = z.infer<typeof outputSchema>;
19
- declare function handler(_args: Input, extra: EnrichedExtra): Promise<{
25
+ declare function handler(_: Input, extra: EnrichedExtra): Promise<{
20
26
  content: {
21
27
  type: "text";
22
28
  text: string;
@@ -9,7 +9,9 @@ const CategorySchema = z.object({
9
9
  name: z.string().describe('Human-readable category name'),
10
10
  description: z.string().describe('Description of what emails belong in this category')
11
11
  });
12
- const inputSchema = z.object({});
12
+ /**
13
+ * Input schema for the categories-list tool (currently empty as this tool takes no parameters).
14
+ */ export const inputSchema = z.object({});
13
15
  // Success branch schema
14
16
  const successBranchSchema = z.object({
15
17
  type: z.literal('success'),
@@ -27,7 +29,7 @@ const config = {
27
29
  result: outputSchema
28
30
  })
29
31
  };
30
- async function handler(_args, extra) {
32
+ async function handler(_, extra) {
31
33
  const logger = extra.logger;
32
34
  logger.info('gmail.categories.list called');
33
35
  try {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/categories-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual category items\nconst CategorySchema = z.object({\n id: z.string().describe('Gmail category ID (e.g., CATEGORY_PERSONAL)'),\n name: z.string().describe('Human-readable category name'),\n description: z.string().describe('Description of what emails belong in this category'),\n});\n\nconst inputSchema = z.object({});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(CategorySchema),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail category labels (CATEGORY_*) with IDs and descriptions.',\n inputSchema: 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(_args: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.categories.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter for CATEGORY_* system labels and map to our schema\n const categories = labels\n .filter((label) => label.id?.startsWith('CATEGORY_'))\n .map((label) => {\n const id = label.id as string;\n let name = label.name || id;\n let description = '';\n\n // Map known category types to user-friendly names and descriptions\n switch (id) {\n case 'CATEGORY_PERSONAL':\n name = 'Primary';\n description = 'Important emails from people you know';\n break;\n case 'CATEGORY_SOCIAL':\n name = 'Social';\n description = 'Social networks and social websites';\n break;\n case 'CATEGORY_PROMOTIONS':\n name = 'Promotions';\n description = 'Deals, offers, and marketing emails';\n break;\n case 'CATEGORY_UPDATES':\n name = 'Updates';\n description = 'Confirmations, receipts, bills, and statements';\n break;\n case 'CATEGORY_FORUMS':\n name = 'Forums';\n description = 'Online groups, discussion boards, mailing lists';\n break;\n default:\n // For any unknown CATEGORY_* labels, use the label name as-is\n name = label.name || id.replace('CATEGORY_', '');\n description = `Gmail category: ${name}`;\n }\n\n return {\n id,\n name,\n description,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)); // Sort alphabetically by name\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.categories.list results', { categoryCount: categories.length, totalLabels: labels.length });\n logger.info('gmail.categories.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: categories,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.categories.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing categories: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'categories-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["schemas","AuthRequiredBranchSchema","ErrorCode","McpError","google","z","CategorySchema","object","id","string","describe","name","description","inputSchema","successBranchSchema","type","literal","items","array","outputSchema","discriminatedUnion","config","result","handler","_args","extra","logger","info","gmail","version","auth","authContext","started","Date","now","response","users","labels","list","userId","data","categories","filter","label","startsWith","map","replace","sort","a","b","localeCompare","durationMs","categoryCount","length","totalLabels","content","text","JSON","stringify","structuredContent","error","message","Error","String","InternalError","stack","undefined","createTool"],"mappings":"AACA,SAASA,OAAO,QAAQ,sBAAsB;AAE9C,M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,IAAI1D,SAASD,UAAU8D,aAAa,EAAE,CAAC,0BAA0B,EAAEH,SAAS,EAAE;YAClFI,OAAOL,iBAAiBE,QAAQF,MAAMK,KAAK,GAAGC;QAChD;IACF;AACF;AAEA,eAAe,SAASC;IACtB,OAAO;QACLxD,MAAM;QACNU;QACAE;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/categories-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual category items\nconst CategorySchema = z.object({\n id: z.string().describe('Gmail category ID (e.g., CATEGORY_PERSONAL)'),\n name: z.string().describe('Human-readable category name'),\n description: z.string().describe('Description of what emails belong in this category'),\n});\n\n/**\n * Input schema for the categories-list tool (currently empty as this tool takes no parameters).\n */\nexport const inputSchema = z.object({});\n\n// Success branch schema\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(CategorySchema),\n});\n\n// Output schema with auth_required support\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail category labels (CATEGORY_*) with IDs and descriptions.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\n/**\n * Input parameters for the categories-list tool.\n */\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler(_: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.categories.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter for CATEGORY_* system labels and map to our schema\n const categories = labels\n .filter((label) => label.id?.startsWith('CATEGORY_'))\n .map((label) => {\n const id = label.id as string;\n let name = label.name || id;\n let description = '';\n\n // Map known category types to user-friendly names and descriptions\n switch (id) {\n case 'CATEGORY_PERSONAL':\n name = 'Primary';\n description = 'Important emails from people you know';\n break;\n case 'CATEGORY_SOCIAL':\n name = 'Social';\n description = 'Social networks and social websites';\n break;\n case 'CATEGORY_PROMOTIONS':\n name = 'Promotions';\n description = 'Deals, offers, and marketing emails';\n break;\n case 'CATEGORY_UPDATES':\n name = 'Updates';\n description = 'Confirmations, receipts, bills, and statements';\n break;\n case 'CATEGORY_FORUMS':\n name = 'Forums';\n description = 'Online groups, discussion boards, mailing lists';\n break;\n default:\n // For any unknown CATEGORY_* labels, use the label name as-is\n name = label.name || id.replace('CATEGORY_', '');\n description = `Gmail category: ${name}`;\n }\n\n return {\n id,\n name,\n description,\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name)); // Sort alphabetically by name\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.categories.list results', { categoryCount: categories.length, totalLabels: labels.length });\n logger.info('gmail.categories.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: categories,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.categories.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing categories: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'categories-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["schemas","AuthRequiredBranchSchema","ErrorCode","McpError","google","z","CategorySchema","object","id","string","describe","name","description","inputSchema","successBranchSchema","type","literal","items","array","outputSchema","discriminatedUnion","config","result","handler","_","extra","logger","info","gmail","version","auth","authContext","started","Date","now","response","users","labels","list","userId","data","categories","filter","label","startsWith","map","replace","sort","a","b","localeCompare","durationMs","categoryCount","length","totalLabels","content","text","JSON","stringify","structuredContent","error","message","Error","String","InternalError","stack","undefined","createTool"],"mappings":"AACA,SAASA,OAAO,QAAQ,sBAAsB;AAE9C,MAAM,EAAEC,wBAAwB,EAAE,GAAGD;AAGrC,SAASE,SAAS,EAAEC,QAAQ,QAAQ,qCAAqC;AACzE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,CAAC,QAAQ,MAAM;AAExB,uCAAuC;AACvC,MAAMC,iBAAiBD,EAAEE,MAAM,CAAC;IAC9BC,IAAIH,EAAEI,MAAM,GAAGC,QAAQ,CAAC;IACxBC,MAAMN,EAAEI,MAAM,GAAGC,QAAQ,CAAC;IAC1BE,aAAaP,EAAEI,MAAM,GAAGC,QAAQ,CAAC;AACnC;AAEA;;CAEC,GACD,OAAO,MAAMG,cAAcR,EAAEE,MAAM,CAAC,CAAC,GAAG;AAExC,wBAAwB;AACxB,MAAMO,sBAAsBT,EAAEE,MAAM,CAAC;IACnCQ,MAAMV,EAAEW,OAAO,CAAC;IAChBC,OAAOZ,EAAEa,KAAK,CAACZ;AACjB;AAEA,2CAA2C;AAC3C,MAAMa,eAAed,EAAEe,kBAAkB,CAAC,QAAQ;IAACN;IAAqBb;CAAyB;AAEjG,MAAMoB,SAAS;IACbT,aAAa;IACbC,aAAaA;IACbM,cAAcd,EAAEE,MAAM,CAAC;QACrBe,QAAQH;IACV;AACF;AAQA,eAAeI,QAAQC,CAAQ,EAAEC,KAAoB;IACnD,MAAMC,SAASD,MAAMC,MAAM;IAC3BA,OAAOC,IAAI,CAAC;IAEZ,IAAI;QACF,MAAMC,QAAQxB,OAAOwB,KAAK,CAAC;YAAEC,SAAS;YAAMC,MAAML,MAAMM,WAAW,CAACD,IAAI;QAAC;QACzE,MAAME,UAAUC,KAAKC,GAAG;QAExB,kCAAkC;QAClC,MAAMC,WAAW,MAAMP,MAAMQ,KAAK,CAACC,MAAM,CA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qC,mBAAmB;gBAAErC;YAAO;QAC9B;IACF,EAAE,OAAOsC,OAAO;QACd,MAAMC,UAAUD,iBAAiBE,QAAQF,MAAMC,OAAO,GAAGE,OAAOH;QAChElC,OAAOkC,KAAK,CAAC,+BAA+B;YAAEA,OAAOC;QAAQ;QAE7D,MAAM,IAAI1D,SAASD,UAAU8D,aAAa,EAAE,CAAC,0BAA0B,EAAEH,SAAS,EAAE;YAClFI,OAAOL,iBAAiBE,QAAQF,MAAMK,KAAK,GAAGC;QAChD;IACF;AACF;AAEA,eAAe,SAASC;IACtB,OAAO;QACLxD,MAAM;QACNU;QACAE;IACF;AACF"}
@@ -1,6 +1,9 @@
1
1
  import type { EnrichedExtra } from '@mcp-z/oauth-google';
2
2
  import { z } from 'zod';
3
- declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
3
+ /**
4
+ * Input schema for the labels-list tool (currently empty as this tool takes no parameters).
5
+ */
6
+ export declare const inputSchema: z.ZodObject<{}, z.core.$strip>;
4
7
  declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
8
  type: z.ZodLiteral<"success">;
6
9
  items: z.ZodArray<z.ZodObject<{
@@ -22,9 +25,12 @@ declare const outputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
25
  message: z.ZodString;
23
26
  url: z.ZodOptional<z.ZodString>;
24
27
  }, z.core.$strip>], "type">;
28
+ /**
29
+ * Input parameters for the labels-list tool.
30
+ */
25
31
  export type Input = z.infer<typeof inputSchema>;
26
32
  export type Output = z.infer<typeof outputSchema>;
27
- declare function handler(_args: Input, extra: EnrichedExtra): Promise<{
33
+ declare function handler(_: Input, extra: EnrichedExtra): Promise<{
28
34
  content: {
29
35
  type: "text";
30
36
  text: string;
@@ -17,7 +17,9 @@ const LabelSchema = z.object({
17
17
  'labelShowIfUnread'
18
18
  ]).describe('Label visibility in Gmail UI')
19
19
  });
20
- const inputSchema = z.object({});
20
+ /**
21
+ * Input schema for the labels-list tool (currently empty as this tool takes no parameters).
22
+ */ export const inputSchema = z.object({});
21
23
  const successBranchSchema = z.object({
22
24
  type: z.literal('success'),
23
25
  items: z.array(LabelSchema)
@@ -33,7 +35,7 @@ const config = {
33
35
  result: outputSchema
34
36
  })
35
37
  };
36
- async function handler(_args, extra) {
38
+ async function handler(_, extra) {
37
39
  const logger = extra.logger;
38
40
  logger.info('gmail.labels.list called');
39
41
  try {
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/labels-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual label items\nconst LabelSchema = z.object({\n id: z.string().describe('Gmail label ID'),\n name: z.string().describe('Label name for use in queries (case-sensitive)'),\n type: z.enum(['user', 'system']).describe('Whether this is a user-created or system label'),\n visibility: z.enum(['labelShow', 'labelHide', 'labelShowIfUnread']).describe('Label visibility in Gmail UI'),\n});\n\nconst inputSchema = z.object({});\n\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(LabelSchema),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail labels for label: query syntax. Case-sensitive.',\n inputSchema: 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(_args: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.labels.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter out CATEGORY_* labels (handled by categories tool) and map to our schema\n const availableLabels = labels\n .filter((label) => {\n // Exclude CATEGORY_* labels as they're handled by the categories tool\n return !label.id?.startsWith('CATEGORY_');\n })\n .map((label) => {\n const id = label.id as string;\n const name = label.name || id;\n\n // Determine label type\n const type: 'user' | 'system' = label.type === 'user' ? 'user' : 'system';\n\n // Map label visibility\n let visibility: 'labelShow' | 'labelHide' | 'labelShowIfUnread' = 'labelShow';\n if (label.labelListVisibility === 'labelHide') {\n visibility = 'labelHide';\n } else if (label.labelListVisibility === 'labelShowIfUnread') {\n visibility = 'labelShowIfUnread';\n }\n\n return {\n id,\n name,\n type,\n visibility,\n };\n })\n .sort((a, b) => {\n // Sort user labels first, then system labels, both alphabetically\n if (a.type !== b.type) {\n return a.type === 'user' ? -1 : 1;\n }\n // Use simple ASCII comparison for consistent, case-sensitive sorting\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;\n });\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.labels.list results', {\n labelCount: availableLabels.length,\n userLabels: availableLabels.filter((l) => l.type === 'user').length,\n systemLabels: availableLabels.filter((l) => l.type === 'system').length,\n totalLabels: labels.length,\n });\n logger.info('gmail.labels.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: availableLabels,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.labels.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing labels: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'labels-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["schemas","AuthRequiredBranchSchema","ErrorCode","McpError","google","z","LabelSchema","object","id","string","describe","name","type","enum","visibility","inputSchema","successBranchSchema","literal","items","array","outputSchema","discriminatedUnion","config","description","result","handler","_args","extra","logger","info","gmail","version","auth","authContext","started","Date","now","response","users","labels","list","userId","data","availableLabels","filter","label","startsWith","map","labelListVisibility","sort","a","b","durationMs","labelCount","length","userLabels","l","systemLabels","totalLabels","content","text","JSON","stringify","structuredContent","error","message","Error","String","InternalError","stack","undefined","createTool"],"mappings":"AACA,SAASA,OAAO,QAAQ,sBAAsB;AAE9C,MAAM,EAAEC,wBAAwB,EAAE,GAAGD;AAGrC,SAASE,SAAS,EAAEC,QAAQ,QAAQ,qCAAqC;AACzE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,CAAC,QAAQ,MAAM;AAExB,oCAAoC;AACpC,MAAMC,cAAcD,EAAEE,MAAM,CAAC;IAC3BC,IAAIH,EAAEI,MAAM,GAAGC,QAAQ,CAAC;IACxBC,MAAMN,EAAEI,MAAM,GAAGC,QAAQ,CAAC;IAC1BE,MAAMP,EAAEQ,IAAI,CAAC;QAAC;QAAQ;KAAS,EAAEH,QAAQ,CAAC;IAC1CI,YAAYT,EAAEQ,IAAI,CAAC;QAAC;QAAa;QAAa;KAAoB,EAAEH,QAAQ,CAAC;AAC/E;AAEA,MAAMK,cAAcV,EAAEE,MAAM,CAAC,CAAC;AAE9B,MAAMS,sBAAsBX,EAAEE,MAAM,CAAC;IACnCK,MAAMP,EAAEY,OAAO,CAAC;IAChBC,OAAOb,EAAEc,KAAK,CAACb;AACjB;AAEA,MAAMc,eAAef,EAAEgB,kBAAkB,CAAC,QAAQ;IAACL;IAAqBf;CAAyB;AAEjG,MAAMqB,SAAS;IACbC,aAAa;IACbR,aAAaA;IACbK,cAAcf,EAAEE,MAAM,CAAC;QACrBiB,QAAQJ;IACV;AACF;AAKA,eAAeK,QAAQC,KAAY,EAAEC,KAAoB;IACvD,MAAMC,SAASD,MAAMC,MAAM;IAC3BA,OAAOC,IAAI,CAAC;IAEZ,IAAI;QACF,MAAMC,QAAQ1B,OAAO0B,KAAK,CAAC;YAAEC,SAAS;YAAMC,MAAML,MAAM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,IAAMA,EAAE5C,IAAI,KAAK,QAAQ0C,MAAM;YACnEG,cAAcd,gBAAgBC,MAAM,CAAC,CAACY,IAAMA,EAAE5C,IAAI,KAAK,UAAU0C,MAAM;YACvEI,aAAanB,OAAOe,MAAM;QAC5B;QACA1B,OAAOC,IAAI,CAAC,6BAA6B;YAAEuB;QAAW;QAEtD,MAAM5B,SAAiB;YACrBZ,MAAM;YACNM,OAAOyB;QACT;QAEA,OAAO;YACLgB,SAAS;gBACP;oBACE/C,MAAM;oBACNgD,MAAMC,KAAKC,SAAS,CAACtC;gBACvB;aACD;YACDuC,mBAAmB;gBAAEvC;YAAO;QAC9B;IACF,EAAE,OAAOwC,OAAO;QACd,MAAMC,UAAUD,iBAAiBE,QAAQF,MAAMC,OAAO,GAAGE,OAAOH;QAChEpC,OAAOoC,KAAK,CAAC,2BAA2B;YAAEA,OAAOC;QAAQ;QAEzD,MAAM,IAAI9D,SAASD,UAAUkE,aAAa,EAAE,CAAC,sBAAsB,EAAEH,SAAS,EAAE;YAC9EI,OAAOL,iBAAiBE,QAAQF,MAAMK,KAAK,GAAGC;QAChD;IACF;AACF;AAEA,eAAe,SAASC;IACtB,OAAO;QACL5D,MAAM;QACNW;QACAG;IACF;AACF"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/mcp/tools/labels-list.ts"],"sourcesContent":["import type { EnrichedExtra } from '@mcp-z/oauth-google';\nimport { schemas } from '@mcp-z/oauth-google';\n\nconst { AuthRequiredBranchSchema } = schemas;\n\nimport type { ToolModule } from '@mcp-z/server';\nimport { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';\nimport { google } from 'googleapis';\nimport { z } from 'zod';\n\n// Schema for individual label items\nconst LabelSchema = z.object({\n id: z.string().describe('Gmail label ID'),\n name: z.string().describe('Label name for use in queries (case-sensitive)'),\n type: z.enum(['user', 'system']).describe('Whether this is a user-created or system label'),\n visibility: z.enum(['labelShow', 'labelHide', 'labelShowIfUnread']).describe('Label visibility in Gmail UI'),\n});\n\n/**\n * Input schema for the labels-list tool (currently empty as this tool takes no parameters).\n */\nexport const inputSchema = z.object({});\n\nconst successBranchSchema = z.object({\n type: z.literal('success'),\n items: z.array(LabelSchema),\n});\n\nconst outputSchema = z.discriminatedUnion('type', [successBranchSchema, AuthRequiredBranchSchema]);\n\nconst config = {\n description: 'List Gmail labels for label: query syntax. Case-sensitive.',\n inputSchema: inputSchema,\n outputSchema: z.object({\n result: outputSchema,\n }),\n} as const;\n\n/**\n * Input parameters for the labels-list tool.\n */\nexport type Input = z.infer<typeof inputSchema>;\nexport type Output = z.infer<typeof outputSchema>;\n\nasync function handler(_: Input, extra: EnrichedExtra) {\n const logger = extra.logger;\n logger.info('gmail.labels.list called');\n\n try {\n const gmail = google.gmail({ version: 'v1', auth: extra.authContext.auth });\n const started = Date.now();\n\n // Fetch all labels from Gmail API\n const response = await gmail.users.labels.list({ userId: 'me' });\n const labels = response.data.labels || [];\n\n // Filter out CATEGORY_* labels (handled by categories tool) and map to our schema\n const availableLabels = labels\n .filter((label) => {\n // Exclude CATEGORY_* labels as they're handled by the categories tool\n return !label.id?.startsWith('CATEGORY_');\n })\n .map((label) => {\n const id = label.id as string;\n const name = label.name || id;\n\n // Determine label type\n const type: 'user' | 'system' = label.type === 'user' ? 'user' : 'system';\n\n // Map label visibility\n let visibility: 'labelShow' | 'labelHide' | 'labelShowIfUnread' = 'labelShow';\n if (label.labelListVisibility === 'labelHide') {\n visibility = 'labelHide';\n } else if (label.labelListVisibility === 'labelShowIfUnread') {\n visibility = 'labelShowIfUnread';\n }\n\n return {\n id,\n name,\n type,\n visibility,\n };\n })\n .sort((a, b) => {\n // Sort user labels first, then system labels, both alphabetically\n if (a.type !== b.type) {\n return a.type === 'user' ? -1 : 1;\n }\n // Use simple ASCII comparison for consistent, case-sensitive sorting\n return a.name < b.name ? -1 : a.name > b.name ? 1 : 0;\n });\n\n const durationMs = Date.now() - started;\n\n logger.info('gmail.labels.list results', {\n labelCount: availableLabels.length,\n userLabels: availableLabels.filter((l) => l.type === 'user').length,\n systemLabels: availableLabels.filter((l) => l.type === 'system').length,\n totalLabels: labels.length,\n });\n logger.info('gmail.labels.list metrics', { durationMs });\n\n const result: Output = {\n type: 'success' as const,\n items: availableLabels,\n };\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(result),\n },\n ],\n structuredContent: { result },\n };\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n logger.error('gmail.labels.list error', { error: message });\n\n throw new McpError(ErrorCode.InternalError, `Error listing labels: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n });\n }\n}\n\nexport default function createTool() {\n return {\n name: 'labels-list',\n config,\n handler,\n } satisfies ToolModule;\n}\n"],"names":["schemas","AuthRequiredBranchSchema","ErrorCode","McpError","google","z","LabelSchema","object","id","string","describe","name","type","enum","visibility","inputSchema","successBranchSchema","literal","items","array","outputSchema","discriminatedUnion","config","description","result","handler","_","extra","logger","info","gmail","version","auth","authContext","started","Date","now","response","users","labels","list","userId","data","availableLabels","filter","label","startsWith","map","labelListVisibility","sort","a","b","durationMs","labelCount","length","userLabels","l","systemLabels","totalLabels","content","text","JSON","stringify","structuredContent","error","message","Error","String","InternalError","stack","undefined","createTool"],"mappings":"AACA,SAASA,OAAO,QAAQ,sBAAsB;AAE9C,MAAM,EAAEC,wBAAwB,EAAE,GAAGD;AAGrC,SAASE,SAAS,EAAEC,QAAQ,QAAQ,qCAAqC;AACzE,SAASC,MAAM,QAAQ,aAAa;AACpC,SAASC,CAAC,QAAQ,MAAM;AAExB,oCAAoC;AACpC,MAAMC,cAAcD,EAAEE,MAAM,CAAC;IAC3BC,IAAIH,EAAEI,MAAM,GAAGC,QAAQ,CAAC;IACxBC,MAAMN,EAAEI,MAAM,GAAGC,QAAQ,CAAC;IAC1BE,MAAMP,EAAEQ,IAAI,CAAC;QAAC;QAAQ;KAAS,EAAEH,QAAQ,CAAC;IAC1CI,YAAYT,EAAEQ,IAAI,C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S,EAAE;YAC9EI,OAAOL,iBAAiBE,QAAQF,MAAMK,KAAK,GAAGC;QAChD;IACF;AACF;AAEA,eAAe,SAASC;IACtB,OAAO;QACL5D,MAAM;QACNW;QACAG;IACF;AACF"}
@@ -1,5 +1,6 @@
1
1
  export { createConfig, parseConfig } from './config.js';
2
2
  export { createHTTPServer } from './http.js';
3
+ export type { AuthMiddleware, OAuthAdapters, OAuthRuntimeDeps } from './oauth-google.js';
3
4
  export { createOAuthAdapters } from './oauth-google.js';
4
5
  export * from './runtime.js';
5
6
  export { createStdioServer } from './stdio.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/setup/index.ts"],"sourcesContent":["export { createConfig, parseConfig } from './config.ts';\nexport { createHTTPServer } from './http.ts';\nexport { createOAuthAdapters } from './oauth-google.ts';\nexport * from './runtime.ts';\nexport { createStdioServer } from './stdio.ts';\n"],"names":["createConfig","parseConfig","createHTTPServer","createOAuthAdapters","createStdioServer"],"mappings":"AAAA,SAASA,YAAY,EAAEC,WAAW,QAAQ,cAAc;AACxD,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,cAAc,eAAe;AAC7B,SAASC,iBAAiB,QAAQ,aAAa"}
1
+ {"version":3,"sources":["/Users/kevin/Dev/Projects/mcp-z/mcp-gmail/src/setup/index.ts"],"sourcesContent":["export { createConfig, parseConfig } from './config.ts';\nexport { createHTTPServer } from './http.ts';\nexport type { AuthMiddleware, OAuthAdapters, OAuthRuntimeDeps } from './oauth-google.ts';\nexport { createOAuthAdapters } from './oauth-google.ts';\nexport * from './runtime.ts';\nexport { createStdioServer } from './stdio.ts';\n"],"names":["createConfig","parseConfig","createHTTPServer","createOAuthAdapters","createStdioServer"],"mappings":"AAAA,SAASA,YAAY,EAAEC,WAAW,QAAQ,cAAc;AACxD,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,cAAc,eAAe;AAC7B,SAASC,iBAAiB,QAAQ,aAAa"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-z/mcp-gmail",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "MCP server for Gmail integration with OAuth authentication, message search, batch operations, and Google Sheets export",
5
5
  "keywords": [
6
6
  "gmail",
@@ -80,7 +80,7 @@
80
80
  "csv-stringify": "^6.6.0",
81
81
  "express": "^5.0.0",
82
82
  "googleapis": "^169.0.0",
83
- "keyv-registry": "^0.3.0",
83
+ "keyv-registry": "^0.4.0",
84
84
  "module-root-sync": "^2.0.0",
85
85
  "node-html-parser": "^7.0.1",
86
86
  "pino": "^10.0.0",