Skip to main content
Glama
xraywu

Wegene Assistant MCP Server

by xraywu

wegene-oauth

Authorize user accounts via WeGene's OAuth2 protocol to obtain access tokens for genetic report analysis and data management.

Instructions

Authorizing a user's account using WeGene Open API with oAuth2 protocol and retrieve a valid access token for further use

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async handler function `wegene_oauth()` that executes the tool: deletes prior token, prepares OAuth URL, opens browser, polls Redis for new access token up to 120 seconds, returns success or timeout message.
    async def wegene_oauth():
    
        redis_db.delete('wegene_access_token')
    
        # Initialize OAuth2 client
        client = WebApplicationClient(WEGENE_CLIENT_ID)
        
        # Prepare authorization URL
        authorization_url = client.prepare_request_uri(
            WEGENE_AUTH_URL,
            redirect_uri=REDIRECT_URI,
            scope="basic names athletigen skin psychology risk health"
        )
    
        webbrowser.open(authorization_url)
        
        # Poll for access token for 120 seconds
        start_time = time.time()
        while time.time() - start_time < 120:
            if redis_db.exists('wegene_access_token'):
                return [
                    TextContent(
                        type="text",
                        text="User authorization succeeded and access token retrieved. Continue to retrieve user profiles.",
                    )
                ]
            await asyncio.sleep(1)
        
        return [
            TextContent(
                type="text",
                text="Error: User authorization failed in 120 seconds. Please try again."
            )
        ]
  • Registers the 'wegene-oauth' tool in @server.list_tools() with name, description, and empty input schema (no parameters required).
    types.Tool(
        name="wegene-oauth",
        description="Authorizing a user's account using WeGene Open API with oAuth2 protocol and retrieve a valid access token for further use",
        inputSchema={
            "type": "object",
            "properties": {},
        },
    ),
  • Dispatches tool calls in @server.call_tool(): invokes the `wegene_oauth()` handler when name is 'wegene-oauth'.
    if name == "wegene-oauth":
        return await wegene_oauth()
  • Imports the `wegene_oauth` handler function from oauth_tool.py.
    from .tools.oauth_tool import wegene_oauth
  • Defines the input schema for 'wegene-oauth' tool: empty object (no input parameters).
    inputSchema={
        "type": "object",
        "properties": {},
    },

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

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/xraywu/mcp-wegene-assistant'

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