GoatCounter · Capability

GoatCounter API — Statistics

GoatCounter API — Statistics. 5 operations. Lead operation: View/visitor stats per path. Self-contained Naftiko capability covering one Goatcounter business surface.

Run with Naftiko GoatcounterStatistics

What You Can Do

GET
Statshits — View/visitor stats per path
/v1/stats/hits
GET
Statshitsrefs — Referral stats for a path
/v1/stats/hits/{path-id}
GET
Statstotal — List total pageview counts
/v1/stats/total
GET
Statsbypage — Stats for a category (browser, system, location, etc.)
/v1/stats/{page}
GET
Statsbypagedetail — Detailed stats within a category
/v1/stats/{page}/{id}

MCP Tools

view-visitor-stats-per-path

View/visitor stats per path

read-only idempotent
referral-stats-path

Referral stats for a path

read-only idempotent
list-total-pageview-counts

List total pageview counts

read-only idempotent
stats-category-browser-system-location

Stats for a category (browser, system, location, etc.)

read-only idempotent
detailed-stats-within-category

Detailed stats within a category

read-only idempotent

Capability Spec

goatcounter-statistics.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: GoatCounter API — Statistics
  description: 'GoatCounter API — Statistics. 5 operations. Lead operation: View/visitor stats per path. Self-contained Naftiko
    capability covering one Goatcounter business surface.'
  tags:
  - Goatcounter
  - Statistics
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    GOATCOUNTER_API_KEY: GOATCOUNTER_API_KEY
capability:
  consumes:
  - type: http
    namespace: goatcounter-statistics
    baseUri: https://goatcounter.com/api/v0
    description: GoatCounter API — Statistics business capability. Self-contained, no shared references.
    resources:
    - name: stats-hits
      path: /stats/hits
      operations:
      - name: statshits
        method: GET
        description: View/visitor stats per path
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: limit
          in: query
          type: integer
        - name: include_paths
          in: query
          type: array
        - name: exclude_paths
          in: query
          type: array
        - name: daily
          in: query
          type: boolean
    - name: stats-hits-path_id
      path: /stats/hits/{path_id}
      operations:
      - name: statshitsrefs
        method: GET
        description: Referral stats for a path
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: path_id
          in: path
          type: integer
          required: true
    - name: stats-total
      path: /stats/total
      operations:
      - name: statstotal
        method: GET
        description: List total pageview counts
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: stats-page
      path: /stats/{page}
      operations:
      - name: statsbypage
        method: GET
        description: Stats for a category (browser, system, location, etc.)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: page
          in: path
          type: string
          required: true
    - name: stats-page-id
      path: /stats/{page}/{id}
      operations:
      - name: statsbypagedetail
        method: GET
        description: Detailed stats within a category
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: page
          in: path
          type: string
          required: true
        - name: id
          in: path
          type: string
          required: true
    authentication:
      type: bearer
      token: '{{env.GOATCOUNTER_API_KEY}}'
  exposes:
  - type: rest
    namespace: goatcounter-statistics-rest
    port: 8080
    description: REST adapter for GoatCounter API — Statistics. One Spectral-compliant resource per consumed operation, prefixed
      with /v1.
    resources:
    - path: /v1/stats/hits
      name: stats-hits
      description: REST surface for stats-hits.
      operations:
      - method: GET
        name: statshits
        description: View/visitor stats per path
        call: goatcounter-statistics.statshits
        with:
          limit: rest.limit
          include_paths: rest.include_paths
          exclude_paths: rest.exclude_paths
          daily: rest.daily
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/stats/hits/{path-id}
      name: stats-hits-path-id
      description: REST surface for stats-hits-path_id.
      operations:
      - method: GET
        name: statshitsrefs
        description: Referral stats for a path
        call: goatcounter-statistics.statshitsrefs
        with:
          path_id: rest.path_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/stats/total
      name: stats-total
      description: REST surface for stats-total.
      operations:
      - method: GET
        name: statstotal
        description: List total pageview counts
        call: goatcounter-statistics.statstotal
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/stats/{page}
      name: stats-page
      description: REST surface for stats-page.
      operations:
      - method: GET
        name: statsbypage
        description: Stats for a category (browser, system, location, etc.)
        call: goatcounter-statistics.statsbypage
        with:
          page: rest.page
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/stats/{page}/{id}
      name: stats-page-id
      description: REST surface for stats-page-id.
      operations:
      - method: GET
        name: statsbypagedetail
        description: Detailed stats within a category
        call: goatcounter-statistics.statsbypagedetail
        with:
          page: rest.page
          id: rest.id
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: goatcounter-statistics-mcp
    port: 9090
    transport: http
    description: MCP adapter for GoatCounter API — Statistics. One tool per consumed operation, routed inline through this
      capability's consumes block.
    tools:
    - name: view-visitor-stats-per-path
      description: View/visitor stats per path
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: goatcounter-statistics.statshits
      with:
        limit: tools.limit
        include_paths: tools.include_paths
        exclude_paths: tools.exclude_paths
        daily: tools.daily
      outputParameters:
      - type: object
        mapping: $.
    - name: referral-stats-path
      description: Referral stats for a path
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: goatcounter-statistics.statshitsrefs
      with:
        path_id: tools.path_id
      outputParameters:
      - type: object
        mapping: $.
    - name: list-total-pageview-counts
      description: List total pageview counts
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: goatcounter-statistics.statstotal
      outputParameters:
      - type: object
        mapping: $.
    - name: stats-category-browser-system-location
      description: Stats for a category (browser, system, location, etc.)
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: goatcounter-statistics.statsbypage
      with:
        page: tools.page
      outputParameters:
      - type: object
        mapping: $.
    - name: detailed-stats-within-category
      description: Detailed stats within a category
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: goatcounter-statistics.statsbypagedetail
      with:
        page: tools.page
        id: tools.id
      outputParameters:
      - type: object
        mapping: $.