MCP · Sign-in

Should I connect MCP with OAuth or with an API key?

Use OAuth, the sign-in through the browser, wherever your assistant supports it: you copy no secret, and access renews itself until 90 days after your "Allow". Use the API key, called "key" in the app, for scripts and software without a browser. It lasts 90 days and is shown only once.

Wypróbuj 30 dni, zwrot pieniędzy
Simon OrzelCory Hisey

Umów rozmowę

Simon OrzelSimon Orzel·

When do I use OAuth, and when the API key?

OAuth, wherever the client supports it. Claude Code, Claude on the web and desktop, Copilot Studio and ChatGPT describe the browser sign-in in their guides; according to OpenAI, ChatGPT cannot send a key.

So far we have tested Claude Code, both ways.

The API key for scripts, your own agents and software that cannot open a browser. Keep it in an environment variable or a password manager, in no file you share or put in a repository.

How does the OAuth sign-in work?

The assistant opens your instance's sign-in page. You sign in, see which assistant asks for which company and where the browser returns to, and click "Allow".

OAuth is the way for software to sign in on your behalf without seeing your password. The walkthrough uses OAuth 2.1 with PKCE: only the client that started the sign-in can collect the access.

The client registers itself along the way (Dynamic Client Registration). The instance is its own sign-in service, so even when self-hosted no third party is involved.

How long does the OAuth sign-in last?

The assistant gets two tokens, passes with an expiry date. It calls the walkthrough with the access token, which lasts an hour. With the refresh token it gets a new one, and every renewal also replaces the refresh token, which lasts 30 days.

If the same refresh token comes in again within a minute, the server still accepts it. That happens when a client renews twice at once, or an answer is lost on the way.

If it comes in again later, the server treats it as copied and disconnects every assistant of that person, the key included. If the original and a copy both renewed within that minute, it shows once both renew again.

At the latest 90 days after your "Allow", the sign-in ends, however often the assistant renewed. Then you allow it again.

How does the API key work?

In Settings, "Create key" makes a key. It is shown only at that moment and stored nowhere, so the app cannot show it again.

It lasts 90 days, as you and with your role, in the company that was open when you made it. The client sends it in the Authorization header as Bearer.

You hold one key per company. A new one ends the previous key; assistants that signed in through the browser stay connected.

Why do both ask for a recent sign-in?

Both survive signing out of the browser: an assistant stays connected even after you sign out. That is why "Create key" and "Allow" ask for a sign-in from the last 15 minutes.

With an older session the page sends you to sign in and then brings you back.

The app tells you by email about every new connection. If it was not you, disconnect all assistants and change your password.

What ends a connection?

"Disconnect" in Settings ends one connection at its next call. "Disconnect all assistants" and any change to your password end the key and every browser sign-in at once.

If you leave the company or are removed, both end for good. If an admin turns off "Allow AI assistants for this company", every member's connections end. Our article on revoking MCP access has the details.

How the walkthrough does it

How people sign in is itself an item of the walkthrough.

11.1 "Record where a second factor protects": for each program and access on your list, the item records how people sign in: password only, with a second factor and which one, or not known yet.

A connected assistant can fill this in. Each row starts at "Password only", the safe assumption; give it a source, such as an overview from your account administration, and have it choose "Not known yet" where the source shows nothing.

List the assistant itself in 2.2 under "Software everyone uses", and 11.1 then also asks how you sign in to it.

Every screen an assistant wrote shows its name and the day; you finish 11.1 in the app.

Common questions

Does the MCP server support Dynamic Client Registration or CIMD?

Only Dynamic Client Registration under RFC 7591: the client registers itself at its first sign-in. Client ID Metadata Documents (CIMD), a published document a client identifies itself with, are not supported by the sign-in service. That is why you choose "Register automatically" in Claude.

Can I connect several assistants at once?

Yes. Each browser sign-in is a connection of its own, plus one key per company. Settings lists them all under "Connected", with the day each was connected and last used, and each can be disconnected on its own.

What happens after 90 days?

The key stops working; create a new one and enter it in the client. A browser sign-in ends 90 days after "Allow", and then you allow the assistant again.

Does an API key work for several companies?

No. It works in the company that was open when you made it. For another company, switch in the app and create a key there.

Read next

Sources

  • MCP specification 2026-07-28, Authorization and Security Considerations, modelcontextprotocol.io
  • RFC 7636 (PKCE) and RFC 7591 (Dynamic Client Registration), rfc-editor.org
  • open-isms, lib/mcp/oauth.ts and lib/mcp/key.ts, github.com/NISD2/open-isms
  • open-isms, lib/auth/session-age.ts and lib/auth/credential-change.ts, github.com/NISD2/open-isms
  • open-isms, MCP server documentation, content/docs/self-hosting/mcp.md, github.com/NISD2/open-isms

W praktyce

Gdzie to pojawia się w przewodniku krok po kroku

Przewodnik zamienia to w kroki do wypełnienia, a przy każdym z nich wyjaśnia przepisy. Otwórz krok, aby zobaczyć jego ekran wypełniony dla fikcyjnej firmy.

Sam przewodnik jest po niemiecku i po angielsku.

  1. Authentication & Communications

    Record where a second factor protects

    For each program on your list: password alone, or with a second factor.

Ile kosztuje przewodnik

Przewodnik krok po kroku po NIS2
Wdrożenie z przewodnikiem na nisd2.eu.

4800 € netto rocznie, plus VAT

30 dni na zwrot pieniędzy

Na fakturę, płatną w 30 dni. Rezygnacja w ciągu pierwszych 30 dni: faktura zostaje anulowana albo zwracamy pieniądze.

Wdrożenie NIS 2 z przewodnikiem, krok po kroku

Historia zmian i zatwierdzeń do pokazania organowi nadzoru

Terminy i przypomnienia dla każdego wymagania

Kwestionariusz bezpieczeństwa dla Twoich dostawców

Eksport do PDF lub CSV w dowolnym momencie

Ceny i warunki

Masz zająć się NIS2?

Prowadzimy Cię krok po kroku. Ty wypełniasz, my wyjaśniamy każdy punkt prostymi słowami, a na końcu podpisuje kierownictwo.

Wypróbuj 30 dni, zwrot pieniędzy
Simon OrzelCory Hisey

Umów rozmowę

Bezpłatne szkolenie dla zarząduCeny i warunki
Przewodnik NIS2: Twoja ścieżka krok po kroku, pierwsze punkty gotowe