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.
| Endpoint | Purpose |
|---|---|
| Protected resource metadata | Resource URL, bearer transport, supported scopes and authorization server. |
| Authorization server metadata | Issuer, authorization and token endpoints, supported grant types and PKCE methods. |
/account/connect | Browser sign-in and account consent. Start this URL with an authorization request from the client. |
/api/oauth/token | Code exchange and refresh. POST a form-encoded request. |
Authorize and exchange
- 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=S256andstate. The resource is the complete canonical MCP server URL. - Optionally send a space-separated
scopeparameter. It must contain at least one DevGuides permission. The author can grant a subset.offline_accessmay accompany the request. - Check the state and issuer on return. Exchange the code at the token endpoint using
grant_type=authorization_codewithclient_id, the sameredirect_uriandresource, thecodeand the originalcode_verifier. Useapplication/x-www-form-urlencodedand token authentication methodnone. - Read
access_token,token_type,scope,expires_inandrefresh_tokenfrom the response. UseAuthorization: Bearer <access_token>for MCP POST requests, then usetools/listto discover the consented tools. Tool calls return JSON in bothstructuredContentand 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.
{
"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.