Verify a Credential

Tutorial: Verify a Credential using MCP Toolkit

Follow these instructions to Verify a Credential from your MCP Client (e.g. Claude Desktop) using the MCP Toolkit.

⚠️ Before you begin...

Make sure you have configured the MCP Client as per the setup instructions and issued a Credential from the same MCP Client.

Step 1: Create Connection between Holder and Claude Desktop.

If the connection was disrupted, create a new connection between the Holder and Claude Desktop.

Step 2: Ask Claude to issue a Proof Request

Ask Claude to issue a proof request with some conditions based on the attributes of your credential.

For this tutorial, we asked Claude to generate a proof request with score > 50.

Step 3: Holder checks Request and sends Proof

The next steps are at the Holder Agent side to accept the proof request and send the response. It can be simulated by running the following APIs in sequence from the Holder API at http://localhost:4001/api/doc or Postman.

Fetch all present-proof exchange records

get
Query parameters
connection_idstringOptional

Connection identifier

Example: {"value":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}
limitintegerOptional

Number of results to return

Example: {"value":50}
offsetintegerOptional

Offset for pagination

Example: {"value":0}
rolestring · enumOptional

Role assigned in presentation exchange

Possible values:
statestring · enumOptional

Presentation exchange state

Possible values:
thread_idstringOptional

Thread identifier

