Sign in with OAuth
After this page you know how an app that supports MCP OAuth connects to CountViews with no pasted key, what the person approves, and what the app ends up holding. The result is an ordinary cvk_… key, so everything in Set up MCP and REST applies to it.
The flow
Section titled “The flow”- The app calls
https://countviews.com/mcpwith no key and gets401withWWW-Authenticate: Bearer resource_metadata="…", scope="…". - It reads the discovery documents below, registers itself, makes a PKCE pair and sends the person to
/oauth/authorize. - The person signs in (they need the right to manage API access) and sees one consent screen: which workspace, the app’s name next to the address the browser will return to, and a checkbox per permission.
- The app exchanges the one-time code for a key at
/api/oauth/token.
| Document or endpoint | Address |
|---|---|
| Protected resource (RFC 9728) | /.well-known/oauth-protected-resource (also …/mcp and …/api/public/v1/mcp; each names the address you asked about) |
| Authorization server (RFC 8414) | /.well-known/oauth-authorization-server |
| Dynamic client registration (RFC 7591) | POST /api/oauth/register |
| Authorize (consent screen) | /oauth/authorize |
| Token | POST /api/oauth/token |
| Revoke (RFC 7009) | POST /api/oauth/revoke |
Rules a client must follow:
- Grant type
authorization_codeonly. PKCE withS256is required;plainis refused. Clients are public (no client secret). - Send
resourceashttps://countviews.com/mcpor the long alias; any other value isinvalid_target. - A
redirect_uriishttps, orhttponlocalhost,127.0.0.1or[::1](the port is ignored for those). It must match what you registered, byte for byte. Custom schemes such ascursor://are not accepted, which is why Cursor connects with a key. - The code lives 60 seconds and works once. Present it twice and, if the verifier is right, the key it produced is revoked.
What the person approves
Section titled “What the person approves”Only the read permissions are ticked by default. Writing drafts, deciding clips, setting up the company and requesting invoices are each an unticked box. If the person ticks launching, the key still asks them on every launch unless they also give it limits. See Permissions and Money and approvals.
The app’s name is whatever it registered. CountViews does not verify who makes it, and the screen says so.
Token lifetime
Section titled “Token lifetime”One key exists per app, person and workspace; signing in again from the same app replaces its key. A workspace holds at most 5 live keys, and OAuth keys count.
Revoking
Section titled “Revoking”- In the workspace, Agent: the key is listed as a sign-in from the app’s name. Revoke it there; the next request is
401. - The app can revoke its own token at
/api/oauth/revoke. The answer is the same whether the token was live, revoked or unknown.
What has been checked
Section titled “What has been checked”| Checked | Not checked |
|---|---|
The official MCP SDK client (@modelcontextprotocol/client 2.3.1) completed the whole path against these endpoints: 401, discovery, registration, PKCE, consent, code exchange, tools/list, whoami. The races (twelve parallel exchanges of one code give one key) are tested on a real database. |
Live ChatGPT, claude.ai and Claude Code sign-in against production have not been run. The menu names in the wizard recipes for these apps come from vendor documentation and may be out of date. Client ID Metadata Documents are not supported; registration is dynamic only. |
If an app cannot sign in, make a key in the workspace and use the key recipes.