Wikidata · Capability

Wikidata Knowledge Graph Access

Unified capability for reading and writing to the Wikidata knowledge graph. Combines Wikibase REST API operations for entity retrieval, statement management, and structured data writing. Intended for data engineers, knowledge graph analysts, and AI/ML pipelines that need programmatic access to Wikidata's 100M+ entities.

Run with Naftiko WikidataKnowledge GraphLinked DataSemantic WebOpen Data

What You Can Do

POST
Create item — Create a new Wikidata item
/v1/entities/items
GET
Get item — Get a Wikidata item by Q-ID
/v1/entities/items/{item_id}
GET
Get item label — Get label for an item in a specific language
/v1/entities/items/{item_id}/labels/{language_code}
GET
Get item statements — Get all statements for an item
/v1/entities/items/{item_id}/statements
POST
Add item statement — Add a statement to an item
/v1/entities/items/{item_id}/statements
GET
Get statement — Get a statement by ID
/v1/statements/{statement_id}
DELETE
Delete statement — Delete a statement
/v1/statements/{statement_id}
GET
Get property — Get a property by P-ID
/v1/entities/properties/{property_id}

MCP Tools

get-entity

Retrieve a Wikidata entity (item or property) with all labels, descriptions, aliases, sitelinks, and statements by Q-ID or P-ID.

read-only idempotent
get-entity-statements

Retrieve structured factual claims (statements) for a Wikidata entity, optionally filtered by property ID (e.g. P31 for 'instance of').

read-only idempotent
get-entity-label

Retrieve the label for a Wikidata entity in a specific language by BCP 47 language code.

read-only idempotent
get-property-definition

Retrieve a Wikidata property definition including its datatype, labels, and descriptions. Useful for understanding what a P-ID represents.

read-only idempotent
create-entity

Create a new Wikidata item with labels, descriptions, aliases, and initial statements. Requires OAuth2 authentication.

add-fact

Add a new factual statement (claim) to a Wikidata item. Specify the property P-ID and value. Requires OAuth2 authentication.

remove-fact

Delete an incorrect or outdated statement from a Wikidata item by statement ID. Requires OAuth2 authentication.

idempotent

Capability Spec

knowledge-graph-access.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Wikidata Knowledge Graph Access
  description: Unified capability for reading and writing to the Wikidata knowledge graph. Combines Wikibase REST API operations
    for entity retrieval, statement management, and structured data writing. Intended for data engineers, knowledge graph
    analysts, and AI/ML pipelines that need programmatic access to Wikidata's 100M+ entities.
  tags:
  - Wikidata
  - Knowledge Graph
  - Linked Data
  - Semantic Web
  - Open Data
  created: '2026-05-03'
  modified: '2026-05-06'
binds:
- namespace: env
  keys:
    WIKIDATA_OAUTH_TOKEN: WIKIDATA_OAUTH_TOKEN
