NPR · Capability

NPR Identity Service

The entry point to user-specific information

Run with Naftiko NprAPI

What You Can Do

POST
Createtoken — NPR Create a new OAuth2 access token
/v2/token
GET
Getauthorizationpage — NPR Show a web-based login/signup form to a user
/v2/authorize
POST
Generatedevicecode — NPR Initiate an OAuth2 login flow for limited input devices
/v2/device
POST
Revoketoken — NPR Revoke an existing OAuth2 access token
/v2/token/revoke
GET
Getuser — NPR Get the latest state information about the logged-in user
/v2/user
DELETE
Deleteuser — NPR Delete the user's account
/v2/user
PUT
Updatestations — NPR Update the logged-in user's favorite station(s)
/v2/stations
POST
Postfollowing — NPR Update the following status of the logged-in user for a particular aggregation
/v2/following

MCP Tools

createtoken

NPR Create a new OAuth2 access token

getauthorizationpage

NPR Show a web-based login/signup form to a user

read-only idempotent
generatedevicecode

NPR Initiate an OAuth2 login flow for limited input devices

revoketoken

NPR Revoke an existing OAuth2 access token

getuser

NPR Get the latest state information about the logged-in user

read-only idempotent
deleteuser

NPR Delete the user's account

idempotent
updatestations

NPR Update the logged-in user's favorite station(s)

idempotent
postfollowing

NPR Update the following status of the logged-in user for a particular aggregation

Capability Spec

npr-capability.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: NPR Identity Service
  description: The entry point to user-specific information
  tags:
  - Npr
  - API
  created: '2026-05-06'
  modified: '2026-05-06'
