Delete an MCP server
Removes an MCP server and returns it as it was. Its id stays in the tool permissions that name it until they are next set. The instance must be ready; otherwise the request answers 409.
DELETE
/
agent_gateways
/
{instance_id}
/
mcp_servers
/
{server_id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
await client.agentGateways.mcpServers.delete('instance_id', 'server_id');import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.agent_gateways.mcp_servers.delete(
"instance_id",
"server_id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.AgentGateways.MCPServers.Delete(
context.TODO(),
"instance_id",
"server_id",
)
if err != nil {
panic(err.Error())
}
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
client.agentGateways().mcpServers().delete("instance_id", "server_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_mcp_server = telnyx.agent_gateways.mcp_servers.delete("instance_id", "server_id")
puts(agent_gateway_mcp_server)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$agent_gateway_mcp_server = $client->agentGateways->mcpServers->delete(
'instance_id',
'server_id',
);
var_dump($agent_gateway_mcp_server);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:mcp-servers delete \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--server-id 88d5a97b-4080-4855-8bac-a39811b1dc24curl --request DELETE \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/mcp_servers/{server_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"id": "88d5a97b-4080-4855-8bac-a39811b1dc24",
"name": "orders",
"url": "http://10.40.3.7:9000/mcp",
"transport": "http",
"auth": {
"type": "api_key"
},
"tools": [],
"static_headers": {
"X-Env": "prod"
},
"forwarded_headers": [
"X-Request-Id"
],
"open_to_every_key": false,
"created_at": "2026-10-28T16:50:43.184000Z",
"updated_at": "2026-10-28T16:50:43.184000Z"
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}{
"errors": [
{
"code": "99901",
"title": "Instance not ready",
"detail": "The instance is not ready; its engine is not running."
}
]
}{
"errors": [
{
"code": "99903",
"title": "Engine unavailable",
"detail": "The instance's engine did not answer; try again shortly."
}
]
}Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
await client.agentGateways.mcpServers.delete('instance_id', 'server_id');import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.agent_gateways.mcp_servers.delete(
"instance_id",
"server_id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.AgentGateways.MCPServers.Delete(
context.TODO(),
"instance_id",
"server_id",
)
if err != nil {
panic(err.Error())
}
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
client.agentGateways().mcpServers().delete("instance_id", "server_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_mcp_server = telnyx.agent_gateways.mcp_servers.delete("instance_id", "server_id")
puts(agent_gateway_mcp_server)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$agent_gateway_mcp_server = $client->agentGateways->mcpServers->delete(
'instance_id',
'server_id',
);
var_dump($agent_gateway_mcp_server);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:mcp-servers delete \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--server-id 88d5a97b-4080-4855-8bac-a39811b1dc24curl --request DELETE \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/mcp_servers/{server_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"id": "88d5a97b-4080-4855-8bac-a39811b1dc24",
"name": "orders",
"url": "http://10.40.3.7:9000/mcp",
"transport": "http",
"auth": {
"type": "api_key"
},
"tools": [],
"static_headers": {
"X-Env": "prod"
},
"forwarded_headers": [
"X-Request-Id"
],
"open_to_every_key": false,
"created_at": "2026-10-28T16:50:43.184000Z",
"updated_at": "2026-10-28T16:50:43.184000Z"
}
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}{
"errors": [
{
"code": "99901",
"title": "Instance not ready",
"detail": "The instance is not ready; its engine is not running."
}
]
}{
"errors": [
{
"code": "99903",
"title": "Engine unavailable",
"detail": "The instance's engine did not answer; try again shortly."
}
]
}