> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dueflow.co/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server

> Use the API from ChatGPT, Claude or any MCP client – with OAuth or a bearer token.

Every endpoint in this reference is also a tool on the Dueflow MCP server:

```
https://api.dueflow.co/mcp
```

The server is the public API with a different transport. A tool call is
dispatched as the REST request it stands for, so scopes, role ceilings,
organization policy, rate limits and the activity log all apply exactly as they
do over HTTP – there is nothing extra to enable, and nothing an assistant can do
that the same token couldn't do with `curl`.

## Connect from ChatGPT or Claude

ChatGPT and Claude can't paste a token; they sign in with OAuth. Add Dueflow as a
custom connector (MCP server) with the URL above and choose OAuth if you are
asked. The client discovers everything else from the server.

<Steps>
  <Step title="Sign in to Dueflow">
    You are sent to `dueflow.co` to sign in with your usual account. Nothing
    is shared with the assistant until you approve the next screen.
  </Step>

  <Step title="Approve the connection">
    Pick the organization the assistant may act in and tick the scopes it may
    use. Scopes your role can't hold, or that the organization has
    [blocked](/authentication#organization-policy), are shown but can't be
    granted. Decline and the assistant gets nothing.
  </Step>

  <Step title="Ask away">
    The assistant now holds a short-lived access token (one hour) and a
    refresh token it renews silently. Every call it makes appears in the
    organization's API activity log, attributed to you via the app.
  </Step>
</Steps>

The connection appears under **Profile → Developer → Connected apps**, with
the organization, the granted scopes and when it was last used. **Disconnect**
revokes it immediately; the assistant has to be authorized again to continue.

<Note>
  A connection acts as you, with personal-token semantics: change roles and it
  narrows the same minute, leave the organization and it stops working. Scopes
  are re-evaluated every time the token is refreshed, so a connection can lose
  scopes over time but never gain them.
</Note>

## Connect with a bearer token

Clients that can send a header – Claude Code, Cursor, scripts, anything
headless – skip OAuth and use a
[personal or service token](/authentication#token-types) directly:

```bash theme={"system"}
claude mcp add --transport http dueflow https://api.dueflow.co/mcp \
  --header "Authorization: Bearer dfp_..."
```

This is the only way a **service token** reaches the MCP server. OAuth is a
person consenting, so it only ever issues personal-token access; an integration
that has to survive officer turnover uses a `dfs_` token in a header, as it
would for REST.

## Tools

`tools/list` returns one tool per endpoint the token is allowed to call, named
after the operation in `snake_case` – `GET /v1/members` is `get_members`,
`PATCH /v1/members/{memberId}` is `patch_members_by_member_id`. Path
parameters, query parameters and body fields are all arguments of the tool;
the input schema is the endpoint's, so the reference page for an endpoint
documents its tool too.

Tools the token's scopes can't call are omitted rather than listed and refused,
so an assistant never plans around something it can't do. An API error inside a
call – validation, `insufficient_scope`, `not_found` – comes back as a tool
result with `isError: true` and the same error body as REST, not as a
transport failure.

## For MCP client authors

The server implements the Streamable HTTP transport, statelessly: `POST`
JSON-RPC to the URL above with a bearer; there is no session header and no
server-to-client stream (`GET` returns `405`). An unauthenticated request
returns `401` with the protected-resource metadata the MCP authorization spec
requires:

```
WWW-Authenticate: Bearer resource_metadata="https://api.dueflow.co/.well-known/oauth-protected-resource/mcp"
```

Authorization server metadata (RFC 8414) is at
`https://dueflow.co/.well-known/oauth-authorization-server`. In short:

|                       |                                                                                                                                                                                                                                             |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Grant types           | `authorization_code` (PKCE `S256` required), `refresh_token`                                                                                                                                                                                |
| Client authentication | `none` – public clients only                                                                                                                                                                                                                |
| Client identification | [Client ID Metadata Documents](https://modelcontextprotocol.io/specification/draft/basic/authorization) (`client_id` is an `https` URL we fetch) or [dynamic registration](https://www.rfc-editor.org/rfc/rfc7591) at `/api/oauth/register` |
| Redirect URIs         | Exact match against the client's registered list; `https` or `http://localhost` only                                                                                                                                                        |
| Resource indicator    | `https://api.dueflow.co/mcp`; other values are `invalid_target`                                                                                                                                                                             |
| Access tokens         | Opaque `dfp_` tokens, one hour, bound to the grant                                                                                                                                                                                          |
| Refresh tokens        | `dfr_` tokens, rotated on every use; presenting a rotated-out token revokes the whole grant                                                                                                                                                 |
| Revocation            | RFC 7009 at `/api/oauth/revoke`, accepts either token                                                                                                                                                                                       |

Access tokens are ordinary personal tokens, so everything in
[Authentication](/authentication) about live roles, organization policy and
revocation applies to them unchanged.
