Skip to main content
Glama

swit-oauth-start

Initiate OAuth authentication to access Swit collaboration tools by generating a browser-ready authentication URL.

Instructions

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that implements the logic for the 'swit-oauth-start' tool. It checks if OAuth is initialized and not already authenticated, then generates an authorization URL, web server URL, and provides step-by-step 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.', ], }; };
  • Defines the tool schema including name, description, and empty input schema (no parameters required).
    { name: 'swit-oauth-start', description: 'Start OAuth authentication. Returns authentication URL that can be opened in browser.', inputSchema: zodToJsonSchema(EmptySchema), },
  • Registers the 'swit-oauth-start' tool handler by mapping the tool name to the handleOAuthStart function.
    export const oauthHandlers = (oauthWebServer: OAuthWebServer | null) => ({ 'swit-oauth-status': () => handleOAuthStatus(oauthWebServer), 'swit-oauth-start': () => handleOAuthStart(oauthWebServer), 'swit-oauth-logout': () => handleOAuthLogout(oauthWebServer), });
  • src/index.ts:61-63 (registration)
    Registers the tool list handler which includes 'swit-oauth-start' from oauthTools for the MCP ListTools request.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [...oauthTools, ...coreTools] }; });
  • src/index.ts:109-109 (registration)
    Dynamically sets up the toolHandlers object which includes the 'swit-oauth-start' handler from oauthHandlers for tool execution.
    toolHandlers = { ...oauthHandlers(oauthWebServer), ...coreHandlers(switClient) };

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