# Tutorial: a Stripe webhook in Cursor

Add a Stripe webhook handler to an existing project by reusing a component instead of writing one from scratch. Time: about ten minutes. Cost: 1 credit for the pull; everything before it is free.

## Before you start

- Cursor with the JustClaw-It server in `~/.cursor/mcp.json`: [Cursor setup](/docs/clients/cursor).
- A project where the handler should live. The example uses Python; name your own language in the prompts.

## 1. Search

In Agent mode, ask:

> Search JustClaw-It for a Stripe webhook handler in Python that verifies the signature. Permissive licences only, min composite 6. Show the top three with licence and score.

The agent calls `search_components`, which is free. Look at three things in each result: whether it does what you need, its `composite` score, and its licence.

## 2. Check the one you like

> Check that component for security advisories, and show me two similar ones.

This uses `check_component_security` and `find_similar`, both free. If a result carries a `security_advisories` warning, read it before going further: [Security advisories](/docs/security-advisories).

## 3. Pull and adapt

> Pull that component into `app/webhooks/stripe.py`, adapt it to this project's naming and config, and keep the attribution header.

`get_component` costs 1 credit and returns the full source, a link to the original file, the SPDX licence, the copyright holder and an attribution header.

## 4. Keep the attribution

> Add an entry for it to THIRD_PARTY_LICENSES.

The header stays at the top of the file, and the licence text goes in your notices file. This is what the licence requires: [Licences & attribution](/docs/licences).

## 5. Test it

Reused code still needs your tests. Ask the agent to write one for a valid signature and one for an invalid signature, then run them. A score is a signal, not a guarantee.

## If something goes wrong

- No tools listed in Cursor: check the URL ends in `/mcp` and the header is `Bearer` followed by your key.
- "Out of credits": pulls resume at the next refill; search keeps working.

More: [Troubleshooting](/docs/troubleshooting). Next: [Licence-audit a repository](/docs/tutorials/licence-audit).
