Finish connecting an MCP server with OAuth
curl --request POST \
--url https://api.runaether.dev/mcp-servers/oauth/callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "<string>",
"code": "<string>",
"error": "<string>",
"iss": "<string>"
}
'import requests
url = "https://api.runaether.dev/mcp-servers/oauth/callback"
payload = {
"state": "<string>",
"code": "<string>",
"error": "<string>",
"iss": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: '<string>', code: '<string>', error: '<string>', iss: '<string>'})
};
fetch('https://api.runaether.dev/mcp-servers/oauth/callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runaether.dev/mcp-servers/oauth/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'state' => '<string>',
'code' => '<string>',
'error' => '<string>',
'iss' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/mcp-servers/oauth/callback"
payload := strings.NewReader("{\n \"state\": \"<string>\",\n \"code\": \"<string>\",\n \"error\": \"<string>\",\n \"iss\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runaether.dev/mcp-servers/oauth/callback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"state\": \"<string>\",\n \"code\": \"<string>\",\n \"error\": \"<string>\",\n \"iss\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/mcp-servers/oauth/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"state\": \"<string>\",\n \"code\": \"<string>\",\n \"error\": \"<string>\",\n \"iss\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"mcp_server_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"oauth_error": "<string>",
"return_to": "<string>",
"status": "connected"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "org_membership_required",
"error": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}MCP Servers
Finish connecting an MCP server with OAuth
Finishes an MCP server OAuth connection, the caller's own or the organization's, with the authorization response the browser brought back to the web app's callback page.
Use this tool when you need to:
- Complete a connection begun with startMcpServerOAuth or startOrgMcpServerOAuth once the authorization server redirects back
- Learn how an authorization ended, connected or why not, and where the callback page goes next
Examples:
- POST /mcp-servers/oauth/callback {"state": "AAECAwQFBgcICQ", "code": "SplxlOBeZQQYbYS6WxSbIA", "iss": "https://auth.acme.dev"}
- POST /mcp-servers/oauth/callback {"state": "AAECAwQFBgcICQ", "error": "access_denied"}
Hints:
- state is required (up to 8192 characters), beside the response's code (up to 4096) or error (up to 256); iss is the response's RFC 9207 iss parameter exactly as received, omitted when the response carried none.
- Answers 200 with a typed status: connected, invalid_state, state_expired (over 15 minutes since the start), other_user, not_authorized, iss_mismatch, authorization_failed, exchange_failed, token_invalid, server_changed or oauth_app_deleted; oauth_error is the authorization server's error code when it sent one.
- mcp_server_id is nullable: it names the server once the state opened for the user who started it and they are still authorized, and for server_changed; it is null for invalid_state, state_expired, other_user and not_authorized.
- Only the user who started the authorization finishes it, while still an owner, admin or member of the server's organization and, for the organization's connection, still an owner or admin (not_authorized otherwise); a response finished in another user's session is other_user, refused before its code is redeemed.
- The grant is stored encrypted on the connection when the status is connected. return_to is the start's return_to whenever the state opened, refusals included, for the callback page to go there with the outcome; null when the start named none or the state did not open.
- Use startMcpServerOAuth or startOrgMcpServerOAuth instead to begin a connection; this operation only finishes one.
- Called by the web app's callback page in the signed-in user's session; any signed-in user may call it. Refused with 422 for a body the schema refuses and 500 on an internal failure; every other outcome is a status in a 200.
- An agent host's grant is refused with 403 agent_host_route_not_allowed.
POST
/
mcp-servers
/
oauth
/
callback
Finish connecting an MCP server with OAuth
curl --request POST \
--url https://api.runaether.dev/mcp-servers/oauth/callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"state": "<string>",
"code": "<string>",
"error": "<string>",
"iss": "<string>"
}
'import requests
url = "https://api.runaether.dev/mcp-servers/oauth/callback"
payload = {
"state": "<string>",
"code": "<string>",
"error": "<string>",
"iss": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({state: '<string>', code: '<string>', error: '<string>', iss: '<string>'})
};
fetch('https://api.runaether.dev/mcp-servers/oauth/callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runaether.dev/mcp-servers/oauth/callback",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'state' => '<string>',
'code' => '<string>',
'error' => '<string>',
'iss' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/mcp-servers/oauth/callback"
payload := strings.NewReader("{\n \"state\": \"<string>\",\n \"code\": \"<string>\",\n \"error\": \"<string>\",\n \"iss\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.runaether.dev/mcp-servers/oauth/callback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"state\": \"<string>\",\n \"code\": \"<string>\",\n \"error\": \"<string>\",\n \"iss\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/mcp-servers/oauth/callback")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"state\": \"<string>\",\n \"code\": \"<string>\",\n \"error\": \"<string>\",\n \"iss\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"mcp_server_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"oauth_error": "<string>",
"return_to": "<string>",
"status": "connected"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "org_membership_required",
"error": "<string>"
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "account_deleting",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Authorizations
Body
application/json
Response
OK
The Aether mobile app's deep link or the server's connect page the start asked to end at, for the callback page to go there with this outcome. Null when the start named none, or when the state could not be opened.
Pattern:
^(aether://mcp-connected|/connect/[a-z][a-z0-9_-]{0,31})$