Skip to documentation
Developer docs

OAuth and transport

Implement discovery, account consent, token rotation and client identification.

On this page

Discover the endpoints

Connect over Streamable HTTP at https://www.devguides.com/api/mcp. An unauthenticated POST returns HTTP 401 with a WWW-Authenticate bearer challenge pointing to the protected resource metadata. Follow the metadata links to build a public OAuth client.

EndpointPurpose
Protected resource metadataResource URL, bearer transport, supported scopes and authorization server.
Authorization server metadataIssuer, authorization and token endpoints, supported grant types and PKCE methods.
/account/connectBrowser sign-in and account consent. Start this URL with an authorization request from the client.
/api/oauth/tokenCode exchange and refresh. POST a form-encoded request.

Authorize and exchange

  1. Generate a fresh PKCE verifier, its S256 challenge and a state value. Open the authorization endpoint with response_type=code, client_id, redirect_uri, resource, code_challenge, code_challenge_method=S256 and state. The resource is the complete canonical MCP server URL.
  2. Optionally send a space-separated scope parameter. It must contain at least one DevGuides permission. The author can grant a subset. offline_access may accompany the request.
  3. Check the state and issuer on return. Exchange the code at the token endpoint using grant_type=authorization_code with client_id, the same redirect_uri and resource, the code and the original code_verifier. Use application/x-www-form-urlencoded and token authentication method none.
  4. Read access_token, token_type, scope, expires_in and refresh_token from the response. Use Authorization: Bearer <access_token> for MCP POST requests, then use tools/list to discover the consented tools. Tool calls return JSON in both structuredContent and a text content block.

Renew a connection

Access tokens last up to one hour. Refresh with grant_type=refresh_token, client_id and the current refresh_token. If you send resource, use the same canonical URL. Every successful refresh returns a new token pair. Store the new pair together before the next call and serialize refreshes per connection.

The refresh window is 30 days from issuance or rotation, up to 90 days from the initial exchange. A refresh keeps the granted scopes. Reuse of a retired refresh token after its ten-second concurrency grace period revokes the connection. A concurrent use during the grace period is still refused, so share the latest successful response within the client. After expiry or revocation, start a new consent flow.

Identify your client

The seven client setups use registered public client IDs with exact callback addresses. For a new integration you can identify a public client with an HTTPS Client ID Metadata Document. Serve JSON from a canonical public HTTPS URL with a path. The URL must return the document directly. Use that URL as the client_id in the authorization request.

json
{
  "client_id": "https://example.com/oauth/client.json",
  "client_name": "Example writing client",
  "redirect_uris": ["https://example.com/oauth/callback"],
  "token_endpoint_auth_method": "none"
}

Replace the example host and callback with your own. The document must repeat its own URL, declare none explicitly and list one to ten callbacks. Use public HTTPS callbacks or HTTP loopback addresses. A metadata client may vary a loopback port while keeping the same scheme, host and path. DevGuides rechecks expired metadata during authorization or token refresh. A change to the registered name or callbacks requires fresh consent.