namespaces
Create a server under a namespace (deprecated)
deprecated
Deprecated: Use PUT /servers// instead. Create a new server under the specified namespace. This endpoint is idempotent.
PUT
/
namespaces
/
{namespace}
/
servers
/
{server}
JavaScript
import Smithery from '@smithery/api';
const client = new Smithery({
apiKey: process.env['SMITHERY_API_KEY'], // This is the default and can be omitted
});
const server = await client.namespaces.servers.create('xxx', { namespace: 'namespace' });
console.log(server.createdAt);curl --request PUT \
--url https://api.smithery.ai/namespaces/{namespace}/servers/{server} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"displayName": "My Server",
"description": "A simple server"
}
'import requests
url = "https://api.smithery.ai/namespaces/{namespace}/servers/{server}"
payload = {
"displayName": "My Server",
"description": "A simple server"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.smithery.ai/namespaces/{namespace}/servers/{server}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'displayName' => 'My Server',
'description' => 'A simple server'
]),
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.smithery.ai/namespaces/{namespace}/servers/{server}"
payload := strings.NewReader("{\n \"displayName\": \"My Server\",\n \"description\": \"A simple server\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.smithery.ai/namespaces/{namespace}/servers/{server}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"displayName\": \"My Server\",\n \"description\": \"A simple server\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smithery.ai/namespaces/{namespace}/servers/{server}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"displayName\": \"My Server\",\n \"description\": \"A simple server\"\n}"
response = http.request(request)
puts response.read_body{
"namespace": "myorg",
"server": "my-server",
"displayName": "My Server",
"description": "A simple server",
"createdAt": "2024-01-01T00:00:00.000Z"
}{
"error": "Forbidden: You don't own this server"
}{
"error": "Forbidden: You don't own this server"
}{
"error": "Forbidden: You don't own this server"
}{
"error": "Forbidden: You don't own this server"
}Authorizations
Smithery API key as Bearer token
Body
application/json
Was this page helpful?
Previous
List team API keysReturns all API keys belonging to the organization. Requires admin role. Key values are not included in the response.
Next
⌘I
JavaScript
import Smithery from '@smithery/api';
const client = new Smithery({
apiKey: process.env['SMITHERY_API_KEY'], // This is the default and can be omitted
});
const server = await client.namespaces.servers.create('xxx', { namespace: 'namespace' });
console.log(server.createdAt);curl --request PUT \
--url https://api.smithery.ai/namespaces/{namespace}/servers/{server} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"displayName": "My Server",
"description": "A simple server"
}
'import requests
url = "https://api.smithery.ai/namespaces/{namespace}/servers/{server}"
payload = {
"displayName": "My Server",
"description": "A simple server"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.smithery.ai/namespaces/{namespace}/servers/{server}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'displayName' => 'My Server',
'description' => 'A simple server'
]),
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.smithery.ai/namespaces/{namespace}/servers/{server}"
payload := strings.NewReader("{\n \"displayName\": \"My Server\",\n \"description\": \"A simple server\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.smithery.ai/namespaces/{namespace}/servers/{server}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"displayName\": \"My Server\",\n \"description\": \"A simple server\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.smithery.ai/namespaces/{namespace}/servers/{server}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"displayName\": \"My Server\",\n \"description\": \"A simple server\"\n}"
response = http.request(request)
puts response.read_body{
"namespace": "myorg",
"server": "my-server",
"displayName": "My Server",
"description": "A simple server",
"createdAt": "2024-01-01T00:00:00.000Z"
}{
"error": "Forbidden: You don't own this server"
}{
"error": "Forbidden: You don't own this server"
}{
"error": "Forbidden: You don't own this server"
}{
"error": "Forbidden: You don't own this server"
}