# Build an AI agent

Ziffi exposes the same capabilities over the Model Context Protocol (MCP), so an AI agent can search, compare, price, and recommend products with no glue code. The MCP server mirrors the REST API, so there is one source of truth.

**MCP endpoint**

```text
https://dev.ziffi.xyz/v1/mcp
```

It speaks JSON-RPC 2.0. Read tools need no key; a key credits attribution.

## List the tools

```bash
curl -X POST "https://dev.ziffi.xyz/v1/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
```

Tools include `search_products`, `get_product`, `get_price`, `recommend`, `browse`, `suggest`, `find_coupons`, `list_brands`, and `list_categories`.

## Call a tool

```bash
curl -X POST "https://dev.ziffi.xyz/v1/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",
       "params":{"name":"search_products","arguments":{"q":"gift for a new mom","limit":5}}}'
```

## A worked flow

An assistant helping a shopper would chain tools:

1. `search_products` with the shopper's request to get candidates.
2. `get_product` on a candidate for full detail and reviews.
3. `get_price` for the exact price and stock right now.
4. `recommend` for alternatives across brands.

## Connect a client

- **ChatGPT**: add a connector or action pointing at the OpenAPI at `/openapi.json`. Read actions need no auth; attribution uses an `X-Ziffi-Key` credential.
- **Claude**: add a custom connector with the MCP URL above.
- **Any MCP client**: standard `tools/list` and `tools/call`.

Try every tool live in the [Playground](/dev/) under MCP.

## Next steps

- [MCP and connectors](#/mcp): the tool catalog and setup detail.
- [Search products](#/search): the REST equivalent.
