MCP server proxy endpoint - Barndoor Documentation
MCP server proxy endpoint
cURL
curl --request GET \
--url https://your-org.platform.barndoor.ai/mcp/{mcp_server_name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "tools/list",
"params": {},
"id": 1
}
'```
### Python
```python
import requests
url = "https://your-org.platform.barndoor.ai/mcp/{mcp_server_name}"
payload = {
"jsonrpc": "2.0",
"method": "tools/list",
"params": {},
"id": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.get(url, json=payload, headers=headers)
print(response.text)
JavaScript (Fetch)
const options = {
method: 'GET',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({jsonrpc: '2.0', method: 'tools/list', params: {}, id: 1})
};
fetch('https://your-org.platform.barndoor.ai/mcp/{mcp_server_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-org.platform.barndoor.ai/mcp/{mcp_server_name}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'method' => 'tools/list',
'params' => [
],
'id' => 1
]),
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;
}
?>
Go
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-org.platform.barndoor.ai/mcp/{mcp_server_name}"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"tools/list\",\n \"params\": {},\n \"id\": 1\n}")
req, _ := http.NewRequest("GET", 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))
}
Java (Unirest)
HttpResponse<String> response = Unirest.get("https://your-org.platform.barndoor.ai/mcp/{mcp_server_name}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"method\": \"tools/list\",\n \"params\": {},\n \"id\": 1\n}")
.asString();
Ruby
require 'uri'
require 'net/http'
url = URI("https://your-org.platform.barndoor.ai/mcp/{mcp_server_name}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"tools/list\",\n \"params\": {},\n \"id\": 1\n}"
response = http.request(request)
puts response.read_body
Example Responses
{
"jsonrpc": "2.0",
"result": {
"tools": [
{
"name": "get_accounts",
"description": "Get Salesforce accounts",
"parameters": {
"type": "object",
"properties": {
"limit": {
"type": "integer",
"description": "Maximum number of accounts"
}
}
}
}
]
},
"id": 1
}
{
"error": "ServerNotFound",
"message": "Server with ID '123' not found",
"details": {}
}
{
"error": "ServerNotConnected",
"message": "Server 'salesforce' is not connected. Please initiate connection first."
}
Authorizations
Authorization
- Type: string
- Location: header
- Required: Yes
JWT token obtained through Barndoor's OAuth 2.0 authorization-code flow with PKCE.
The token should be included in the Authorization header:
Authorization: Bearer <your-jwt-token>
Use the Barndoor SDK's loginInteractive() function to obtain tokens automatically.