---
name: nfse-first-invoice
description: Use when a user wants to issue a Brazilian NFS-e (Nota Fiscal de Serviço eletrônica, padrão nacional, Sefin Nacional) with Nota4You. Takes the user from no account to the first authorized invoice through the Nota4You MCP server.
---

# Nota4You: first invoice

Nota4You issues Brazilian service invoices (NFS-e Nacional, with IBS and CBS) for the user's companies. You act through its MCP server. Talk to the user in Brazilian Portuguese unless they write in another language.

## 1. Account (the user does this)

You cannot create the account. Ask the user to open https://app-staging.nota4you.com.br/sign-up and sign up with Google, or with name, e-mail and password (then confirm the e-mail).

## 2. Connect the MCP server

Server URL: `https://app-staging.nota4you.com.br/mcp` (Streamable HTTP).

- If you can add MCP servers with OAuth (claude.ai connectors, ChatGPT connectors, Claude Code): add the URL with no headers. The user signs in, picks the scopes and companies, and approves you. Ask for `mcp taxpayers:read taxpayers:write invoices:read invoices:write`.
- Claude Code: `claude mcp add --transport http nota4you https://app-staging.nota4you.com.br/mcp`.
- Otherwise: ask the user to create an API key with the `mcp` scope in Configurações > Chaves de API, and send it as `Authorization: Bearer <key>`.
- If you cannot add MCP servers yourself, give the user these steps: https://staging.nota4you.com.br/docs/assistentes-de-ia.md

## 3. Follow the server

1. Call `get_setup_status` and follow its `next_step`. The prompt `first_invoice` has the full sequence.
2. Company: ask for the CNPJ, call `lookup_company`, show the data, ask for `missing_fields`, then `create_taxpayer`.
3. Service: `search_service_codes` with the user's words, then `create_service`.
4. Customer: `search_customers`, or `create_customer`.
5. `preview_invoice`. Show the preview (values, taxes, customer, service) to the user.
6. Certificate: call `request_certificate_upload` and give the user the link. The user opens it in a browser.
7. After the user confirms the preview: `emit_invoice` with the same fields, the `preview_id` and an `idempotency_key`.
8. Emission is asynchronous: call `get_invoice` until the status is `authorized` or `rejected`. Show the number and the DANFSe link, or the rejection messages.

## Rules

- Never ask for the certificate file or its password in the chat. Use `request_certificate_upload` only.
- Never call `emit_invoice` without the user's explicit confirmation of the preview.
- `cancel_invoice` is irreversible. Show the NFS-e number, customer, value and reason, and call it only after the user confirms. Follow it with `get_invoice` until the status is `cancelled` or the event is `rejected`.
- Reuse the same `idempotency_key` when you retry an emission, so the invoice is not issued twice.
- CPF numbers in results are masked on purpose. Do not ask the user to unmask them.
- On a `429` or `rate_limited` error, wait and retry later.

## REST API (no MCP)

Base URL `https://app-staging.nota4you.com.br/api/v1`, `Authorization: Bearer <key>`. Docs: https://staging.nota4you.com.br/docs/api.md. Contract: https://staging.nota4you.com.br/openapi.json (OpenAPI 3.1). Every POST that creates an invoice needs an `Idempotency-Key` header.

More: https://staging.nota4you.com.br/llms.txt
