> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hasmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Provider Account

> Starts the oauth2 authorization of the current user with the provider. For remote MCP providers the authorization server is discovered and an oauth2 client is registered dynamically when the provider has none. The tokens are stored as the provider's ACCESS_TOKEN and REFRESH_TOKEN secret variables and renewed automatically.



## OpenAPI

````yaml post /providers/{id}/authorize
openapi: 3.0.4
info:
  title: HasMCP API
  version: 1.0.0
  description: >-
    API for managing HasMCP: variables, providers and their tools, resources and
    prompts, MCP servers, Git connections and the setup page settings. The
    organization is taken from the access token, so the paths carry no
    organization ID. The MCP endpoints that clients connect to, the public hub
    and the OAuth2 redirects are listed too.
servers:
  - url: https://app.hasmcp.com/api/v1
    description: Manager API (the other APIs override this per path)
security:
  - bearerAuth: []
tags:
  - name: Variables
  - name: Providers
  - name: Provider Tools
  - name: Provider Resources
  - name: Provider Prompts
  - name: Servers
  - name: Server Associations
  - name: Git Connections
  - name: Users
  - name: Hub
  - name: Configurations
  - name: Setup
  - name: MCP
  - name: OAuth2
paths:
  /providers/{id}/authorize:
    post:
      tags:
        - Providers
      summary: Connect Provider Account
      description: >-
        Starts the oauth2 authorization of the current user with the provider.
        For remote MCP providers the authorization server is discovered and an
        oauth2 client is registered dynamically when the provider has none. The
        tokens are stored as the provider's ACCESS_TOKEN and REFRESH_TOKEN
        secret variables and renewed automatically.
      operationId: authorizeProvider
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            description: Provider ID
        - name: serverID
          in: query
          required: false
          description: >-
            Connects the account for this MCP server only; its tokens are saved
            as variables of the server. Without it the account is shared by
            every server.
          schema:
            type: string
            pattern: ^[A-Za-z0-9]{11}$
      responses:
        '200':
          description: The url to send the user to
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthorizeProviderResponse'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        default:
          $ref: '#/components/responses/Error'
      security:
        - oauth2:
            - provider:update
components:
  schemas:
    AuthorizeProviderResponse:
      type: object
      properties:
        authorizationURL:
          type: string
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              example: 422
            message:
              type: string
            data:
              type: object
              additionalProperties: true
              description: Details, e.g. authorizationRequired on sync
  responses:
    UnprocessableEntity:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Error:
      description: >-
        An error; the HTTP status is error.code, e.g. 401 for a missing or
        invalid token, 404 when not found or 422 for an invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Enter 'Bearer' followed by a space and your token (e.g., 'Bearer
        ${HASMCP_ACCESS_TOKEN}').
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.hasmcp.com/oauth2/auth
          tokenUrl: https://accounts.hasmcp.com/oauth2/token
          scopes:
            gitconnection:list: List Git connections
            gitconnection:delete: Delete Git connection
            variable:list: List variables
            variable:create: Create variable
            variable:update: Update variable
            variable:delete: Delete variable
            provider:list: List providers
            provider:create: Create provider
            provider:read: Get provider
            provider:update: Update provider
            provider:delete: Delete provider
            server:list: List MCP servers
            server:create: Create MCP server
            server:read: Get MCP server
            server:update: Update MCP server
            server:delete: Delete MCP server
            server:create_token: Create MCP server token
            server:tail: Read the debug stream of an MCP server
            provider_tool:list: List provider tools
            provider_tool:create: Create provider tool
            provider_tool:read: Get provider tool
            provider_tool:update: Update provider tool
            provider_tool:delete: Delete provider tool
            provider_tool_interceptor:list: List provider tool interceptors
            provider_tool_interceptor:save: Save provider tool interceptors
            provider_resource:list: List provider resources
            provider_resource:create: Create provider resource
            provider_resource:read: Get provider resource
            provider_resource:update: Update provider resource
            provider_resource:delete: Delete provider resource
            provider_prompt:list: List provider prompts
            provider_prompt:create: Create provider prompt
            provider_prompt:read: Get provider prompt
            provider_prompt:update: Update provider prompt
            provider_prompt:delete: Delete provider prompt
            server:import: Import MCP server
            server:export: Export MCP server
            server_analytics:read: Get MCP server analytics
            server_token:create: Create MCP server token
            server_tool:list: List MCP server tools
            server_tool:create: Add a tool to an MCP server
            server_tool:delete: Remove a tool from an MCP server
            server_resource:list: List MCP server resources
            server_resource:create: Add a resource to an MCP server
            server_resource:delete: Remove a resource from an MCP server
            server_prompt:list: List MCP server prompts
            server_prompt:create: Add a prompt to an MCP server
            server_prompt:delete: Remove a prompt from an MCP server

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.