capability:
  consumes:
  - type: http
    namespace: npr
    baseUri: https://identity.api.npr.org
    description: NPR Identity Service HTTP API.
    authentication:
      type: bearer
      token: '{{NPR_TOKEN}}'
    resources:
    - name: v2-token
      path: /v2/token
      operations:
      - name: createtoken
        method: POST
        description: NPR Create a new OAuth2 access token
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v2-authorize
      path: /v2/authorize
      operations:
      - name: getauthorizationpage
        method: GET
        description: NPR Show a web-based login/signup form to a user
        inputParameters:
        - name: client_id
          in: query
          type: string
          required: true
          description: The client's ID
        - name: redirect_uri
          in: query
          type: string
          required: true
          description: The client's URL to redirect to if the authentication is approved
        - name: response_type
          in: query
          type: string
          required: true
          description: The type of response; currently, only `code` is supported
        - name: scope
          in: query
          type: string
          required: true
          description: A space-separated list of scope(s) requested by the application
        - name: email
          in: query
          type: string
          description: An email address to prepopulate on the login screen
        - name: state
          in: query
          type: string
          required: true
          description: A CSRF token generated by the client, to be roundtripped through the request for added security
        - name: prompt
          in: query
          type: string
          description: Optional prompt parameter to be passed to Akamai /login/authorize
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v2-device
      path: /v2/device
      operations:
      - name: generatedevicecode
        method: POST
        description: NPR Initiate an OAuth2 login flow for limited input devices
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v2-token-revoke
      path: /v2/token/revoke
      operations:
      - name: revoketoken
        method: POST
        description: NPR Revoke an existing OAuth2 access token
        inputParameters:
        - name: Authorization
          in: header
          type: string
          required: true
          description: A `client_credentials` access token from the same client application as the token being revoked. Should
            start with `Bearer`, followed by a space, followed by th
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v2-user
      path: /v2/user
      operations:
      - name: getuser
        method: GET
        description: NPR Get the latest state information about the logged-in user
        inputParameters:
        - name: Authorization
          in: header
          type: string
          required: true
          description: Your access token from the Authorization Service. Should start with `Bearer`, followed by a space,
            followed by the token.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: deleteuser
        method: DELETE
        description: NPR Delete the user's account
        inputParameters:
        - name: Authorization
          in: header
          type: string
          required: true
          description: Your access token from the Authorization Service. Should start with `Bearer`, followed by a space,
            followed by the token.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v2-stations
      path: /v2/stations
      operations:
      - name: updatestations
        method: PUT
        description: NPR Update the logged-in user's favorite station(s)
        inputParameters:
        - name: Authorization
          in: header
          type: string
          required: true
          description: Your access token from the Authorization Service. Should start with `Bearer`, followed by a space,
            followed by the token.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v2-following
      path: /v2/following
      operations:
      - name: postfollowing
        method: POST
        description: NPR Update the following status of the logged-in user for a particular aggregation
        inputParameters:
        - name: Authorization
          in: header
          type: string
          required: true
          description: Your access token from the Authorization Service. Should start with `Bearer`, followed by a space,
            followed by the token.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
  exposes:
  - type: rest
    port: 8080
    namespace: npr-rest
    description: REST adapter for NPR Identity Service.
    resources:
    - path: /v2/token
      name: createtoken
      operations:
      - method: POST
        name: createtoken
        description: NPR Create a new OAuth2 access token
        call: npr.createtoken
        outputParameters:
        - type: object
          mapping: $.
    - path: /v2/authorize
      name: getauthorizationpage
      operations:
      - method: GET
        name: getauthorizationpage
        description: NPR Show a web-based login/signup form to a user
        call: npr.getauthorizationpage
        outputParameters:
        - type: object
          mapping: $.
    - path: /v2/device
      name: generatedevicecode
      operations:
      - method: POST
        name: generatedevicecode
        description: NPR Initiate an OAuth2 login flow for limited input devices
        call: npr.generatedevicecode
        outputParameters:
        - type: object
          mapping: $.
    - path: /v2/token/revoke
      name: revoketoken
      operations:
      - method: POST
        name: revoketoken
        description: NPR Revoke an existing OAuth2 access token
        call: npr.revoketoken
        outputParameters:
        - type: object
          mapping: $.
    - path: /v2/user
      name: getuser
      operations:
      - method: GET
        name: getuser
        description: NPR Get the latest state information about the logged-in user
        call: npr.getuser
        outputParameters:
        - type: object
          mapping: $.
    - path: /v2/user
      name: deleteuser
      operations:
      - method: DELETE
        name: deleteuser
        description: NPR Delete the user's account
        call: npr.deleteuser
        outputParameters:
        - type: object
          mapping: $.
    - path: /v2/stations
      name: updatestations
      operations:
      - method: PUT
        name: updatestations
        description: NPR Update the logged-in user's favorite station(s)
        call: npr.updatestations
        outputParameters:
        - type: object
          mapping: $.
    - path: /v2/following
      name: postfollowing
      operations:
      - method: POST
        name: postfollowing
        description: NPR Update the following status of the logged-in user for a particular aggregation
        call: npr.postfollowing
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    port: 9090
    namespace: npr-mcp
    transport: http
    description: MCP adapter for NPR Identity Service for AI agent use.
    tools:
    - name: createtoken
      description: NPR Create a new OAuth2 access token
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: npr.createtoken
      outputParameters:
      - type: object
        mapping: $.
    - name: getauthorizationpage
      description: NPR Show a web-based login/signup form to a user
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: npr.getauthorizationpage
      with:
        client_id: tools.client_id
        redirect_uri: tools.redirect_uri
        response_type: tools.response_type
        scope: tools.scope
        email: tools.email
        state: tools.state
        prompt: tools.prompt
      inputParameters:
      - name: client_id
        type: string
        description: The client's ID
        required: true
      - name: redirect_uri
        type: string
        description: The client's URL to redirect to if the authentication is approved
        required: true
      - name: response_type
        type: string
        description: The type of response; currently, only `code` is supported
        required: true
      - name: scope
        type: string
        description: A space-separated list of scope(s) requested by the application
        required: true
      - name: email
        type: string
        description: An email address to prepopulate on the login screen
      - name: state
        type: string
        description: A CSRF token generated by the client, to be roundtripped through the request for added security
        required: true
      - name: prompt
        type: string
        description: Optional prompt parameter to be passed to Akamai /login/authorize
      outputParameters:
      - type: object
        mapping: $.
    - name: generatedevicecode
      description: NPR Initiate an OAuth2 login flow for limited input devices
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: npr.generatedevicecode
      outputParameters:
      - type: object
        mapping: $.
    - name: revoketoken
      description: NPR Revoke an existing OAuth2 access token
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: npr.revoketoken
      outputParameters:
      - type: object
        mapping: $.
    - name: getuser
      description: NPR Get the latest state information about the logged-in user
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: npr.getuser
      outputParameters:
      - type: object
        mapping: $.
    - name: deleteuser
      description: NPR Delete the user's account
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: npr.deleteuser
      outputParameters:
      - type: object
        mapping: $.
    - name: updatestations
      description: NPR Update the logged-in user's favorite station(s)
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: npr.updatestations
      outputParameters:
      - type: object
        mapping: $.
    - name: postfollowing
      description: NPR Update the following status of the logged-in user for a particular aggregation
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: npr.postfollowing
      outputParameters:
      - type: object
        mapping: $.
binds:
- namespace: env
  keys:
    NPR_TOKEN: NPR_TOKEN