Skip to main content
POST
/
ai
/
mcp_servers
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const mcpServer = await client.ai.mcpServers.create({
  name: 'name',
  type: 'type',
  url: 'url',
});

console.log(mcpServer.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
)
mcp_server = client.ai.mcp_servers.create(
name="name",
type="type",
url="url",
)
print(mcp_server.id)
package main

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
mcpServer, err := client.AI.McpServers.New(context.TODO(), telnyx.AIMcpServerNewParams{
Name: "name",
Type: "type",
URL: "url",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", mcpServer.ID)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ai.mcpservers.McpServerCreateParams;
import com.telnyx.sdk.models.ai.mcpservers.McpServerCreateResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

McpServerCreateParams params = McpServerCreateParams.builder()
.name("name")
.type("type")
.url("url")
.build();
McpServerCreateResponse mcpServer = client.ai().mcpServers().create(params);
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

mcp_server = telnyx.ai.mcp_servers.create(name: "name", type: "type", url: "url")

puts(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 {
$mcpServer = $client->ai->mcpServers->create(
name: 'name',
type: 'type',
url: 'url',
allowedTools: ['string'],
apiKeyRef: 'api_key_ref',
);

var_dump($mcpServer);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx ai:mcp-servers create \
--api-key 'My API Key' \
--name name \
--type type \
--url url
curl --request POST \
--url https://api.telnyx.com/v2/ai/mcp_servers \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"type": "<string>",
"url": "<string>",
"api_key_ref": "<string>",
"allowed_tools": [
"<string>"
]
}
'
{
  "id": "<string>",
  "name": "<string>",
  "type": "<string>",
  "url": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "api_key_ref": "<string>",
  "allowed_tools": [
    "<string>"
  ]
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required
type
string
required
url
string
required
api_key_ref
string | null
allowed_tools
string[] | null

Response

Successful Response

id
string
required
name
string
required
type
string
required
url
string
required
created_at
string<date-time>
required
api_key_ref
string | null
allowed_tools
string[] | null