# Connect Claude Code and Cursor

> How to add Memberfy's MCP server to Claude Code (with the command or the .mcp.json) and to Cursor (with mcp.json), authorize in the browser and check the connection. For people who work in the terminal or the editor.

Claude Code and Cursor speak MCP over HTTP, just like Claude and ChatGPT: point them to **`https://api.memberfy.net/mcp`**. On the first call, they open the browser for you to authorize with your Memberfy account. There's no key to copy and no secret to keep in the project.

> [!TIP]
> The address and these steps are also in Memberfy itself. In **My Account › AI assistants** (`/account?tab=assistants`), or in **Settings › AI assistants** (owner and admin), the **Connect an assistant** block shows the **MCP server address** with a **Copy** button, and the steps for each assistant: **Claude**, **ChatGPT** and **Claude Code / Cursor** (with the command and the file snippet, under **Copy the snippet**).

## Claude Code

### With the command

In the terminal, in the project folder:

```bash
claude mcp add --transport http memberfy https://api.memberfy.net/mcp
```

To make it available in all your projects, not just this one, add `--scope user`.

### With the file

Or create (or edit) `.mcp.json` at the project root:

```json
{
  "mcpServers": {
    "memberfy": {
      "type": "http",
      "url": "https://api.memberfy.net/mcp"
    }
  }
}
```

`.mcp.json` can go into the repository: it has no secrets. Each person on the team authorizes with their own account and their own role.

### Authorizing

1. Open Claude Code and type `/mcp`.
2. Choose **memberfy** and the option to authenticate.
3. The browser opens the Memberfy screen. Sign in, choose the **community** and click **Allow**.
4. Back in the terminal, the server shows as connected, with its tools.
5. Test it: *"use memberfy and tell me which community you're connected to"*.

### Ready-made recipes

In Claude Code, Memberfy's eight recipes become commands: type `/` and pick, for example, `/mcp__memberfy__monthly_report` (the monthly report) or `/mcp__memberfy__create_course`. The list, and who sees each one, is in [Ready-made recipes in the menu](/mcp/conectar-o-claude#ready-made-recipes-in-the-menu). A session opened before October 6, 2026 may still show the old tool names: open a new session.

## Cursor

1. Open **Cursor Settings › MCP** and add a server, or edit the file directly:
   - `~/.cursor/mcp.json` for all projects;
   - `.cursor/mcp.json` in the project folder, for that project only.
2. Paste:

```json
{
  "mcpServers": {
    "memberfy": {
      "url": "https://api.memberfy.net/mcp"
    }
  }
}
```

3. Save. In **Cursor Settings › MCP**, the **memberfy** server appears asking you to log in: click to authenticate.
4. In the browser, sign in to Memberfy, choose the **community** and click **Allow**.
5. Back in Cursor, the server turns green, with the list of tools.
6. In Cursor's chat (agent mode), ask Memberfy for something.

## Other clients

Any MCP client that supports the **HTTP** transport (*streamable HTTP*) and **OAuth** with automatic discovery works with the same address. The server announces everything the client needs at `https://api.memberfy.net/.well-known/oauth-protected-resource/mcp`, and the client registers itself. Clients that only speak the local transport (*stdio*) need a bridge to HTTP.

## Technical details

| | |
|---|---|
| Address | `https://api.memberfy.net/mcp` (`POST` only) |
| Transport | HTTP, stateless: each call is independent |
| Authorization | OAuth 2.1 with PKCE (`S256`), dynamic client registration |
| Authorization redirect | Any `https://`, or `http://localhost` / `http://127.0.0.1` for local clients |
| Scopes | `read` and `write` (default: both). With only `read`, the create and money tools don't show up |
| Access token | 1 hour, renewed by the client on its own |
| Refresh token | 30 days, swapped on every use |

More in [Security and limits](/mcp/seguranca).

## Connection problems

| What happens | What to do |
|---|---|
| `401` on every call | The authorization didn't finish or was disconnected. Run `/mcp` (Claude Code) or click to authenticate (Cursor) again |
| The browser doesn't open | Copy the link the client shows and open it by hand |
| *"This access request isn't valid."* | Remove the server and add it again; the client's registration may have kept another redirect address |
| Many calls in a row start failing | The limit is 120 tool calls per minute per connection. Wait a minute |

More cases in [Common problems](/mcp/problemas-comuns).

## Related

- [MCP overview](/mcp/o-que-e-o-mcp)
- [Tools](/mcp/ferramentas)
- [API](/api/introducao): to integrate with code, without an assistant
