Alpaca · Capability

Broker API — OAuth

Broker API — OAuth. 3 operations. Lead operation: Authorize an OAuth Token. Self-contained Naftiko capability covering one Alpaca business surface.

Run with Naftiko AlpacaOAuth

What You Can Do

POST
Authorizeoauthtoken — Authorize an OAuth Token
/v1/v1/oauth/authorize
GET
Getoauthclient — Get an OAuth client
/v1/v1/oauth/clients/{client-id}
POST
Issueoauthtoken — Issue an OAuth token.
/v1/v1/oauth/token

MCP Tools

authorize-oauth-token

Authorize an OAuth Token

get-oauth-client

Get an OAuth client

read-only idempotent
issue-oauth-token

Issue an OAuth token.

Capability Spec

broker-oauth.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Broker API — OAuth
  description: 'Broker API — OAuth. 3 operations. Lead operation: Authorize an OAuth Token. Self-contained Naftiko capability
    covering one Alpaca business surface.'
  tags:
  - Alpaca
  - OAuth
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    ALPACA_API_KEY: ALPACA_API_KEY
capability:
  consumes:
  - type: http
    namespace: broker-oauth
    baseUri: https://broker-api.sandbox.alpaca.markets
    description: Broker API — OAuth business capability. Self-contained, no shared references.
    resources:
    - name: v1-oauth-authorize
      path: /v1/oauth/authorize
      operations:
      - name: authorizeoauthtoken
        method: POST
        description: Authorize an OAuth Token
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-oauth-clients-client_id
      path: /v1/oauth/clients/{client_id}
      operations:
      - name: getoauthclient
        method: GET
        description: Get an OAuth client
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: response_type
          in: query
          type: string
          description: code or token
        - name: redirect_uri
          in: query
          type: string
          description: Redirect URI of the OAuth flow
        - name: scope
          in: query
          type: string
          description: Requested scopes by the OAuth flow
    - name: v1-oauth-token
      path: /v1/oauth/token
      operations:
      - name: issueoauthtoken
        method: POST
        description: Issue an OAuth token.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    authentication:
      type: basic
      username: '{{env.ALPACA_USER}}'
      password: '{{env.ALPACA_PASS}}'
  exposes:
  - type: rest
    namespace: broker-oauth-rest
    port: 8080
    description: REST adapter for Broker API — OAuth. One Spectral-compliant resource per consumed operation, prefixed with
      /v1.
    resources:
    - path: /v1/v1/oauth/authorize
      name: v1-oauth-authorize
      description: REST surface for v1-oauth-authorize.
      operations:
      - method: POST
        name: authorizeoauthtoken
        description: Authorize an OAuth Token
        call: broker-oauth.authorizeoauthtoken
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/oauth/clients/{client-id}
      name: v1-oauth-clients-client-id
      description: REST surface for v1-oauth-clients-client_id.
      operations:
      - method: GET
        name: getoauthclient
        description: Get an OAuth client
        call: broker-oauth.getoauthclient
        with:
          response_type: rest.response_type
          redirect_uri: rest.redirect_uri
          scope: rest.scope
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/oauth/token
      name: v1-oauth-token
      description: REST surface for v1-oauth-token.
      operations:
      - method: POST
        name: issueoauthtoken
        description: Issue an OAuth token.
        call: broker-oauth.issueoauthtoken
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: broker-oauth-mcp
    port: 9090
    transport: http
    description: MCP adapter for Broker API — OAuth. One tool per consumed operation, routed inline through this capability's
      consumes block.
    tools:
    - name: authorize-oauth-token
      description: Authorize an OAuth Token
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: broker-oauth.authorizeoauthtoken
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: get-oauth-client
      description: Get an OAuth client
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: broker-oauth.getoauthclient
      with:
        response_type: tools.response_type
        redirect_uri: tools.redirect_uri
        scope: tools.scope
      outputParameters:
      - type: object
        mapping: $.
    - name: issue-oauth-token
      description: Issue an OAuth token.
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: broker-oauth.issueoauthtoken
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.