Example: {"value":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}
Responses
200Success
application/json
get
GET /present-proof-2.0/records HTTP/1.1
Host: 
Accept: */*
200Success
{
  "results": [
    {
      "auto_present": false,
      "auto_remove": false,
      "auto_verify": true,
      "by_format": {
        "pres": {},
        "pres_proposal": {},
        "pres_request": {}
      },
      "connection_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "created_at": "2021-12-31T23:59:59Z",
      "error_msg": "Invalid structure",
      "initiator": "self",
      "pres": {
        "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "@type": "https://didcomm.org/my-family/1.0/my-message-type",
        "comment": "text",
        "formats": [
          {
            "attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "format": "dif/presentation-exchange/[email protected]"
          }
        ],
        "presentations~attach": [
          {
            "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "byte_count": 1234,
            "data": {
              "base64": "ey4uLn0=",
              "json": "{\"sample\": \"content\"}",
              "jws": {
                "header": {
                  "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                },
                "protected": "ey4uLn0",
                "signature": "ey4uLn0",
                "signatures": [
                  {
                    "header": {
                      "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                    },
                    "protected": "ey4uLn0",
                    "signature": "ey4uLn0"
                  }
                ]
              },
              "links": [
                "https://link.to/data"
              ],
              "sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb"
            },
            "description": "view from doorway, facing east, with lights off",
            "filename": "IMG1092348.png",
            "lastmod_time": "2021-12-31T23:59:59Z",
            "mime-type": "image/png"
          }
        ]
      },
      "pres_ex_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "pres_proposal": {
        "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "@type": "https://didcomm.org/my-family/1.0/my-message-type",
        "comment": "text",
        "formats": [
          {
            "attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "format": "dif/presentation-exchange/[email protected]"
          }
        ],
        "proposals~attach": [
          {
            "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "byte_count": 1234,
            "data": {
              "base64": "ey4uLn0=",
              "json": "{\"sample\": \"content\"}",
              "jws": {
                "header": {
                  "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                },
                "protected": "ey4uLn0",
                "signature": "ey4uLn0",
                "signatures": [
                  {
                    "header": {
                      "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                    },
                    "protected": "ey4uLn0",
                    "signature": "ey4uLn0"
                  }
                ]
              },
              "links": [
                "https://link.to/data"
              ],
              "sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb"
            },
            "description": "view from doorway, facing east, with lights off",
            "filename": "IMG1092348.png",
            "lastmod_time": "2021-12-31T23:59:59Z",
            "mime-type": "image/png"
          }
        ]
      },
      "pres_request": {
        "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "@type": "https://didcomm.org/my-family/1.0/my-message-type",
        "comment": "text",
        "formats": [
          {
            "attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "format": "dif/presentation-exchange/[email protected]"
          }
        ],
        "request_presentations~attach": [
          {
            "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
            "byte_count": 1234,
            "data": {
              "base64": "ey4uLn0=",
              "json": "{\"sample\": \"content\"}",
              "jws": {
                "header": {
                  "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                },
                "protected": "ey4uLn0",
                "signature": "ey4uLn0",
                "signatures": [
                  {
                    "header": {
                      "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                    },
                    "protected": "ey4uLn0",
                    "signature": "ey4uLn0"
                  }
                ]
              },
              "links": [
                "https://link.to/data"
              ],
              "sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb"
            },
            "description": "view from doorway, facing east, with lights off",
            "filename": "IMG1092348.png",
            "lastmod_time": "2021-12-31T23:59:59Z",
            "mime-type": "image/png"
          }
        ],
        "will_confirm": true
      },
      "role": "prover",
      "state": "proposal-sent",
      "thread_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "trace": true,
      "updated_at": "2021-12-31T23:59:59Z",
      "verified": "true",
      "verified_msgs": [
        "text"
      ]
    }
  ]
}

Parameters

To narrow down the latest proof request, pass the following parameters

limit

Set this to 10.

offset

set this to 0.

state

Set this to "request-received"

Copy and save the pres_ex_id and the proof request by_format.pres_request.anoncreds from the response.

Fetch credentials from wallet for presentation request

get
Path parameters
pres_ex_idstringRequired

Presentation exchange identifier

Example: {"value":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}Pattern: [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}
Query parameters
countstringOptional

Maximum number to retrieve

Example: {"value":"1"}Pattern: ^[1-9][0-9]*$
extra_querystringOptional

(JSON) object mapping referents to extra WQL queries

Example: {"value":"{\"0_drink_uuid\": {\"attr::drink::value\": \"martini\"}}"}Pattern: ^{\s*".*?"\s*:\s*{.*?}\s*(,\s*".*?"\s*:\s*{.*?}\s*)*\s*}$
referentstringOptional

Proof request referents of interest, comma-separated

Example: {"value":"1_name_uuid,2_score_uuid"}
startstringOptional

Start index

Example: {"value":"0"}Pattern: ^[0-9]*$
Responses
200Success
application/json
get
GET /present-proof-2.0/records/{pres_ex_id}/credentials HTTP/1.1
Host: 
Accept: */*
200Success
[
  {
    "cred_info": {
      "attrs": {
        "ANY_ADDITIONAL_PROPERTY": "alice"
      },
      "cred_def_id": "WgWxqztrNooG92RXvxSTWv:3:CL:20:tag",
      "cred_rev_id": "12345",
      "referent": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "rev_reg_id": "WgWxqztrNooG92RXvxSTWv:4:WgWxqztrNooG92RXvxSTWv:3:CL:20:tag:CL_ACCUM:0",
      "schema_id": "WgWxqztrNooG92RXvxSTWv:2:schema_name:1.0"
    },
    "interval": {
      "from": 1640995199,
      "to": 1640995199
    },
    "presentation_referents": [
      "1_age_uuid"
    ]
  }
]

Fetch the relevant credentials and then create a proof response. Send the proof response by calling the below API.

Sends a proof presentation

post
Path parameters
pres_ex_idstringRequired

Presentation exchange identifier

Example: {"value":"3fa85f64-5717-4562-b3fc-2c963f66afa6"}Pattern: [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-4[a-fA-F0-9]{3}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}
Body
anoncredsall ofOptional

Presentation specification for anoncreds

auto_removebooleanOptional

Whether to remove the presentation exchange record on completion (overrides --preserve-exchange-records configuration setting)

difall ofOptional

Optional Presentation specification for DIF, overrides the PresentationExchange record's PresRequest

indyall ofOptional

Presentation specification for indy

tracebooleanOptional

Record trace information, based on agent configuration

Responses
200Success
application/json
post
POST /present-proof-2.0/records/{pres_ex_id}/send-presentation HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 2418

