curl --request POST \
--url https://{tenant}/api/mcps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"openapi": "3.0.3",
"info": {
"title": "MCP Proxy Sample",
"version": "1.0.0"
},
"paths": {},
"components": {},
"servers": [
{
"url": "/mcp-sample/"
}
],
"x-tyk-api-gateway": {
"info": {
"name": "mcp-sample",
"state": {
"active": true
}
},
"server": {
"listenPath": {
"strip": true,
"value": "/mcp-sample/"
},
"authentication": {
"enabled": true,
"securitySchemes": {
"authToken": {
"enabled": true
}
}
}
},
"upstream": {
"url": "http://localhost:7878/mcp"
},
"middleware": {
"global": {
"contextVariables": {
"enabled": true
},
"trafficLogs": {
"enabled": true
}
},
"mcpTools": {},
"operations": {}
}
}
}
'import requests
url = "https://{tenant}/api/mcps"
payload = {
"openapi": "3.0.3",
"info": {
"title": "MCP Proxy Sample",
"version": "1.0.0"
},
"paths": {},
"components": {},
"servers": [{ "url": "/mcp-sample/" }],
"x-tyk-api-gateway": {
"info": {
"name": "mcp-sample",
"state": { "active": True }
},
"server": {
"listenPath": {
"strip": True,
"value": "/mcp-sample/"
},
"authentication": {
"enabled": True,
"securitySchemes": { "authToken": { "enabled": True } }
}
},
"upstream": { "url": "http://localhost:7878/mcp" },
"middleware": {
"global": {
"contextVariables": { "enabled": True },
"trafficLogs": { "enabled": True }
},
"mcpTools": {},
"operations": {}
}
}
}
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({
openapi: '3.0.3',
info: {title: 'MCP Proxy Sample', version: '1.0.0'},
paths: {},
components: {},
servers: [{url: '/mcp-sample/'}],
'x-tyk-api-gateway': {
info: {name: 'mcp-sample', state: {active: true}},
server: {
listenPath: {strip: true, value: '/mcp-sample/'},
authentication: {enabled: true, securitySchemes: {authToken: {enabled: true}}}
},
upstream: {url: 'http://localhost:7878/mcp'},
middleware: {
global: {contextVariables: {enabled: true}, trafficLogs: {enabled: true}},
mcpTools: {},
operations: {}
}
}
})
};
fetch('https://{tenant}/api/mcps', 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://{tenant}/api/mcps",
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([
'openapi' => '3.0.3',
'info' => [
'title' => 'MCP Proxy Sample',
'version' => '1.0.0'
],
'paths' => [
],
'components' => [
],
'servers' => [
[
'url' => '/mcp-sample/'
]
],
'x-tyk-api-gateway' => [
'info' => [
'name' => 'mcp-sample',
'state' => [
'active' => true
]
],
'server' => [
'listenPath' => [
'strip' => true,
'value' => '/mcp-sample/'
],
'authentication' => [
'enabled' => true,
'securitySchemes' => [
'authToken' => [
'enabled' => true
]
]
]
],
'upstream' => [
'url' => 'http://localhost:7878/mcp'
],
'middleware' => [
'global' => [
'contextVariables' => [
'enabled' => true
],
'trafficLogs' => [
'enabled' => true
]
],
'mcpTools' => [
],
'operations' => [
]
]
]
]),
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://{tenant}/api/mcps"
payload := strings.NewReader("{\n \"openapi\": \"3.0.3\",\n \"info\": {\n \"title\": \"MCP Proxy Sample\",\n \"version\": \"1.0.0\"\n },\n \"paths\": {},\n \"components\": {},\n \"servers\": [\n {\n \"url\": \"/mcp-sample/\"\n }\n ],\n \"x-tyk-api-gateway\": {\n \"info\": {\n \"name\": \"mcp-sample\",\n \"state\": {\n \"active\": true\n }\n },\n \"server\": {\n \"listenPath\": {\n \"strip\": true,\n \"value\": \"/mcp-sample/\"\n },\n \"authentication\": {\n \"enabled\": true,\n \"securitySchemes\": {\n \"authToken\": {\n \"enabled\": true\n }\n }\n }\n },\n \"upstream\": {\n \"url\": \"http://localhost:7878/mcp\"\n },\n \"middleware\": {\n \"global\": {\n \"contextVariables\": {\n \"enabled\": true\n },\n \"trafficLogs\": {\n \"enabled\": true\n }\n },\n \"mcpTools\": {},\n \"operations\": {}\n }\n }\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://{tenant}/api/mcps")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"openapi\": \"3.0.3\",\n \"info\": {\n \"title\": \"MCP Proxy Sample\",\n \"version\": \"1.0.0\"\n },\n \"paths\": {},\n \"components\": {},\n \"servers\": [\n {\n \"url\": \"/mcp-sample/\"\n }\n ],\n \"x-tyk-api-gateway\": {\n \"info\": {\n \"name\": \"mcp-sample\",\n \"state\": {\n \"active\": true\n }\n },\n \"server\": {\n \"listenPath\": {\n \"strip\": true,\n \"value\": \"/mcp-sample/\"\n },\n \"authentication\": {\n \"enabled\": true,\n \"securitySchemes\": {\n \"authToken\": {\n \"enabled\": true\n }\n }\n }\n },\n \"upstream\": {\n \"url\": \"http://localhost:7878/mcp\"\n },\n \"middleware\": {\n \"global\": {\n \"contextVariables\": {\n \"enabled\": true\n },\n \"trafficLogs\": {\n \"enabled\": true\n }\n },\n \"mcpTools\": {},\n \"operations\": {}\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/mcps")
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 \"openapi\": \"3.0.3\",\n \"info\": {\n \"title\": \"MCP Proxy Sample\",\n \"version\": \"1.0.0\"\n },\n \"paths\": {},\n \"components\": {},\n \"servers\": [\n {\n \"url\": \"/mcp-sample/\"\n }\n ],\n \"x-tyk-api-gateway\": {\n \"info\": {\n \"name\": \"mcp-sample\",\n \"state\": {\n \"active\": true\n }\n },\n \"server\": {\n \"listenPath\": {\n \"strip\": true,\n \"value\": \"/mcp-sample/\"\n },\n \"authentication\": {\n \"enabled\": true,\n \"securitySchemes\": {\n \"authToken\": {\n \"enabled\": true\n }\n }\n }\n },\n \"upstream\": {\n \"url\": \"http://localhost:7878/mcp\"\n },\n \"middleware\": {\n \"global\": {\n \"contextVariables\": {\n \"enabled\": true\n },\n \"trafficLogs\": {\n \"enabled\": true\n }\n },\n \"mcpTools\": {},\n \"operations\": {}\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"Status": "OK",
"Message": "MCP Proxy definition created",
"ID": "e30bee13ad4248c3b529a4c58bb7be4e"
}{
"Status": "Error",
"Message": "the payload should contain x-tyk-api-gateway"
}{
"ID": "<string>",
"Message": "<string>",
"Meta": "<unknown>",
"Status": "<string>"
}Create an MCP Proxy definition.
Create an MCP Proxy definition. The request body is a Tyk OAS document that
must contain x-tyk-api-gateway with MCP configuration. The payload is
validated against the MCP JSON schema and rejected if it uses any restricted
middleware (transformRequestMethod, transformResponseBody, urlRewrite,
internal, cache, validateRequest, mockResponse).
When dryRun=true, the definition is validated and returned without being
persisted. When expand=true is also supplied for an internal
REST-as-MCP proxy target such as tyk://orders-rest/mcp, the response
includes the full derived x-tyk-mcp-server.primitives catalogue with
selected tools marked allow: true and unselected tools marked
allow: false. expand=true has no effect for remote MCP proxy
upstreams.
curl --request POST \
--url https://{tenant}/api/mcps \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"openapi": "3.0.3",
"info": {
"title": "MCP Proxy Sample",
"version": "1.0.0"
},
"paths": {},
"components": {},
"servers": [
{
"url": "/mcp-sample/"
}
],
"x-tyk-api-gateway": {
"info": {
"name": "mcp-sample",
"state": {
"active": true
}
},
"server": {
"listenPath": {
"strip": true,
"value": "/mcp-sample/"
},
"authentication": {
"enabled": true,
"securitySchemes": {
"authToken": {
"enabled": true
}
}
}
},
"upstream": {
"url": "http://localhost:7878/mcp"
},
"middleware": {
"global": {
"contextVariables": {
"enabled": true
},
"trafficLogs": {
"enabled": true
}
},
"mcpTools": {},
"operations": {}
}
}
}
'import requests
url = "https://{tenant}/api/mcps"
payload = {
"openapi": "3.0.3",
"info": {
"title": "MCP Proxy Sample",
"version": "1.0.0"
},
"paths": {},
"components": {},
"servers": [{ "url": "/mcp-sample/" }],
"x-tyk-api-gateway": {
"info": {
"name": "mcp-sample",
"state": { "active": True }
},
"server": {
"listenPath": {
"strip": True,
"value": "/mcp-sample/"
},
"authentication": {
"enabled": True,
"securitySchemes": { "authToken": { "enabled": True } }
}
},
"upstream": { "url": "http://localhost:7878/mcp" },
"middleware": {
"global": {
"contextVariables": { "enabled": True },
"trafficLogs": { "enabled": True }
},
"mcpTools": {},
"operations": {}
}
}
}
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({
openapi: '3.0.3',
info: {title: 'MCP Proxy Sample', version: '1.0.0'},
paths: {},
components: {},
servers: [{url: '/mcp-sample/'}],
'x-tyk-api-gateway': {
info: {name: 'mcp-sample', state: {active: true}},
server: {
listenPath: {strip: true, value: '/mcp-sample/'},
authentication: {enabled: true, securitySchemes: {authToken: {enabled: true}}}
},
upstream: {url: 'http://localhost:7878/mcp'},
middleware: {
global: {contextVariables: {enabled: true}, trafficLogs: {enabled: true}},
mcpTools: {},
operations: {}
}
}
})
};
fetch('https://{tenant}/api/mcps', 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://{tenant}/api/mcps",
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([
'openapi' => '3.0.3',
'info' => [
'title' => 'MCP Proxy Sample',
'version' => '1.0.0'
],
'paths' => [
],
'components' => [
],
'servers' => [
[
'url' => '/mcp-sample/'
]
],
'x-tyk-api-gateway' => [
'info' => [
'name' => 'mcp-sample',
'state' => [
'active' => true
]
],
'server' => [
'listenPath' => [
'strip' => true,
'value' => '/mcp-sample/'
],
'authentication' => [
'enabled' => true,
'securitySchemes' => [
'authToken' => [
'enabled' => true
]
]
]
],
'upstream' => [
'url' => 'http://localhost:7878/mcp'
],
'middleware' => [
'global' => [
'contextVariables' => [
'enabled' => true
],
'trafficLogs' => [
'enabled' => true
]
],
'mcpTools' => [
],
'operations' => [
]
]
]
]),
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://{tenant}/api/mcps"
payload := strings.NewReader("{\n \"openapi\": \"3.0.3\",\n \"info\": {\n \"title\": \"MCP Proxy Sample\",\n \"version\": \"1.0.0\"\n },\n \"paths\": {},\n \"components\": {},\n \"servers\": [\n {\n \"url\": \"/mcp-sample/\"\n }\n ],\n \"x-tyk-api-gateway\": {\n \"info\": {\n \"name\": \"mcp-sample\",\n \"state\": {\n \"active\": true\n }\n },\n \"server\": {\n \"listenPath\": {\n \"strip\": true,\n \"value\": \"/mcp-sample/\"\n },\n \"authentication\": {\n \"enabled\": true,\n \"securitySchemes\": {\n \"authToken\": {\n \"enabled\": true\n }\n }\n }\n },\n \"upstream\": {\n \"url\": \"http://localhost:7878/mcp\"\n },\n \"middleware\": {\n \"global\": {\n \"contextVariables\": {\n \"enabled\": true\n },\n \"trafficLogs\": {\n \"enabled\": true\n }\n },\n \"mcpTools\": {},\n \"operations\": {}\n }\n }\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://{tenant}/api/mcps")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"openapi\": \"3.0.3\",\n \"info\": {\n \"title\": \"MCP Proxy Sample\",\n \"version\": \"1.0.0\"\n },\n \"paths\": {},\n \"components\": {},\n \"servers\": [\n {\n \"url\": \"/mcp-sample/\"\n }\n ],\n \"x-tyk-api-gateway\": {\n \"info\": {\n \"name\": \"mcp-sample\",\n \"state\": {\n \"active\": true\n }\n },\n \"server\": {\n \"listenPath\": {\n \"strip\": true,\n \"value\": \"/mcp-sample/\"\n },\n \"authentication\": {\n \"enabled\": true,\n \"securitySchemes\": {\n \"authToken\": {\n \"enabled\": true\n }\n }\n }\n },\n \"upstream\": {\n \"url\": \"http://localhost:7878/mcp\"\n },\n \"middleware\": {\n \"global\": {\n \"contextVariables\": {\n \"enabled\": true\n },\n \"trafficLogs\": {\n \"enabled\": true\n }\n },\n \"mcpTools\": {},\n \"operations\": {}\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{tenant}/api/mcps")
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 \"openapi\": \"3.0.3\",\n \"info\": {\n \"title\": \"MCP Proxy Sample\",\n \"version\": \"1.0.0\"\n },\n \"paths\": {},\n \"components\": {},\n \"servers\": [\n {\n \"url\": \"/mcp-sample/\"\n }\n ],\n \"x-tyk-api-gateway\": {\n \"info\": {\n \"name\": \"mcp-sample\",\n \"state\": {\n \"active\": true\n }\n },\n \"server\": {\n \"listenPath\": {\n \"strip\": true,\n \"value\": \"/mcp-sample/\"\n },\n \"authentication\": {\n \"enabled\": true,\n \"securitySchemes\": {\n \"authToken\": {\n \"enabled\": true\n }\n }\n }\n },\n \"upstream\": {\n \"url\": \"http://localhost:7878/mcp\"\n },\n \"middleware\": {\n \"global\": {\n \"contextVariables\": {\n \"enabled\": true\n },\n \"trafficLogs\": {\n \"enabled\": true\n }\n },\n \"mcpTools\": {},\n \"operations\": {}\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"Status": "OK",
"Message": "MCP Proxy definition created",
"ID": "e30bee13ad4248c3b529a4c58bb7be4e"
}{
"Status": "Error",
"Message": "the payload should contain x-tyk-api-gateway"
}{
"ID": "<string>",
"Message": "<string>",
"Meta": "<unknown>",
"Status": "<string>"
}Authorizations
The Tyk Dashboard API Access Credentials
Query Parameters
Validate and render the MCP Proxy definition without persisting it.
Expand an internal REST-as-MCP proxy response with the full configurable tool catalogue.
Body
The description of OpenAPI v3.0.x documents, as defined by https://spec.openapis.org/oas/v3.0.3
^3\.0\.\d(-.+)?$Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?