OpenMercantil · Capability

OpenMercantil Public API — Sectors

OpenMercantil Public API — Sectors. 6 operations. Lead operation: Get CNAE Hierarchy Tree. Self-contained Naftiko capability covering one Openmercantil business surface.

Run with Naftiko OpenmercantilSectors

What You Can Do

GET
Getcnaetree — Get CNAE Hierarchy Tree
/v1/api/v1/cnae/tree
GET
Getcnaecode — Get CNAE Code Info
/v1/api/v1/cnae/{code}
GET
Getsectorcompanies — List Companies In A Sector
/v1/api/v1/sector/{code}/companies
GET
Getsectorratios — Get Sector Financial Ratios
/v1/api/v1/sector/{code}/ratios
GET
Getsectorstats — Get Sector Aggregate Statistics
/v1/api/v1/sectores/stats
GET
Getsectorstatscsv — Export Sector Aggregate Statistics As CSV
/v1/api/v1/sectores/stats-csv

MCP Tools

get-cnae-hierarchy-tree

Get CNAE Hierarchy Tree

read-only idempotent
get-cnae-code-info

Get CNAE Code Info

read-only idempotent
list-companies-sector

List Companies In A Sector

read-only idempotent
get-sector-financial-ratios

Get Sector Financial Ratios

read-only idempotent
get-sector-aggregate-statistics

Get Sector Aggregate Statistics

read-only idempotent
export-sector-aggregate-statistics-csv

Export Sector Aggregate Statistics As CSV

read-only idempotent

Capability Spec

openmercantil-sectors.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: OpenMercantil Public API — Sectors
  description: 'OpenMercantil Public API — Sectors. 6 operations. Lead operation: Get CNAE Hierarchy Tree. Self-contained
    Naftiko capability covering one Openmercantil business surface.'
  tags:
  - Openmercantil
  - Sectors
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    OPENMERCANTIL_API_KEY: OPENMERCANTIL_API_KEY
capability:
  consumes:
  - type: http
    namespace: openmercantil-sectors
    baseUri: https://openmercantil.es
    description: OpenMercantil Public API — Sectors business capability. Self-contained, no shared references.
    resources:
    - name: api-v1-cnae-tree
      path: /api/v1/cnae/tree
      operations:
      - name: getcnaetree
        method: GET
        description: Get CNAE Hierarchy Tree
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-v1-cnae-code
      path: /api/v1/cnae/{code}
      operations:
      - name: getcnaecode
        method: GET
        description: Get CNAE Code Info
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: code
          in: path
          type: string
          required: true
    - name: api-v1-sector-code-companies
      path: /api/v1/sector/{code}/companies
      operations:
      - name: getsectorcompanies
        method: GET
        description: List Companies In A Sector
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: code
          in: path
          type: string
          required: true
        - name: limit
          in: query
          type: integer
    - name: api-v1-sector-code-ratios
      path: /api/v1/sector/{code}/ratios
      operations:
      - name: getsectorratios
        method: GET
        description: Get Sector Financial Ratios
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: code
          in: path
          type: string
          required: true
    - name: api-v1-sectores-stats
      path: /api/v1/sectores/stats
      operations:
      - name: getsectorstats
        method: GET
        description: Get Sector Aggregate Statistics
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: api-v1-sectores-stats.csv
      path: /api/v1/sectores/stats.csv
      operations:
      - name: getsectorstatscsv
        method: GET
        description: Export Sector Aggregate Statistics As CSV
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    authentication:
      type: apikey
      key: session
      value: '{{env.OPENMERCANTIL_API_KEY}}'
      placement: cookie
  exposes:
  - type: rest
    namespace: openmercantil-sectors-rest
    port: 8080
    description: REST adapter for OpenMercantil Public API — Sectors. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/api/v1/cnae/tree
      name: api-v1-cnae-tree
      description: REST surface for api-v1-cnae-tree.
      operations:
      - method: GET
        name: getcnaetree
        description: Get CNAE Hierarchy Tree
        call: openmercantil-sectors.getcnaetree
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v1/cnae/{code}
      name: api-v1-cnae-code
      description: REST surface for api-v1-cnae-code.
      operations:
      - method: GET
        name: getcnaecode
        description: Get CNAE Code Info
        call: openmercantil-sectors.getcnaecode
        with:
          code: rest.code
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v1/sector/{code}/companies
      name: api-v1-sector-code-companies
      description: REST surface for api-v1-sector-code-companies.
      operations:
      - method: GET
        name: getsectorcompanies
        description: List Companies In A Sector
        call: openmercantil-sectors.getsectorcompanies
        with:
          code: rest.code
          limit: rest.limit
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v1/sector/{code}/ratios
      name: api-v1-sector-code-ratios
      description: REST surface for api-v1-sector-code-ratios.
      operations:
      - method: GET
        name: getsectorratios
        description: Get Sector Financial Ratios
        call: openmercantil-sectors.getsectorratios
        with:
          code: rest.code
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v1/sectores/stats
      name: api-v1-sectores-stats
      description: REST surface for api-v1-sectores-stats.
      operations:
      - method: GET
        name: getsectorstats
        description: Get Sector Aggregate Statistics
        call: openmercantil-sectors.getsectorstats
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v1/sectores/stats-csv
      name: api-v1-sectores-stats-csv
      description: REST surface for api-v1-sectores-stats.csv.
      operations:
      - method: GET
        name: getsectorstatscsv
        description: Export Sector Aggregate Statistics As CSV
        call: openmercantil-sectors.getsectorstatscsv
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: openmercantil-sectors-mcp
    port: 9090
    transport: http
    description: MCP adapter for OpenMercantil Public API — Sectors. One tool per consumed operation, routed inline through
      this capability's consumes block.
    tools:
    - name: get-cnae-hierarchy-tree
      description: Get CNAE Hierarchy Tree
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openmercantil-sectors.getcnaetree
      outputParameters:
      - type: object
        mapping: $.
    - name: get-cnae-code-info
      description: Get CNAE Code Info
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openmercantil-sectors.getcnaecode
      with:
        code: tools.code
      outputParameters:
      - type: object
        mapping: $.
    - name: list-companies-sector
      description: List Companies In A Sector
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openmercantil-sectors.getsectorcompanies
      with:
        code: tools.code
        limit: tools.limit
      outputParameters:
      - type: object
        mapping: $.
    - name: get-sector-financial-ratios
      description: Get Sector Financial Ratios
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openmercantil-sectors.getsectorratios
      with:
        code: tools.code
      outputParameters:
      - type: object
        mapping: $.
    - name: get-sector-aggregate-statistics
      description: Get Sector Aggregate Statistics
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openmercantil-sectors.getsectorstats
      outputParameters:
      - type: object
        mapping: $.
    - name: export-sector-aggregate-statistics-csv
      description: Export Sector Aggregate Statistics As CSV
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openmercantil-sectors.getsectorstatscsv
      outputParameters:
      - type: object
        mapping: $.