{
  "anoncreds": {
    "requested_attributes": {
      "ANY_ADDITIONAL_PROPERTY": {
        "cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "revealed": true
      }
    },
    "requested_predicates": {
      "ANY_ADDITIONAL_PROPERTY": {
        "cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "timestamp": 1640995199
      }
    },
    "self_attested_attributes": {
      "ANY_ADDITIONAL_PROPERTY": "self_attested_value"
    },
    "trace": false
  },
  "auto_remove": true,
  "dif": {
    "issuer_id": "text",
    "presentation_definition": {
      "format": {
        "di_vc": {},
        "jwt": {},
        "jwt_vc": {},
        "jwt_vp": {},
        "ldp": {},
        "ldp_vc": {},
        "ldp_vp": {}
      },
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "input_descriptors": [
        {
          "constraints": {
            "fields": [
              {
                "filter": {
                  "const": null,
                  "enum": [],
                  "exclusiveMaximum": null,
                  "exclusiveMinimum": null,
                  "format": "text",
                  "maxLength": 1234,
                  "maximum": null,
                  "minLength": 1234,
                  "minimum": null,
                  "not": false,
                  "pattern": "text",
                  "type": "text"
                },
                "id": "text",
                "path": [
                  "text"
                ],
                "predicate": "required",
                "purpose": "text"
              }
            ],
            "is_holder": [
              {
                "directive": "required",
                "field_id": [
                  "3fa85f64-5717-4562-b3fc-2c963f66afa6"
                ]
              }
            ],
            "limit_disclosure": "text",
            "status_active": "required",
            "status_revoked": "required",
            "status_suspended": "required",
            "subject_is_issuer": "required"
          },
          "group": [
            "text"
          ],
          "id": "text",
          "metadata": {},
          "name": "text",
          "purpose": "text",
          "schema": {
            "oneof_filter": [
              [
                {
                  "uri": "https://www.w3.org/Test1#Test1"
                },
                {
                  "uri": "https://www.w3.org/Test2#Test2"
                }
              ],
              {
                "oneof_filter": [
                  [
                    {
                      "uri": "https://www.w3.org/Test1#Test1"
                    }
                  ],
                  [
                    {
                      "uri": "https://www.w3.org/Test2#Test2"
                    }
                  ]
                ]
              }
            ]
          }
        }
      ],
      "name": "text",
      "purpose": "text",
      "submission_requirements": [
        {
          "count": 1234,
          "from": "text",
          "from_nested": "[Circular Reference]",
          "max": 1234,
          "min": 1234,
          "name": "text",
          "purpose": "text",
          "rule": "all"
        }
      ]
    },
    "record_ids": {
      "<input descriptor id_1>": [
        "<record id_1>",
        "<record id_2>"
      ],
      "<input descriptor id_2>": [
        "<record id>"
      ]
    },
    "reveal_doc": {
      "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/security/bbs/v1"
      ],
      "@explicit": true,
      "@requireAll": true,
      "credentialSubject": {
        "@explicit": true,
        "@requireAll": true,
        "Observation": [
          {
            "effectiveDateTime": {},
            "@explicit": true,
            "@requireAll": true
          }
        ]
      },
      "issuanceDate": {},
      "issuer": {},
      "type": [
        "VerifiableCredential",
        "LabReport"
      ]
    }
  },
  "indy": {
    "requested_attributes": {
      "ANY_ADDITIONAL_PROPERTY": {
        "cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "revealed": true
      }
    },
    "requested_predicates": {
      "ANY_ADDITIONAL_PROPERTY": {
        "cred_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "timestamp": 1640995199
      }
    },
    "self_attested_attributes": {
      "ANY_ADDITIONAL_PROPERTY": "self_attested_value"
    },
    "trace": false
  },
  "trace": true
}
200Success
{
  "auto_present": false,
  "auto_remove": false,
  "auto_verify": true,
  "by_format": {
    "pres": {},
    "pres_proposal": {},
    "pres_request": {}
  },
  "connection_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "created_at": "2021-12-31T23:59:59Z",
  "error_msg": "Invalid structure",
  "initiator": "self",
  "pres": {
    "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "@type": "https://didcomm.org/my-family/1.0/my-message-type",
    "comment": "text",
    "formats": [
      {
        "attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "format": "dif/presentation-exchange/[email protected]"
      }
    ],
    "presentations~attach": [
      {
        "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "byte_count": 1234,
        "data": {
          "base64": "ey4uLn0=",
          "json": "{\"sample\": \"content\"}",
          "jws": {
            "header": {
              "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
            },
            "protected": "ey4uLn0",
            "signature": "ey4uLn0",
            "signatures": [
              {
                "header": {
                  "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                },
                "protected": "ey4uLn0",
                "signature": "ey4uLn0"
              }
            ]
          },
          "links": [
            "https://link.to/data"
          ],
          "sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb"
        },
        "description": "view from doorway, facing east, with lights off",
        "filename": "IMG1092348.png",
        "lastmod_time": "2021-12-31T23:59:59Z",
        "mime-type": "image/png"
      }
    ]
  },
  "pres_ex_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "pres_proposal": {
    "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "@type": "https://didcomm.org/my-family/1.0/my-message-type",
    "comment": "text",
    "formats": [
      {
        "attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "format": "dif/presentation-exchange/[email protected]"
      }
    ],
    "proposals~attach": [
      {
        "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "byte_count": 1234,
        "data": {
          "base64": "ey4uLn0=",
          "json": "{\"sample\": \"content\"}",
          "jws": {
            "header": {
              "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
            },
            "protected": "ey4uLn0",
            "signature": "ey4uLn0",
            "signatures": [
              {
                "header": {
                  "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                },
                "protected": "ey4uLn0",
                "signature": "ey4uLn0"
              }
            ]
          },
          "links": [
            "https://link.to/data"
          ],
          "sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb"
        },
        "description": "view from doorway, facing east, with lights off",
        "filename": "IMG1092348.png",
        "lastmod_time": "2021-12-31T23:59:59Z",
        "mime-type": "image/png"
      }
    ]
  },
  "pres_request": {
    "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "@type": "https://didcomm.org/my-family/1.0/my-message-type",
    "comment": "text",
    "formats": [
      {
        "attach_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "format": "dif/presentation-exchange/[email protected]"
      }
    ],
    "request_presentations~attach": [
      {
        "@id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "byte_count": 1234,
        "data": {
          "base64": "ey4uLn0=",
          "json": "{\"sample\": \"content\"}",
          "jws": {
            "header": {
              "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
            },
            "protected": "ey4uLn0",
            "signature": "ey4uLn0",
            "signatures": [
              {
                "header": {
                  "kid": "did:sov:LjgpST2rjsoxYegQDRm7EL#keys-4"
                },
                "protected": "ey4uLn0",
                "signature": "ey4uLn0"
              }
            ]
          },
          "links": [
            "https://link.to/data"
          ],
          "sha256": "617a48c7c8afe0521efdc03e5bb0ad9e655893e6b4b51f0e794d70fba132aacb"
        },
        "description": "view from doorway, facing east, with lights off",
        "filename": "IMG1092348.png",
        "lastmod_time": "2021-12-31T23:59:59Z",
        "mime-type": "image/png"
      }
    ],
    "will_confirm": true
  },
  "role": "prover",
  "state": "proposal-sent",
  "thread_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "trace": true,
  "updated_at": "2021-12-31T23:59:59Z",
  "verified": "true",
  "verified_msgs": [
    "text"
  ]
}

Request Body

For this tutorial, as the credential is AnonCreds, we are sending an AnonCreds proof in the body. The values will be based on the presentation request and the credentials retrieved in the previous two steps.

{
    "anoncreds": {
        "requested_attributes": <<requestedAttributes>>,
        "requested_predicates": <<requestedPredicates>>,
        "self_attested_attributes": {}
}

Step 4: Ask Claude to validate the Presentation Response

Finally, you can ask Claude to check the status of the Proof Request with the following prompt.

"Can you check the status of the proof request?"

Claude should get the latest status and summarise if the verification result was true or false.

Last updated

Was this helpful?