Skip to main content
Glama

swit-oauth-start

Initiate OAuth authentication to access Swit workspaces, channels, and messages by generating a secure URL for browser-based login.

Instructions

Start OAuth authentication. Returns authentication URL that can be opened in browser.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handleOAuthStart function implements the core logic of the 'swit-oauth-start' tool, handling OAuth initialization checks and returning the authorization URL with instructions.
    export const handleOAuthStart = async (oauthWebServer: OAuthWebServer | null) => { if (!oauthWebServer) { return { error: 'OAuth web server is not initialized. Please check SWIT_CLIENT_ID and SWIT_CLIENT_SECRET environment variables.', }; } if (oauthWebServer.isAuthenticated()) { return { error: 'OAuth authentication already completed.', note: 'To re-authenticate, please logout first.', }; } const authUrl = oauthWebServer.getAuthorizationUrl(); const port = process.env.OAUTH_PORT || '3000'; return { authorizationUrl: authUrl, webServerUrl: `http://localhost:${port}`, instructions: [ '1. Open the authorizationUrl above in your browser.', '2. Login with your Swit account and authorize the application.', '3. The token will be automatically saved upon completion.', '4. Use swit-oauth-status to check authentication status.', ], }; };
  • Schema definition for the 'swit-oauth-start' tool, specifying name, description, and empty input schema.
    { name: 'swit-oauth-start', description: 'Start OAuth authentication. Returns authentication URL that can be opened in browser.', inputSchema: zodToJsonSchema(EmptySchema), },
  • Factory function oauthHandlers that maps 'swit-oauth-start' to the handleOAuthStart execution wrapper.
    export const oauthHandlers = (oauthWebServer: OAuthWebServer | null) => ({ 'swit-oauth-status': () => handleOAuthStatus(oauthWebServer), 'swit-oauth-start': () => handleOAuthStart(oauthWebServer), 'swit-oauth-logout': () => handleOAuthLogout(oauthWebServer), });
  • src/index.ts:109-109 (registration)
    Top-level integration of oauthHandlers into the global toolHandlers map used by the MCP CallToolRequest handler.
    toolHandlers = { ...oauthHandlers(oauthWebServer), ...coreHandlers(switClient) };
  • src/index.ts:61-63 (registration)
    MCP server request handler for listing tools, which includes the schema definitions from oauthTools containing 'swit-oauth-start'.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...oauthTools, ...coreTools] }; });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TykanN/swit-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server