POST
/api/mcp/test BearerTest 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 requiredA temporary name for the test connection.
transport requiredTransport protocol to test.
Allowed values:
stdiohttpcommandCommand for stdio transport.
argsArguments for stdio transport.
urlServer URL for http transport.
envEnvironment variables to pass.
Response
connected booleanWhether the connection succeeded
error string nullableError message if connection failed
tools arrayList of tool names discovered from the server
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": []}Was this page helpful?
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
Authorization
Headers
Body
Response