capability:
  consumes:
  - type: http
    namespace: wikibase-rest
    baseUri: https://www.wikidata.org/w/rest.php/wikibase/v0
    description: Wikibase REST API for reading and writing Wikidata entities.
    authentication:
      type: bearer
      token: '{{WIKIDATA_OAUTH_TOKEN}}'
    resources:
    - name: items
      path: /entities/items
      description: Wikidata item (Q-entity) operations
      operations:
      - name: create-item
        method: POST
        description: Create a new Wikidata item
        inputParameters: []
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        body:
          type: json
          data:
            labels: '{{tools.labels}}'
            descriptions: '{{tools.descriptions}}'
            statements: '{{tools.statements}}'
    - name: item
      path: /entities/items/{item_id}
      description: Single Wikidata item operations
      operations:
      - name: get-item
        method: GET
        description: Get a Wikidata item by ID
        inputParameters:
        - name: item_id
          in: path
          type: string
          required: true
          description: Wikidata item ID (e.g. Q42)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: patch-item
        method: PATCH
        description: Update a Wikidata item via JSON patch
        inputParameters:
        - name: item_id
          in: path
          type: string
          required: true
          description: Wikidata item ID
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        body:
          type: json
          data:
            patch: '{{tools.patch}}'
            comment: '{{tools.comment}}'
    - name: item-labels
      path: /entities/items/{item_id}/labels/{language_code}
      description: Item label operations
      operations:
      - name: get-item-label
        method: GET
        description: Get a label for an item in a specific language
        inputParameters:
        - name: item_id
          in: path
          type: string
          required: true
          description: Wikidata item ID
        - name: language_code
          in: path
          type: string
          required: true
          description: BCP 47 language code
        outputRawFormat: json
        outputParameters:
        - name: result
          type: string
          value: $.
      - name: set-item-label
        method: PUT
        description: Set a label for an item in a specific language
        inputParameters:
        - name: item_id
          in: path
          type: string
          required: true
          description: Wikidata item ID
        - name: language_code
          in: path
          type: string
          required: true
          description: BCP 47 language code
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        body:
          type: json
          data:
            label: '{{tools.label}}'
            comment: '{{tools.comment}}'
    - name: item-statements
      path: /entities/items/{item_id}/statements
      description: Item statement (claim) operations
      operations:
      - name: get-item-statements
        method: GET
        description: Get all statements for a Wikidata item
        inputParameters:
        - name: item_id
          in: path
          type: string
          required: true
          description: Wikidata item ID
        - name: property
          in: query
          type: string
          required: false
          description: Filter by property ID (e.g. P31)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: add-item-statement
        method: POST
        description: Add a new statement to a Wikidata item
        inputParameters:
        - name: item_id
          in: path
          type: string
          required: true
          description: Wikidata item ID
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        body:
          type: json
          data:
            property: '{{tools.property}}'
            value: '{{tools.value}}'
    - name: statements
      path: /statements/{statement_id}
      description: Individual statement operations
      operations:
      - name: get-statement
        method: GET
        description: Get a single statement by ID
        inputParameters:
        - name: statement_id
          in: path
          type: string
          required: true
          description: Statement ID
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: delete-statement
        method: DELETE
        description: Delete a statement from an item
        inputParameters:
        - name: statement_id
          in: path
          type: string
          required: true
          description: Statement ID
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: properties
      path: /entities/properties/{property_id}
      description: Wikidata property operations
      operations:
      - name: get-property
        method: GET
        description: Get a Wikidata property by ID
        inputParameters:
        - name: property_id
          in: path
          type: string
          required: true
          description: Wikidata property ID (e.g. P31)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
  exposes:
  - type: rest
    port: 8080
    namespace: wikidata-knowledge-graph-api
    description: Unified REST API for Wikidata knowledge graph access and editing.
    resources:
    - path: /v1/entities/items
      name: items
      description: Wikidata items (Q-entities)
      operations:
      - method: POST
        name: create-item
        description: Create a new Wikidata item
        call: wikibase-rest.create-item
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/entities/items/{item_id}
      name: item
      description: Single Wikidata item
      operations:
      - method: GET
        name: get-item
        description: Get a Wikidata item by Q-ID
        call: wikibase-rest.get-item
        with:
          item_id: rest.item_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/entities/items/{item_id}/labels/{language_code}
      name: item-label
      description: Item labels by language
      operations:
      - method: GET
        name: get-item-label
        description: Get label for an item in a specific language
        call: wikibase-rest.get-item-label
        with:
          item_id: rest.item_id
          language_code: rest.language_code
        outputParameters:
        - type: string
          mapping: $.
    - path: /v1/entities/items/{item_id}/statements
      name: item-statements
      description: Statements (claims) for an item
      operations:
      - method: GET
        name: get-item-statements
        description: Get all statements for an item
        call: wikibase-rest.get-item-statements
        with:
          item_id: rest.item_id
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: add-item-statement
        description: Add a statement to an item
        call: wikibase-rest.add-item-statement
        with:
          item_id: rest.item_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/statements/{statement_id}
      name: statement
      description: Individual statement operations
      operations:
      - method: GET
        name: get-statement
        description: Get a statement by ID
        call: wikibase-rest.get-statement
        with:
          statement_id: rest.statement_id
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: delete-statement
        description: Delete a statement
        call: wikibase-rest.delete-statement
        with:
          statement_id: rest.statement_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/entities/properties/{property_id}
      name: property
      description: Wikidata properties (P-entities)
      operations:
      - method: GET
        name: get-property
        description: Get a property by P-ID
        call: wikibase-rest.get-property
        with:
          property_id: rest.property_id
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    port: 9090
    namespace: wikidata-knowledge-graph-mcp
    transport: http
    description: MCP server for AI-assisted Wikidata knowledge graph access and enrichment.
    tools:
    - name: get-entity
      description: Retrieve a Wikidata entity (item or property) with all labels, descriptions, aliases, sitelinks, and statements
        by Q-ID or P-ID.
      hints:
        readOnly: true
        idempotent: true
        openWorld: true
      call: wikibase-rest.get-item
      with:
        item_id: tools.entity_id
      outputParameters:
      - type: object
        mapping: $.
    - name: get-entity-statements
      description: Retrieve structured factual claims (statements) for a Wikidata entity, optionally filtered by property
        ID (e.g. P31 for 'instance of').
      hints:
        readOnly: true
        idempotent: true
        openWorld: true
      call: wikibase-rest.get-item-statements
      with:
        item_id: tools.item_id
      outputParameters:
      - type: object
        mapping: $.
    - name: get-entity-label
      description: Retrieve the label for a Wikidata entity in a specific language by BCP 47 language code.
      hints:
        readOnly: true
        idempotent: true
      call: wikibase-rest.get-item-label
      with:
        item_id: tools.item_id
        language_code: tools.language_code
      outputParameters:
      - type: string
        mapping: $.
    - name: get-property-definition
      description: Retrieve a Wikidata property definition including its datatype, labels, and descriptions. Useful for understanding
        what a P-ID represents.
      hints:
        readOnly: true
        idempotent: true
      call: wikibase-rest.get-property
      with:
        property_id: tools.property_id
      outputParameters:
      - type: object
        mapping: $.
    - name: create-entity
      description: Create a new Wikidata item with labels, descriptions, aliases, and initial statements. Requires OAuth2
        authentication.
      hints:
        readOnly: false
        destructive: false
      call: wikibase-rest.create-item
      with:
        labels: tools.labels
        descriptions: tools.descriptions
      outputParameters:
      - type: object
        mapping: $.
    - name: add-fact
      description: Add a new factual statement (claim) to a Wikidata item. Specify the property P-ID and value. Requires OAuth2
        authentication.
      hints:
        readOnly: false
        destructive: false
      call: wikibase-rest.add-item-statement
      with:
        item_id: tools.item_id
      outputParameters:
      - type: object
        mapping: $.
    - name: remove-fact
      description: Delete an incorrect or outdated statement from a Wikidata item by statement ID. Requires OAuth2 authentication.
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: wikibase-rest.delete-statement
      with:
        statement_id: tools.statement_id
      outputParameters:
      - type: object
        mapping: $.