curl --request POST \
--url https://{tenant}/tyk/mcps \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--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}/tyk/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 = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tyk-Authorization': '<api-key>', '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}/tyk/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}/tyk/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 => [
"Content-Type: application/json",
"X-Tyk-Authorization: <api-key>"
],
]);
$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}/tyk/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("X-Tyk-Authorization", "<api-key>")
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}/tyk/mcps")
.header("X-Tyk-Authorization", "<api-key>")
.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}/tyk/mcps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
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{
"action": "added",
"key": "e30bee13ad4248c3b529a4c58bb7be4e",
"status": "ok"
}{
"message": "the payload should contain x-tyk-api-gateway",
"status": "error"
}{
"message": "<string>",
"status": "<string>"
}Create an MCP Proxy definition.
Create an MCP Proxy definition from a Tyk OAS document. The payload must
contain the Tyk Vendor Extension (x-tyk-api-gateway) extension with MCP configuration and is
validated against the MCP JSON schema (/tyk/schema?type=mcp) before being
stored. The Gateway must be reloaded (POST /tyk/reload) for the new MCP
Proxy definition to take effect.
When dryRun=true, the definition is validated and returned without being
persisted, written to disk, versioned, or reloaded. 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}/tyk/mcps \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--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}/tyk/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 = {
"X-Tyk-Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Tyk-Authorization': '<api-key>', '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}/tyk/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}/tyk/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 => [
"Content-Type: application/json",
"X-Tyk-Authorization: <api-key>"
],
]);
$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}/tyk/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("X-Tyk-Authorization", "<api-key>")
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}/tyk/mcps")
.header("X-Tyk-Authorization", "<api-key>")
.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}/tyk/mcps")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Tyk-Authorization"] = '<api-key>'
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{
"action": "added",
"key": "e30bee13ad4248c3b529a4c58bb7be4e",
"status": "ok"
}{
"message": "the payload should contain x-tyk-api-gateway",
"status": "error"
}{
"message": "<string>",
"status": "<string>"
}Authorizations
Api key
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?