POST /api/mcp/test Bearer

Test MCP Server

Test an MCP server connection by starting it temporarily and listing its available tools. Returns the tool count and tool names to verify the server is working correctly.

Overview

Tests connectivity to an MCP server without persisting it to configuration. Useful for validating server settings before adding them. Returns the connection status and list of available tools.

Request Body

Body Parameters

name required
string

A temporary name for the test connection.

transport required
string

Transport protocol to test.

Allowed values:
stdiohttp
command
string

Command for stdio transport.

args
array

Arguments for stdio transport.

url
string

Server URL for http transport.

env
object

Environment variables to pass.

Response

connected boolean
Whether the connection succeeded
error string nullable
Error message if connection failed
tools array
List of tool names discovered from the server
Terminal window
curl -X POST "http://localhost:8000/api/mcp/test" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "filesystem",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"],
"env": {}
}'
const response = await fetch("http://localhost:8000/api/mcp/test", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
name: "filesystem",
transport: "stdio",
command: "npx",
args: ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"],
env: {}
})
});
const data = await response.json();
console.log(data);
import requests
response = requests.post(
"http://localhost:8000/api/mcp/test",
headers={"Authorization": "Bearer <token>"},
json={
"name": "filesystem",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"],
"env": {}
}
)
print(response.json())
{
"connected": true,
"error": null,
"tools": ["read_file", "write_file", "list_directory", "search_files"]
}
{
"connected": false,
"error": "Connection timed out after 10s",
"tools": []
}
Request
curl -X POST "http://localhost:8000/api/mcp/test" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <token>"
const response = await fetch("http://localhost:8000/api/mcp/test", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
},
});

const data = await response.json();
console.log(data);
import requests

response = requests.post(
    "http://localhost:8000/api/mcp/test",
    headers={'Content-Type':'application/json','Authorization':'Bearer <token>'},
)

print(response.json())
package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {
    req, _ := http.NewRequest("POST", "http://localhost:8000/api/mcp/test", nil)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer <token>")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()

    body, _ := io.ReadAll(resp.Body)
    fmt.Println(string(body))
}
Response
Send a request to see the response