# Build your integration with Claude Code or Cursor

> Let an AI coding tool write your Anpheros integration: the sandbox over MCP, a project rules file for medical data and a ready prompt to copy, for Claude Code, Cursor, VS Code or any assistant.

Source: https://developers.anpheros.com/guides/build-with-claude-code

Let an AI coding tool write your Anpheros integration, with your hands on the wheel. You give it
three things: the sandbox through MCP (so it sees real responses before writing code), the
documentation as Markdown, and a prompt with the rules that matter for medical data. Below are the
setup and a prompt to copy, for Claude Code, Cursor, VS Code or any assistant that reads files.

**In short:**

| Step | What you do | Time |
|---|---|---|
| 1. Key | Get a free sandbox key and put it in `ANPHEROS_KEY` | 1 min |
| 2. MCP | Connect the tool to `https://platform.anpheros.com/mcp` with that key | 1 min |
| 3. Rules file | Add the project rules below to `CLAUDE.md`, `AGENTS.md` or `.cursor/rules` | 1 min |
| 4. Prompt | Paste the prompt and describe what you are building | 1 min |
| 5. Review | Read the plan, run the tests in the sandbox, then commit | yours |

<!-- visual:seq-ai-build -->

## 1. Get a sandbox key

Follow [Your first API call in 2 minutes](https://developers.anpheros.com/guides/first-api-call) and keep the key in an environment
variable, never in a file the tool commits:

```bash
export ANPHEROS_KEY=sk_test_your_key_here
```

## 2. Connect the tool to the sandbox through MCP

With MCP the assistant can list sandbox patients, search FHIR, read a patient context and validate a
resource before it writes code, so the code matches real answers. Sandbox keys only reach synthetic
data; live keys are refused on MCP.

**Claude Code**

```bash
claude mcp add --transport http anpheros-fhir https://platform.anpheros.com/mcp --header "Authorization: Bearer $ANPHEROS_KEY"
```

**Cursor** (`.cursor/mcp.json` in the project, or `~/.cursor/mcp.json`)

```json
{"mcpServers": {"anpheros-fhir": {"url": "https://platform.anpheros.com/mcp",
  "headers": {"Authorization": "Bearer ${env:ANPHEROS_KEY}"}}}}
```

VS Code, Claude Desktop and the Claude and ChatGPT connectors: see [MCP server](https://developers.anpheros.com/guides/mcp).

## 3. Add the project rules

Save this as `CLAUDE.md` (Claude Code), `AGENTS.md` (many tools) or a rule in `.cursor/rules`, in the
root of your repository:

```markdown
# Anpheros integration rules

- API: REST https://platform.anpheros.com/v1, FHIR R4 https://platform.anpheros.com/fhir/R4.
  Reference: https://developers.anpheros.com/docs. Guides as Markdown: https://developers.anpheros.com/guides/<slug>.md
  (first-api-call, first-write, oauth-app, first-webhook, troubleshooting, go-live). All guides: https://developers.anpheros.com/llms-full.txt
- Key: read it from the ANPHEROS_KEY environment variable. Never write a key in code, tests, logs or commits.
  API keys stay on the server; an app acting for a person uses OAuth 2.1 with PKCE (guide: oauth-app).
- Before writing code that calls an endpoint, call it once in the sandbox (MCP tools or curl) and use the real response shape.
- Every create sends an Idempotency-Key and an author_type (patient, practitioner, device, import or ai).
- Codes: LOINC for observations, ICD-10 for conditions, UCUM units. Do not invent codes; use lookup_code if unsure.
- Handle errors from the response body (error.type and error.message, or OperationOutcome on /fhir/R4), retry 429 after
  Retry-After, and log the Anpheros-Request-Id. Fixes: https://developers.anpheros.com/guides/troubleshooting.md
- Webhooks: verify Anpheros-Signature (HMAC-SHA256 over "<t>." + raw body, 300 s tolerance) before parsing.
- The app does not diagnose and does not recommend medicines or doses. It stores and shows what clinicians and the person record.
- Use only synthetic sandbox data in development and tests. Never paste real patient data into the assistant.
```

## 4. The prompt

Paste this into the tool, then replace the last line with what you are building:

```text
You are helping me build an integration with the Anpheros health-data platform.
Read the project rules in CLAUDE.md / AGENTS.md first, then https://developers.anpheros.com/guides/first-api-call.md
and the guides it links to that match my goal.

1. Use the anpheros-fhir MCP tools to look at the sandbox: list_patients, then get_patient_context and search_fhir
   for one patient, so you know the real data and response shapes. Tell me what you found in 5 lines.
2. Propose a short plan: files, functions, which endpoints, which OAuth scopes if the app acts for a person,
   which webhook events if it needs to react to changes. Wait for my OK.
3. Write the code in small steps, with the key from ANPHEROS_KEY. After each step, run it against the sandbox
   and show me the request and the response. If a call fails, use the troubleshooting guide before changing code.
4. Add tests that run against the sandbox with synthetic patients only, and a README section on how to run them.

My goal: <describe your app, the language and the framework>
```

On the MCP server the same flow is also a ready prompt, **Build my integration with the Anpheros
API**: in Claude Code type `/` and pick it from the `anpheros-fhir` prompts.

## 5. Review before you commit

- Search the diff for `sk_test_` and `sk_live_`: no key may be in the code.
- Run the tests against the sandbox and read one request and response yourself.
- Check every write has an `Idempotency-Key` and an `author_type`.
- When it works, go on with the steps: [first write](https://developers.anpheros.com/guides/first-write), [OAuth app](https://developers.anpheros.com/guides/oauth-app),
  [webhooks](https://developers.anpheros.com/guides/first-webhook), [go live](https://developers.anpheros.com/guides/go-live).

## Frequently asked questions

### Does Anpheros work with Claude Code, Cursor and ChatGPT?
Yes. Any tool that speaks MCP over HTTP can use the sandbox with a key, and any assistant can read the guides as Markdown or `llms-full.txt`. Anpheros has no official partnership with these vendors; it is the data layer your code calls.

### Is it safe to give an AI tool my key?
Give it only a sandbox key, through an environment variable. Sandbox keys reach synthetic patients only, and live keys are refused on the MCP server.

### Which language should I ask for?
Any. There are SDKs for TypeScript and Dart; Python and other languages use plain HTTPS calls, as in the guides.
