auth_status
Verify user authentication status and retrieve basic profile information through the Microsoft Graph connection, ensuring secure access to Teams MCP server resources.
Instructions
Check the authentication status of the Microsoft Graph connection. Returns whether the user is authenticated and shows their basic profile information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/auth.ts:10-22 (handler)Handler function for the 'auth_status' tool. Calls graphService.getAuthStatus() and returns formatted text content indicating authentication status and user details.async () => { const status = await graphService.getAuthStatus(); return { content: [ { type: "text", text: status.isAuthenticated ? `✅ Authenticated as ${status.displayName || "Unknown User"} (${status.userPrincipalName || "No email available"})` : "❌ Not authenticated. Please run: npx @floriscornel/teams-mcp@latest authenticate", }, ], }; }
- src/services/graph.ts:6-11 (schema)TypeScript interface defining the AuthStatus object used by the tool's handler and graphService.getAuthStatus().export interface AuthStatus { isAuthenticated: boolean; userPrincipalName?: string | undefined; displayName?: string | undefined; expiresAt?: string | undefined; }
- src/tools/auth.ts:6-23 (registration)Registers the 'auth_status' tool on the MCP server with name, description, empty input schema {}, and inline handler.server.tool( "auth_status", "Check the authentication status of the Microsoft Graph connection. Returns whether the user is authenticated and shows their basic profile information.", {}, async () => { const status = await graphService.getAuthStatus(); return { content: [ { type: "text", text: status.isAuthenticated ? `✅ Authenticated as ${status.displayName || "Unknown User"} (${status.userPrincipalName || "No email available"})` : "❌ Not authenticated. Please run: npx @floriscornel/teams-mcp@latest authenticate", }, ], }; } );
- src/services/graph.ts:73-92 (helper)GraphService.getAuthStatus() method: initializes the Graph client if needed, fetches current user info via /me endpoint, handles errors, and returns AuthStatus.async getAuthStatus(): Promise<AuthStatus> { await this.initializeClient(); if (!this.client) { return { isAuthenticated: false }; } try { const me = await this.client.api("/me").get(); return { isAuthenticated: true, userPrincipalName: me?.userPrincipalName ?? undefined, displayName: me?.displayName ?? undefined, expiresAt: this.authInfo?.expiresAt, }; } catch (error) { console.error("Error getting user info:", error); return { isAuthenticated: false }; } }
- src/index.ts:132-132 (registration)Top-level call to registerAuthTools during MCP server startup, passing the server instance and GraphService singleton.registerAuthTools(server, graphService);