UNPKG

msteams-mcp-server

Version:

Microsoft Teams MCP Server - Complete Teams integration for Claude Desktop and MCP clients with secure OAuth2 authentication and comprehensive team management

492 lines (491 loc) 13.5 kB
export interface Team { id: string; displayName: string; description?: string; visibility: 'Private' | 'Public'; webUrl: string; createdDateTime: string; memberSettings?: any; guestSettings?: any; messagingSettings?: any; funSettings?: any; } export interface Channel { id: string; displayName: string; description?: string; webUrl: string; membershipType: 'standard' | 'private' | 'shared'; createdDateTime: string; } export interface ChatMessage { id: string; messageType: 'message' | 'chatEvent' | 'typing'; createdDateTime: string; lastModifiedDateTime: string; body: { content: string; contentType: 'text' | 'html'; }; from: { user?: { id: string; displayName: string; userPrincipalName: string; }; application?: { id: string; displayName: string; }; }; attachments?: any[]; mentions?: any[]; reactions?: any[]; } export interface TeamMember { id: string; displayName: string; email: string; roles: string[]; visibleHistoryStartDateTime?: string; } export interface CreateTeamRequest { displayName: string; description?: string; visibility: 'Private' | 'Public'; template?: string; members?: string[]; owners?: string[]; } export interface CreateChannelRequest { displayName: string; description?: string; membershipType?: 'standard' | 'private'; } export interface MessageMention { id: string; displayName?: string; } export interface SendMessageRequest { content: string; contentType?: 'text' | 'html'; attachments?: any[]; mentions?: MessageMention[]; } export interface Chat { id: string; topic?: string; createdDateTime: string; lastUpdatedDateTime: string; chatType: 'oneOnOne' | 'group' | 'meeting'; members: ChatMember[]; } export interface ChatMember { id: string; displayName: string; email: string; roles: string[]; } export interface SendChatMessageRequest { content: string; contentType?: 'text' | 'html'; mentions?: MessageMention[]; } export interface MessageReaction { reactionType: string; user: { id: string; displayName: string; }; createdDateTime: string; } export interface ReactionRequest { reactionType: string; } export interface SearchTeamsOptions { query?: string; visibility?: 'Private' | 'Public'; maxResults?: number; } export interface SearchChannelsOptions { teamId: string; query?: string; membershipType?: 'standard' | 'private' | 'shared'; maxResults?: number; } export interface SearchMessagesOptions { teamId: string; channelId: string; query?: string; fromDate?: string; toDate?: string; maxResults?: number; } export interface DriveItem { id: string; name: string; size: number; createdDateTime: string; lastModifiedDateTime: string; downloadUrl?: string; webUrl: string; folder?: any; file?: { mimeType: string; hashes?: any; }; createdBy: { user: { displayName: string; id: string; }; }; } export interface UploadFileRequest { fileName: string; fileContent: Buffer | string; mimeType?: string; description?: string; } export interface MessageReply { id: string; messageType: 'message' | 'chatEvent'; createdDateTime: string; lastModifiedDateTime: string; body: { content: string; contentType: 'text' | 'html'; }; from: { user?: { id: string; displayName: string; userPrincipalName: string; }; }; replyToId?: string; } export interface GroupChat { id: string; topic?: string; createdDateTime: string; lastUpdatedDateTime: string; chatType: 'group'; members: ChatMember[]; webUrl?: string; } export interface CreateGroupChatRequest { topic?: string; members: string[]; } export interface OnlineMeeting { id: string; subject: string; startDateTime: string; endDateTime: string; joinWebUrl: string; organizer: { identity: { user: { id: string; displayName: string; }; }; }; participants?: { attendees: Array<{ identity: { user: { id: string; displayName: string; email: string; }; }; }>; }; isRecordingEnabled?: boolean; allowMeetingChat?: boolean; allowTeamworkReactions?: boolean; } export interface CreateMeetingRequest { subject: string; startDateTime: string; endDateTime: string; attendees?: string[]; content?: string; isOnlineMeeting?: boolean; allowNewTimeProposals?: boolean; isRecordingEnabled?: boolean; } export interface UserPresence { id: string; availability: 'Available' | 'AvailableIdle' | 'Away' | 'BeRightBack' | 'Busy' | 'BusyIdle' | 'DoNotDisturb' | 'Offline' | 'PresenceUnknown'; activity: 'Available' | 'Away' | 'BeRightBack' | 'Busy' | 'DoNotDisturb' | 'InACall' | 'InAConferenceCall' | 'Inactive' | 'InAMeeting' | 'Offline' | 'OffWork' | 'OutOfOffice' | 'PresenceUnknown' | 'Presenting' | 'UrgentInterruptionsOnly'; statusMessage?: { message: { content: string; contentType: 'text' | 'html'; }; expiryDateTime?: string; }; } export interface SetPresenceRequest { availability: 'Available' | 'Busy' | 'DoNotDisturb' | 'BeRightBack' | 'Away'; activity: 'Available' | 'Busy' | 'DoNotDisturb' | 'BeRightBack' | 'Away' | 'InAMeeting' | 'InACall'; expirationDuration?: string; } export interface CalendarEvent { id: string; subject: string; start: { dateTime: string; timeZone: string; }; end: { dateTime: string; timeZone: string; }; location?: { displayName: string; }; organizer: { emailAddress: { name: string; address: string; }; }; attendees?: Array<{ emailAddress: { name: string; address: string; }; status: { response: string; time: string; }; }>; isOnlineMeeting?: boolean; onlineMeeting?: { joinUrl: string; }; } /** * Microsoft Teams operations using Microsoft Graph API */ export declare class TeamsOperations { private graphClient; constructor(); /** * Initialize Graph client with authentication */ private ensureGraphClient; /** * Get all teams the user is a member of */ getUserTeams(maxResults?: number): Promise<Team[]>; /** * Search for teams */ searchTeams(options?: SearchTeamsOptions): Promise<Team[]>; /** * Get a specific team by ID */ getTeam(teamId: string): Promise<Team>; /** * Create a new team */ createTeam(request: CreateTeamRequest): Promise<Team>; /** * Get channels for a team */ getTeamChannels(teamId: string): Promise<Channel[]>; /** * Search channels in a team */ searchChannels(options: SearchChannelsOptions): Promise<Channel[]>; /** * Create a new channel in a team */ createChannel(teamId: string, request: CreateChannelRequest): Promise<Channel>; /** * Send a message to a channel */ sendChannelMessage(teamId: string, channelId: string, request: SendMessageRequest): Promise<ChatMessage>; /** * Get messages from a channel */ getChannelMessages(teamId: string, channelId: string, options?: { maxResults?: number; }): Promise<ChatMessage[]>; /** * Search messages in a channel */ searchChannelMessages(options: SearchMessagesOptions): Promise<ChatMessage[]>; /** * Get team members */ getTeamMembers(teamId: string): Promise<TeamMember[]>; /** * Add a member to a team */ addTeamMember(teamId: string, userId: string, roles?: string[]): Promise<void>; /** * Remove a member from a team */ removeTeamMember(teamId: string, memberId: string): Promise<void>; /** * Get current user information */ getCurrentUser(): Promise<{ id: string; displayName: string; email: string; }>; /** * Search for users in the organization */ searchUsers(query: string, maxResults?: number): Promise<{ id: string; displayName: string; email: string; }[]>; /** * Get or create a chat with a specific user */ getOrCreateChatWithUser(userId: string): Promise<Chat>; /** * Send a direct message to a user */ sendDirectMessage(userId: string, request: SendChatMessageRequest): Promise<ChatMessage>; /** * Get direct messages from a chat */ getDirectMessages(userId: string, options?: { maxResults?: number; }): Promise<ChatMessage[]>; /** * Add a reaction to a channel message */ addMessageReaction(teamId: string, channelId: string, messageId: string, reactionType: string): Promise<void>; /** * Remove a reaction from a channel message */ removeMessageReaction(teamId: string, channelId: string, messageId: string, reactionType: string): Promise<void>; /** * Add a reaction to a chat message (direct message) */ addChatMessageReaction(chatId: string, messageId: string, reactionType: string): Promise<void>; /** * Remove a reaction from a chat message */ removeChatMessageReaction(chatId: string, messageId: string, reactionType: string): Promise<void>; /** * Upload a file to a team's SharePoint drive */ uploadFileToTeam(teamId: string, request: UploadFileRequest): Promise<DriveItem>; /** * Upload a file to a channel's files tab */ uploadFileToChannel(teamId: string, channelId: string, request: UploadFileRequest): Promise<DriveItem>; /** * List files in a team's drive */ getTeamFiles(teamId: string, maxResults?: number): Promise<DriveItem[]>; /** * List files in a channel's files tab */ getChannelFiles(teamId: string, channelId: string, maxResults?: number): Promise<DriveItem[]>; /** * Download a file from a team's drive */ downloadFile(driveId: string, itemId: string): Promise<{ fileName: string; content: Buffer; mimeType: string; }>; /** * Reply to a message in a channel */ replyToChannelMessage(teamId: string, channelId: string, messageId: string, content: string, contentType?: 'text' | 'html'): Promise<MessageReply>; /** * Get replies to a message in a channel */ getChannelMessageReplies(teamId: string, channelId: string, messageId: string, maxResults?: number): Promise<MessageReply[]>; /** * Reply to a message in a chat (direct message) */ replyToChatMessage(chatId: string, messageId: string, content: string, contentType?: 'text' | 'html'): Promise<MessageReply>; /** * Get replies to a message in a chat */ getChatMessageReplies(chatId: string, messageId: string, maxResults?: number): Promise<MessageReply[]>; /** * Create a group chat */ createGroupChat(request: CreateGroupChatRequest): Promise<GroupChat>; /** * Get all group chats for the current user */ getGroupChats(maxResults?: number): Promise<GroupChat[]>; /** * Get members of a group chat */ getGroupChatMembers(chatId: string): Promise<ChatMember[]>; /** * Add members to a group chat */ addGroupChatMembers(chatId: string, userIds: string[]): Promise<void>; /** * Remove a member from a group chat */ removeGroupChatMember(chatId: string, membershipId: string): Promise<void>; /** * Create an online meeting */ createOnlineMeeting(request: CreateMeetingRequest): Promise<OnlineMeeting>; /** * Get user's online meetings */ getOnlineMeetings(maxResults?: number): Promise<OnlineMeeting[]>; /** * Get calendar events */ getCalendarEvents(startTime?: string, endTime?: string, maxResults?: number): Promise<CalendarEvent[]>; /** * Get user presence */ getUserPresence(userId?: string): Promise<UserPresence>; /** * Set user presence */ setUserPresence(request: SetPresenceRequest): Promise<void>; /** * Get presence for multiple users */ getBulkPresence(userIds: string[]): Promise<UserPresence[]>; /** * Get access token directly */ private getAccessToken; /** * Make direct HTTP request to Graph API */ private makeDirectGraphRequest; /** * Make direct HTTP POST request to Graph API */ private makeDirectGraphPostRequest; /** * Make direct HTTP DELETE request to Graph API */ private makeDirectGraphDeleteRequest; /** * Make direct HTTP PUT request to Graph API */ private makeDirectGraphPutRequest; /** * Reset the Graph client (useful for re-authentication) */ resetClient(): void; } export declare const teamsOperations: TeamsOperations;