@mcp-consultant-tools/teams 28.0.0-beta.7 → 28.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Auth CLI Commands - 3 commands mapping to authentication MCP tools
3
+ */
4
+ import type { Command } from 'commander';
5
+ import type { ServiceContext } from '../../context-factory.js';
6
+ export declare function registerAuthCommands(program: Command, ctx: ServiceContext): void;
7
+ //# sourceMappingURL=auth-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAyChF"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Auth CLI Commands - 3 commands mapping to authentication MCP tools
3
+ */
4
+ import { getGlobalFlags, handleCliError } from '@mcp-consultant-tools/core';
5
+ import { outputResult } from '../output.js';
6
+ export function registerAuthCommands(program, ctx) {
7
+ const auth = program.command('auth').description('Authentication operations');
8
+ auth
9
+ .command('login')
10
+ .description('Authenticate to Microsoft Teams (device-code or client-credentials)')
11
+ .action(async () => {
12
+ try {
13
+ const result = await ctx.teams.startAuthentication();
14
+ outputResult({ fileName: 'auth-login', data: result, summary: `Authentication status: ${result.status}` }, getGlobalFlags(program));
15
+ }
16
+ catch (error) {
17
+ handleCliError(error, 'authenticate');
18
+ }
19
+ });
20
+ auth
21
+ .command('status')
22
+ .description('Check current Teams authentication status')
23
+ .action(async () => {
24
+ try {
25
+ const status = ctx.teams.getAuthStatus();
26
+ outputResult({ fileName: 'auth-status', data: status, summary: `Auth status: ${status.status} (${status.authMode}) - ${status.message}` }, getGlobalFlags(program));
27
+ }
28
+ catch (error) {
29
+ handleCliError(error, 'check auth status');
30
+ }
31
+ });
32
+ auth
33
+ .command('logout')
34
+ .description('Clear cached Teams authentication tokens')
35
+ .action(async () => {
36
+ try {
37
+ ctx.teams.logout();
38
+ outputResult({ fileName: 'auth-logout', data: { status: 'logged_out' }, summary: 'Teams authentication cleared.' }, getGlobalFlags(program));
39
+ }
40
+ catch (error) {
41
+ handleCliError(error, 'logout');
42
+ }
43
+ });
44
+ }
45
+ //# sourceMappingURL=auth-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-commands.js","sourceRoot":"","sources":["../../../src/cli/commands/auth-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,oBAAoB,CAAC,OAAgB,EAAE,GAAmB;IACxE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,2BAA2B,CAAC,CAAC;IAE9E,IAAI;SACD,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC;YACrD,YAAY,CACV,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,0BAA0B,MAAM,CAAC,MAAM,EAAE,EAAE,EAC5F,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;QAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEL,IAAI;SACD,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;YACzC,YAAY,CACV,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,QAAQ,OAAO,MAAM,CAAC,OAAO,EAAE,EAAE,EAC5H,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;QAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEL,IAAI;SACD,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,0CAA0C,CAAC;SACvD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YACH,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YACnB,YAAY,CACV,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,+BAA+B,EAAE,EACrG,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CLI Commands barrel export + combined registration
3
+ */
4
+ import type { Command } from 'commander';
5
+ import type { ServiceContext } from '../../context-factory.js';
6
+ export declare function registerAllCommands(program: Command, ctx: ServiceContext): void;
7
+ export { registerAuthCommands } from './auth-commands.js';
8
+ export { registerMessageCommands } from './message-commands.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CAG/E;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * CLI Commands barrel export + combined registration
3
+ */
4
+ import { registerAuthCommands } from './auth-commands.js';
5
+ import { registerMessageCommands } from './message-commands.js';
6
+ export function registerAllCommands(program, ctx) {
7
+ registerAuthCommands(program, ctx);
8
+ registerMessageCommands(program, ctx);
9
+ }
10
+ export { registerAuthCommands } from './auth-commands.js';
11
+ export { registerMessageCommands } from './message-commands.js';
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,UAAU,mBAAmB,CAAC,OAAgB,EAAE,GAAmB;IACvE,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IACnC,uBAAuB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Message CLI Commands - 4 commands mapping to messaging and listing MCP tools
3
+ */
4
+ import type { Command } from 'commander';
5
+ import type { ServiceContext } from '../../context-factory.js';
6
+ export declare function registerMessageCommands(program: Command, ctx: ServiceContext): void;
7
+ //# sourceMappingURL=message-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/message-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAuB/D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,CA6InF"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Message CLI Commands - 4 commands mapping to messaging and listing MCP tools
3
+ */
4
+ import { readFileSync } from 'node:fs';
5
+ import { JSDOM } from 'jsdom';
6
+ import DOMPurify from 'dompurify';
7
+ import { marked } from 'marked';
8
+ import { getGlobalFlags, handleCliError } from '@mcp-consultant-tools/core';
9
+ import { getCardFromTemplate, AVAILABLE_TEMPLATES } from '../../cards/templates.js';
10
+ import { outputResult } from '../output.js';
11
+ /**
12
+ * Convert markdown to sanitized HTML for Teams (mirrors send-message tool logic)
13
+ */
14
+ function markdownToHtml(markdown) {
15
+ const window = new JSDOM('').window;
16
+ const purify = DOMPurify(window);
17
+ const rawHtml = marked.parse(markdown, { async: false });
18
+ return purify.sanitize(rawHtml, {
19
+ ALLOWED_TAGS: [
20
+ 'p', 'br', 'strong', 'b', 'em', 'i', 'u', 's', 'strike',
21
+ 'code', 'pre', 'blockquote', 'ul', 'ol', 'li', 'a',
22
+ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
23
+ 'table', 'thead', 'tbody', 'tr', 'th', 'td',
24
+ ],
25
+ ALLOWED_ATTR: ['href', 'target'],
26
+ });
27
+ }
28
+ export function registerMessageCommands(program, ctx) {
29
+ // ── list-teams ──────────────────────────────────────────────
30
+ program
31
+ .command('list-teams')
32
+ .description('List Microsoft Teams the app/user has access to')
33
+ .action(async () => {
34
+ try {
35
+ const teams = await ctx.teams.listTeams();
36
+ const summary = teams.length === 0
37
+ ? 'No teams found. Ensure the app has Group.Read.All permission and admin consent.'
38
+ : `Found ${teams.length} team(s): ${teams.map(t => t.displayName).join(', ')}`;
39
+ outputResult({ fileName: 'list-teams', data: teams, summary }, getGlobalFlags(program));
40
+ }
41
+ catch (error) {
42
+ handleCliError(error, 'list teams');
43
+ }
44
+ });
45
+ // ── list-channels ───────────────────────────────────────────
46
+ program
47
+ .command('list-channels')
48
+ .description('List channels in a Microsoft Teams team')
49
+ .argument('<teamId>', 'Team ID to list channels for')
50
+ .action(async (teamId) => {
51
+ try {
52
+ const channels = await ctx.teams.listChannels(teamId);
53
+ const summary = channels.length === 0
54
+ ? `No channels found in team ${teamId}.`
55
+ : `Found ${channels.length} channel(s): ${channels.map(c => c.displayName).join(', ')}`;
56
+ outputResult({ fileName: `list-channels-${teamId}`, data: channels, summary }, getGlobalFlags(program));
57
+ }
58
+ catch (error) {
59
+ handleCliError(error, 'list channels');
60
+ }
61
+ });
62
+ // ── send-message ────────────────────────────────────────────
63
+ program
64
+ .command('send-message')
65
+ .description('Send a message to a Microsoft Teams channel')
66
+ .argument('<message>', 'Message content (text or markdown)')
67
+ .option('-t, --team-id <id>', 'Team ID (uses TEAMS_DEFAULT_TEAM_ID if not set)')
68
+ .option('-c, --channel-id <id>', 'Channel ID (uses TEAMS_DEFAULT_CHANNEL_ID if not set)')
69
+ .option('-f, --format <format>', 'Message format: text or markdown', 'markdown')
70
+ .option('-i, --importance <level>', 'Importance: normal, high, or urgent', 'normal')
71
+ .action(async (message, opts) => {
72
+ try {
73
+ let content;
74
+ let contentType;
75
+ if (opts.format === 'markdown') {
76
+ content = markdownToHtml(message);
77
+ contentType = 'html';
78
+ }
79
+ else {
80
+ content = message;
81
+ contentType = 'text';
82
+ }
83
+ const result = await ctx.teams.sendChannelMessage(content, {
84
+ teamId: opts.teamId,
85
+ channelId: opts.channelId,
86
+ contentType,
87
+ importance: opts.importance,
88
+ });
89
+ outputResult({ fileName: 'send-message', data: result, summary: `Message sent. ID: ${result.messageId}` }, getGlobalFlags(program));
90
+ }
91
+ catch (error) {
92
+ handleCliError(error, 'send message');
93
+ }
94
+ });
95
+ // ── send-card ───────────────────────────────────────────────
96
+ const sendCard = program
97
+ .command('send-card')
98
+ .description(`Send an Adaptive Card to a Teams channel. Templates: ${AVAILABLE_TEMPLATES.join(', ')}`)
99
+ .option('-t, --team-id <id>', 'Team ID (uses TEAMS_DEFAULT_TEAM_ID if not set)')
100
+ .option('-c, --channel-id <id>', 'Channel ID (uses TEAMS_DEFAULT_CHANNEL_ID if not set)')
101
+ .option('-i, --importance <level>', 'Importance: normal, high, or urgent', 'normal')
102
+ .option('--card-file <path>', 'Path to Adaptive Card JSON file (raw card mode)')
103
+ .option('--template <name>', `Template name: ${AVAILABLE_TEMPLATES.join(', ')}`)
104
+ .option('--package-name <name>', 'Package name (for template)')
105
+ .option('--version <ver>', 'Version string (for template)')
106
+ .option('--summary <text>', 'Release summary (for template)')
107
+ .option('--date <date>', 'Release date (for template)')
108
+ .option('--release-type <type>', 'Release type, e.g. "Minor Release" (for template)')
109
+ .option('--changes <text>', 'Markdown list of changes (for template)')
110
+ .option('--release-notes-url <url>', 'URL to release notes (for template)')
111
+ .option('--npm-url <url>', 'URL to npm package (for template, auto-generated if not provided)');
112
+ sendCard.action(async (opts) => {
113
+ try {
114
+ let cardToSend;
115
+ if (opts.cardFile) {
116
+ // Raw card from file
117
+ const fileContent = readFileSync(opts.cardFile, 'utf-8');
118
+ cardToSend = JSON.parse(fileContent);
119
+ }
120
+ else if (opts.template) {
121
+ // Template mode - validate required fields
122
+ const requiredFields = ['packageName', 'version', 'summary', 'date', 'releaseType', 'changes'];
123
+ const missing = requiredFields.filter(f => !opts[f]);
124
+ if (missing.length > 0) {
125
+ throw new Error(`Missing required template fields: ${missing.map(f => '--' + f.replace(/[A-Z]/g, (c) => '-' + c.toLowerCase())).join(', ')}\n` +
126
+ `All of --package-name, --version, --summary, --date, --release-type, --changes are required when using --template.`);
127
+ }
128
+ const templateData = {
129
+ packageName: opts.packageName,
130
+ version: opts.version,
131
+ summary: opts.summary,
132
+ date: opts.date,
133
+ releaseType: opts.releaseType,
134
+ changes: opts.changes,
135
+ releaseNotesUrl: opts.releaseNotesUrl,
136
+ npmUrl: opts.npmUrl,
137
+ };
138
+ cardToSend = getCardFromTemplate(opts.template, templateData);
139
+ }
140
+ else {
141
+ throw new Error(`Provide either --card-file (raw Adaptive Card JSON) or --template + template data flags.\n` +
142
+ `Available templates: ${AVAILABLE_TEMPLATES.join(', ')}`);
143
+ }
144
+ const result = await ctx.teams.sendAdaptiveCard(cardToSend, {
145
+ teamId: opts.teamId,
146
+ channelId: opts.channelId,
147
+ importance: opts.importance,
148
+ });
149
+ const templateInfo = opts.template ? ` (template: ${opts.template})` : '';
150
+ outputResult({ fileName: 'send-card', data: result, summary: `Adaptive Card sent${templateInfo}. ID: ${result.messageId}` }, getGlobalFlags(program));
151
+ }
152
+ catch (error) {
153
+ handleCliError(error, 'send adaptive card');
154
+ }
155
+ });
156
+ }
157
+ //# sourceMappingURL=message-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-commands.js","sourceRoot":"","sources":["../../../src/cli/commands/message-commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5E,OAAO,EAAE,mBAAmB,EAAE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E,IAAI,CAAC,SAAS;gBACzB,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,CAAC,CAAC;YAEH,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1E,YAAY,CACV,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,YAAY,SAAS,MAAM,CAAC,SAAS,EAAE,EAAE,EAC9G,cAAc,CAAC,OAAO,CAAC,CACxB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAC,cAAc,CAAC,KAAK,EAAE,oBAAoB,CAAC,CAAC;QAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * CLI output helper for teams package.
3
+ * Thin wrapper setting the package-specific cache directory.
4
+ */
5
+ import { type GlobalFlags } from '@mcp-consultant-tools/core';
6
+ export declare function outputResult(opts: {
7
+ fileName: string;
8
+ data: unknown;
9
+ summary: string;
10
+ }, flags: GlobalFlags): void;
11
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoC,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIhG,wBAAgB,YAAY,CAC1B,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAC1D,KAAK,EAAE,WAAW,GACjB,IAAI,CAEN"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CLI output helper for teams package.
3
+ * Thin wrapper setting the package-specific cache directory.
4
+ */
5
+ import { outputResult as coreOutputResult } from '@mcp-consultant-tools/core';
6
+ const CACHE_DIR = '.mcp-teams-cache';
7
+ export function outputResult(opts, flags) {
8
+ coreOutputResult({ ...opts, cacheDir: CACHE_DIR }, flags);
9
+ }
10
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/cli/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAoB,MAAM,4BAA4B,CAAC;AAEhG,MAAM,SAAS,GAAG,kBAAkB,CAAC;AAErC,MAAM,UAAU,YAAY,CAC1B,IAA0D,EAC1D,KAAkB;IAElB,gBAAgB,CAAC,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC"}
package/build/cli.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @mcp-consultant-tools/teams CLI
4
+ *
5
+ * Command-line interface for Microsoft Teams operations.
6
+ * Reuses the same ServiceContext and services as the MCP server.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
package/build/cli.js ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @mcp-consultant-tools/teams CLI
4
+ *
5
+ * Command-line interface for Microsoft Teams operations.
6
+ * Reuses the same ServiceContext and services as the MCP server.
7
+ */
8
+ import { createCliProgram, loadEnvForCli } from '@mcp-consultant-tools/core';
9
+ import { createServiceContext } from './context-factory.js';
10
+ import { registerAllCommands } from './cli/commands/index.js';
11
+ const program = createCliProgram({
12
+ name: 'mcp-teams-cli',
13
+ description: 'Microsoft Teams CLI - send messages, adaptive cards, list teams and channels',
14
+ version: '27.0.0',
15
+ });
16
+ // Load env before parsing (--env-file handled by commander hook)
17
+ program.hook('preAction', (thisCommand) => {
18
+ const opts = thisCommand.opts();
19
+ loadEnvForCli(opts.envFile);
20
+ });
21
+ const ctx = createServiceContext();
22
+ registerAllCommands(program, ctx);
23
+ program.parseAsync(process.argv).catch((error) => {
24
+ console.error('CLI error:', error.message);
25
+ process.exit(1);
26
+ });
27
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,MAAM,OAAO,GAAG,gBAAgB,CAAC;IAC/B,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,8EAA8E;IAC3F,OAAO,EAAE,QAAQ;CAClB,CAAC,CAAC;AAEH,iEAAiE;AACjE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,WAAgB,EAAE,EAAE;IAC7C,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IAChC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEH,MAAM,GAAG,GAAG,oBAAoB,EAAE,CAAC;AACnC,mBAAmB,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAElC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;IACpD,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ServiceContext } from './types.js';
2
+ export type { ServiceContext } from './types.js';
3
+ export declare function createServiceContext(): ServiceContext;
4
+ //# sourceMappingURL=context-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-factory.d.ts","sourceRoot":"","sources":["../src/context-factory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,oBAAoB,IAAI,cAAc,CA8CrD"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Shared service context factory - used by both MCP server and CLI.
3
+ */
4
+ import { TeamsService } from './services/teams-service.js';
5
+ export function createServiceContext() {
6
+ let service = null;
7
+ function getService() {
8
+ if (!service) {
9
+ const authMode = process.env.TEAMS_AUTH_MODE === 'client-credentials'
10
+ ? 'client-credentials'
11
+ : 'device-code';
12
+ const clientId = process.env.TEAMS_CLIENT_ID;
13
+ const tenantId = process.env.TEAMS_TENANT_ID;
14
+ if (!clientId) {
15
+ throw new Error('TEAMS_CLIENT_ID is required. Register an Azure AD app and set this variable.');
16
+ }
17
+ if (!tenantId) {
18
+ throw new Error('TEAMS_TENANT_ID is required. Set it to your Azure AD tenant ID.');
19
+ }
20
+ if (authMode === 'client-credentials' && !process.env.TEAMS_CLIENT_SECRET) {
21
+ throw new Error('TEAMS_CLIENT_SECRET is required for client-credentials auth mode.');
22
+ }
23
+ const config = {
24
+ authMode,
25
+ tenantId,
26
+ clientId,
27
+ clientSecret: process.env.TEAMS_CLIENT_SECRET,
28
+ defaultTeamId: process.env.TEAMS_DEFAULT_TEAM_ID,
29
+ defaultChannelId: process.env.TEAMS_DEFAULT_CHANNEL_ID,
30
+ };
31
+ service = new TeamsService(config);
32
+ console.error(`Teams service initialized (${authMode} mode)`);
33
+ }
34
+ return service;
35
+ }
36
+ return {
37
+ get teams() { return getService(); },
38
+ };
39
+ }
40
+ //# sourceMappingURL=context-factory.js.map
@@ -0,0 +1 @@
1
+ {"version":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;IACjB,CAAC;IAED,OAAO;QACL,IAAI,KAAK,KAAK,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC;KACrC,CAAC;AACJ,CAAC"}
@@ -21,8 +21,8 @@ export declare const sendCardSchema: {
21
21
  releaseNotesUrl: z.ZodOptional<z.ZodString>;
22
22
  npmUrl: z.ZodOptional<z.ZodString>;
23
23
  }, "strip", z.ZodTypeAny, {
24
- packageName: string;
25
24
  version: string;
25
+ packageName: string;
26
26
  summary: string;
27
27
  date: string;
28
28
  releaseType: string;
@@ -30,8 +30,8 @@ export declare const sendCardSchema: {
30
30
  releaseNotesUrl?: string | undefined;
31
31
  npmUrl?: string | undefined;
32
32
  }, {
33
- packageName: string;
34
33
  version: string;
34
+ packageName: string;
35
35
  summary: string;
36
36
  date: string;
37
37
  releaseType: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-consultant-tools/teams",
3
- "version": "28.0.0-beta.7",
3
+ "version": "28.0.0",
4
4
  "description": "MCP server for Microsoft Teams integration - send messages and adaptive cards to channels",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -41,8 +41,9 @@
41
41
  "dependencies": {
42
42
  "@azure/msal-node": "^2.16.2",
43
43
  "@microsoft/microsoft-graph-client": "^3.0.7",
44
- "@mcp-consultant-tools/core": "28.0.0-beta.7",
44
+ "@mcp-consultant-tools/core": "28.0.0",
45
45
  "@modelcontextprotocol/sdk": "^1.0.4",
46
+ "commander": "^14.0.3",
46
47
  "dompurify": "^3.2.3",
47
48
  "jsdom": "^26.0.0",
48
49
  "marked": "^17.0.0",
@@ -55,6 +56,7 @@
55
56
  "typescript": "^5.8.2"
56
57
  },
57
58
  "bin": {
58
- "mcp-teams": "build/index.js"
59
+ "mcp-teams": "build/index.js",
60
+ "mcp-teams-cli": "build/cli.js"
59
61
  }
60
62
  }