@mcp-consultant-tools/teams 1.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.
package/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # @mcp-consultant-tools/teams
2
+
3
+ MCP server for Microsoft Teams integration. Send messages and adaptive cards to Teams channels for release announcements.
4
+
5
+ ## Features
6
+
7
+ - Send text and markdown messages to Teams channels
8
+ - Send Adaptive Cards with pre-built templates
9
+ - Templates for release announcements, beta releases, and hotfixes
10
+ - Client Credentials authentication (no user interaction required)
11
+ - Token caching with automatic refresh
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @mcp-consultant-tools/teams
17
+ ```
18
+
19
+ Or use directly with npx:
20
+
21
+ ```bash
22
+ npx @mcp-consultant-tools/teams
23
+ ```
24
+
25
+ ## Configuration
26
+
27
+ ### Environment Variables
28
+
29
+ ```bash
30
+ # Required - Azure AD App Registration
31
+ TEAMS_TENANT_ID=your-azure-tenant-id
32
+ TEAMS_CLIENT_ID=your-app-client-id
33
+ TEAMS_CLIENT_SECRET=your-client-secret
34
+
35
+ # Optional - Default targets
36
+ TEAMS_DEFAULT_TEAM_ID=team-guid
37
+ TEAMS_DEFAULT_CHANNEL_ID=channel-guid
38
+ ```
39
+
40
+ ### Claude Desktop Configuration
41
+
42
+ Add to your `claude_desktop_config.json`:
43
+
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "teams": {
48
+ "command": "npx",
49
+ "args": ["-y", "@mcp-consultant-tools/teams@latest"],
50
+ "env": {
51
+ "TEAMS_TENANT_ID": "your-tenant-id",
52
+ "TEAMS_CLIENT_ID": "your-client-id",
53
+ "TEAMS_CLIENT_SECRET": "your-client-secret",
54
+ "TEAMS_DEFAULT_TEAM_ID": "optional-team-id",
55
+ "TEAMS_DEFAULT_CHANNEL_ID": "optional-channel-id"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ ## Azure AD Setup
63
+
64
+ ### Required Permissions
65
+
66
+ Create an Azure AD App Registration with these **Application permissions** (not Delegated):
67
+
68
+ | Permission | Purpose |
69
+ |------------|---------|
70
+ | `ChannelMessage.Send` | Send messages to channels |
71
+ | `Group.Read.All` | List teams and channels |
72
+ | `Team.ReadBasic.All` | Read team information |
73
+
74
+ **Important:** Admin consent is required for these permissions.
75
+
76
+ ### Setup Steps
77
+
78
+ 1. Go to [Azure Portal](https://portal.azure.com) → Azure Active Directory
79
+ 2. App registrations → New registration
80
+ 3. Name: "MCP Teams Release Bot"
81
+ 4. Supported account types: Single tenant
82
+ 5. API permissions → Add Application permissions (NOT delegated)
83
+ 6. Grant admin consent for your organization
84
+ 7. Certificates & secrets → Create new client secret
85
+ 8. Copy the secret value immediately
86
+
87
+ ## Tools
88
+
89
+ ### send-channel-message
90
+
91
+ Send a text or markdown message to a Teams channel.
92
+
93
+ ```
94
+ Message: "Hello from Claude!"
95
+ Format: markdown
96
+ Importance: normal
97
+ ```
98
+
99
+ ### send-adaptive-card
100
+
101
+ Send an Adaptive Card using templates or raw JSON.
102
+
103
+ **Available Templates:**
104
+ - `release-announcement` - Standard release notification
105
+ - `beta-release` - Beta release with warning styling
106
+ - `hotfix` - Urgent hotfix notification
107
+
108
+ Example with template:
109
+ ```json
110
+ {
111
+ "template": "release-announcement",
112
+ "templateData": {
113
+ "packageName": "@mcp-consultant-tools/azure-devops",
114
+ "version": "27.0.0",
115
+ "summary": "New work item sync tools for efficient editing",
116
+ "date": "2025-01-16",
117
+ "releaseType": "Minor Release",
118
+ "changes": "- Added sync-work-item-to-file\n- Added sync-work-item-from-file",
119
+ "releaseNotesUrl": "https://github.com/..."
120
+ }
121
+ }
122
+ ```
123
+
124
+ ### list-teams
125
+
126
+ List Microsoft Teams the app has access to.
127
+
128
+ ### list-channels
129
+
130
+ List channels in a team to find channel IDs for messaging.
131
+
132
+ ## License
133
+
134
+ MIT
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Teams Service - Microsoft Graph API client for Teams operations
3
+ *
4
+ * Supports two authentication modes:
5
+ * - Client Credentials (app-only) - for automation, requires client secret
6
+ * - Device Code (user auth) - for interactive use, authenticates via browser
7
+ *
8
+ * For device-code mode, use the authenticate() method first, which returns
9
+ * the URL and code for the user to complete authentication.
10
+ */
11
+ import type { TeamsConfig, AdaptiveCard, TeamInfo, ChannelInfo, SendMessageResult, MessageImportance, AuthStatusResponse, DeviceCodeResponse, AuthResult } from "./types.js";
12
+ export declare class TeamsService {
13
+ private config;
14
+ private msalConfidentialClient;
15
+ private msalPublicClient;
16
+ private graphClient;
17
+ private accessToken;
18
+ private tokenExpirationTime;
19
+ private pendingAuth;
20
+ constructor(config: TeamsConfig);
21
+ /**
22
+ * Load stored token from disk (device-code mode)
23
+ */
24
+ private loadStoredToken;
25
+ /**
26
+ * Save token to disk (device-code mode)
27
+ */
28
+ private saveToken;
29
+ /**
30
+ * Get access token - handles both auth modes
31
+ */
32
+ private getAccessToken;
33
+ /**
34
+ * Get token using client credentials flow
35
+ */
36
+ private getTokenClientCredentials;
37
+ /**
38
+ * Get token using device code flow
39
+ * This method checks for existing/cached tokens or waits for pending auth.
40
+ * It does NOT start a new auth flow - use startAuthentication() for that.
41
+ */
42
+ private getTokenDeviceCode;
43
+ /**
44
+ * Check if authenticated (device-code mode)
45
+ */
46
+ isAuthenticated(): boolean;
47
+ /**
48
+ * Get current authentication status
49
+ */
50
+ getAuthStatus(): AuthStatusResponse;
51
+ /**
52
+ * Start device-code authentication flow
53
+ * Returns immediately with the URL and code for the user
54
+ * Polls in background and resolves when complete
55
+ */
56
+ startAuthentication(): Promise<DeviceCodeResponse | AuthResult>;
57
+ /**
58
+ * Wait for pending authentication to complete
59
+ * @param timeoutMs Maximum time to wait (default 5 minutes)
60
+ */
61
+ waitForAuthentication(timeoutMs?: number): Promise<AuthResult>;
62
+ /**
63
+ * Require authentication before proceeding
64
+ * Throws a helpful error if not authenticated
65
+ */
66
+ requireAuth(): void;
67
+ /**
68
+ * Clear stored authentication (device-code mode)
69
+ */
70
+ logout(): void;
71
+ /**
72
+ * Get or create Graph client with current access token
73
+ */
74
+ private getGraphClient;
75
+ /**
76
+ * Get the effective team ID (from parameter or default)
77
+ */
78
+ private getTeamId;
79
+ /**
80
+ * Get the effective channel ID (from parameter or default)
81
+ */
82
+ private getChannelId;
83
+ /**
84
+ * List teams the user/app has access to
85
+ */
86
+ listTeams(): Promise<TeamInfo[]>;
87
+ /**
88
+ * List channels in a team
89
+ */
90
+ listChannels(teamId?: string): Promise<ChannelInfo[]>;
91
+ /**
92
+ * Send a text or HTML message to a channel
93
+ */
94
+ sendChannelMessage(content: string, options?: {
95
+ teamId?: string;
96
+ channelId?: string;
97
+ contentType?: "text" | "html";
98
+ importance?: MessageImportance;
99
+ }): Promise<SendMessageResult>;
100
+ /**
101
+ * Send an Adaptive Card to a channel
102
+ */
103
+ sendAdaptiveCard(card: AdaptiveCard, options?: {
104
+ teamId?: string;
105
+ channelId?: string;
106
+ importance?: MessageImportance;
107
+ }): Promise<SendMessageResult>;
108
+ }
109
+ export type { TeamsConfig };
110
+ //# sourceMappingURL=TeamsService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TeamsService.d.ts","sourceRoot":"","sources":["../src/TeamsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EAEjB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACX,MAAM,YAAY,CAAC;AAoBpB,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,sBAAsB,CAA8C;IAC5E,OAAO,CAAC,gBAAgB,CAAwC;IAChE,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,WAAW,CAA4B;gBAEnC,MAAM,EAAE,WA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