Dokumentation
MCP-Konfiguration
MCP-Verbindungskonfigurations-CRUD und Server-Info-Anfragen.
Automatisch aus dem Englischen übersetzt. Englisches Original ansehen
Senden Sie diese Anfragen an Ihren eigenen laufenden Sidecar. Werte bleiben in diesem Browser.
Wie das funktioniert
Der Sidecar lauscht an einem beim Start ausgewählten Loopback-Port und gibt ihn dort aus ready linie; Verwenden Sie diese URL und die CADCAMFUN_TOKEN es wurde damit begonnen. Anfragen gehen direkt von dieser Seite an diese Adresse.
Der Sidecar sendet CORS-Header nur an die Tauri-Ursprünge und an http://localhost oder http://127.0.0.1 auf jedem Port. Von den gehosteten Dokumenten aus blockiert der Browser die Antwort, also führen Sie die Dokumente lokal aus (bun run dev in packages/web), um den Spielplatz zu nutzen, oder kopieren Sie die Anfrage als Curl. Um zu experimentieren, ohne echte Daten zu berühren, starten Sie den Sidecar mit CADCAMFUN_DATA_DIR zeigte auf ein Wegwerfverzeichnis – siehe die API-Komplettlösung.
Operationen
8 Endpunkte in der mcp gruppe, generiert aus der eigenen Gruppe des Sidecars OpenAPI-Dokument. Geschützte Operationen dauern Authorization: Bearer $CADCAMFUN_TOKEN; sehen authentifizierung. Verhalten und Grenzen sind in das Subsystemhandbuch.
| erhalten | /api/mcp/config | mcp.listConfig |
| post | /api/mcp/config | mcp.createConfig |
| setzen | /api/mcp/config | mcp.updateConfig |
| löschen | /api/mcp/config | mcp.removeConfig |
| erhalten | /api/mcp/config/{id} | mcp.getConfig |
| setzen | /api/mcp/config/{id} | mcp.updateConfigById |
| löschen | /api/mcp/config/{id} | mcp.removeConfigById |
| post | /api/mcp/server-info | mcp.serverInfo |
/api/mcp/config
mcp.listConfig Erfordert Authorization: Bearer <token>.
| Name | In | Typ | Erforderlich |
|---|---|---|---|
| quelle | abfrage | zeichenfolge | null | optional |
200 objekt | Objekt application/json
{ success: true source: "claude" | "database" servers: Array<{ id: string name: string type: string url: string | null command: string | null args: unknown workingDirectory: string | null enabled: boolean userId: string | null createdAt: string updatedAt: string }> count: number | "Infinity" | "-Infinity" | "NaN" } | { success: true source: "file" config: { mcpServers: Array<{ id: string name: string type: string url: string | null command: string | null args: unknown workingDirectory: string | null enabled: boolean }> } exportedAt: string }
400 McpEnvBadRequestEncoded application/json
McpEnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 McpEnvInternalEncoded application/json
McpEnvInternalEncoded
Beispielantwort erfasst · 200
{
"success": true,
"source": "claude",
"servers": [],
"count": 0
} SDK-Beispiel
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// McpListConfigInput
const result = await client.mcp.listConfig({}) curl
curl --request GET "${CADCAMFUN_URL}/api/mcp/config" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Probieren Sie es aus
mcp.createConfig Erfordert Authorization: Bearer <token>.
| Name | In | Typ | Erforderlich |
|---|---|---|---|
| quelle | abfrage | zeichenfolge | null | optional |
{ id?: string | null name?: string | null type?: string | null url?: string | null command?: string | null args?: unknown | null workingDirectory?: string | null defaultWorkingDirectory?: string | null enabled?: boolean | null serverName?: string | null testConnection?: boolean | null mcpServers?: unknown | null tool_configuration?: unknown | null authorization_token?: string | null }
200 objekt application/json
{ success: true source: "file" imported: number | "Infinity" | "-Infinity" | "NaN" message: string }
201 objekt application/json
{ success: true source: "claude" | "database" server: { id: string name: string type: string url: string | null command: string | null args: unknown workingDirectory: string | null enabled: boolean userId: string | null createdAt: string updatedAt: string } connectionTest?: unknown | null message: string }
400 McpEnvBadRequestEncoded application/json
McpEnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
500 McpEnvInternalEncoded application/json
McpEnvInternalEncoded
beispiel abrufen
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/mcp/config`, {
method: "POST",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request POST "${CADCAMFUN_URL}/api/mcp/config" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Probieren Sie es aus
mcp.updateConfig Erfordert Authorization: Bearer <token>.
| Name | In | Typ | Erforderlich |
|---|---|---|---|
| quelle | abfrage | zeichenfolge | null | optional |
{ id?: string | null name?: string | null type?: string | null url?: string | null command?: string | null args?: unknown | null workingDirectory?: string | null defaultWorkingDirectory?: string | null enabled?: boolean | null serverName?: string | null testConnection?: boolean | null mcpServers?: unknown | null tool_configuration?: unknown | null authorization_token?: string | null }
200 objekt application/json
{ success: true source: "claude" server: { id: string name: string type: string url: string | null command: string | null args: unknown workingDirectory: string | null enabled: boolean userId: string | null createdAt: string updatedAt: string } message: string }
400 McpEnvBadRequestEncoded application/json
McpEnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 McpEnvNotFoundEncoded application/json
McpEnvNotFoundEncoded
405 McpEnvMethodNotAllowedEncoded application/json
McpEnvMethodNotAllowedEncoded
500 McpEnvInternalEncoded application/json
McpEnvInternalEncoded
SDK-Beispiel
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// McpUpdateConfigInput
const result = await client.mcp.updateConfig({
id: "",
name: "",
type: "",
url: "",
command: "",
args: null,
workingDirectory: "",
defaultWorkingDirectory: "",
enabled: false,
serverName: "",
testConnection: false,
mcpServers: null,
tool_configuration: null,
authorization_token: ""
}) curl
curl --request PUT "${CADCAMFUN_URL}/api/mcp/config" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Probieren Sie es aus
mcp.removeConfig Erfordert Authorization: Bearer <token>.
| Name | In | Typ | Erforderlich |
|---|---|---|---|
| quelle | abfrage | zeichenfolge | null | optional |
| name | abfrage | zeichenfolge | null | optional |
200 objekt application/json
{ success: true source: "claude" message: string note: string }
400 McpEnvBadRequestEncoded application/json
McpEnvBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 McpEnvNotFoundEncoded application/json
McpEnvNotFoundEncoded
405 McpEnvMethodNotAllowedEncoded application/json
McpEnvMethodNotAllowedEncoded
500 McpEnvInternalEncoded application/json
McpEnvInternalEncoded
SDK-Beispiel
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// McpRemoveConfigInput
const result = await client.mcp.removeConfig({}) curl
curl --request DELETE "${CADCAMFUN_URL}/api/mcp/config" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Probieren Sie es aus
mcp.getConfig Erfordert Authorization: Bearer <token>.
| Name | In | Typ | Erforderlich |
|---|---|---|---|
| ausweis | weg | zeichenfolge | erforderlich |
200 objekt application/json
{ id: string name: string type: string url: string | null command: string | null args: unknown workingDirectory: string | null enabled: boolean userId: string | null createdAt: string updatedAt: string }
400 McpBadRequestEncoded application/json
McpBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 McpNotFoundEncoded application/json
McpNotFoundEncoded
500 McpInternalEncoded application/json
McpInternalEncoded
SDK-Beispiel
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// McpGetConfigInput
const result = await client.mcp.getConfig({
id: "<id>"
}) curl
curl --request GET "${CADCAMFUN_URL}/api/mcp/config/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Probieren Sie es aus
mcp.updateConfigById Erfordert Authorization: Bearer <token>.
| Name | In | Typ | Erforderlich |
|---|---|---|---|
| ausweis | weg | zeichenfolge | erforderlich |
{ id?: string | null name?: string | null type?: string | null url?: string | null command?: string | null args?: unknown | null workingDirectory?: string | null defaultWorkingDirectory?: string | null enabled?: boolean | null serverName?: string | null testConnection?: boolean | null mcpServers?: unknown | null tool_configuration?: unknown | null authorization_token?: string | null }
200 objekt application/json
{ id: string name: string type: string url: string | null command: string | null args: unknown workingDirectory: string | null enabled: boolean userId: string | null createdAt: string updatedAt: string }
400 McpBadRequestEncoded application/json
McpBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 McpNotFoundEncoded application/json
McpNotFoundEncoded
405 McpMethodNotAllowedEncoded application/json
McpMethodNotAllowedEncoded
500 McpInternalEncoded application/json
McpInternalEncoded
beispiel abrufen
// Not generated in the Promise SDK (multipart, binary or raw body): call it with fetch.
const response = await fetch(`${process.env.CADCAMFUN_URL}/api/mcp/config/${id}`, {
method: "PUT",
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
}) curl
curl --request PUT "${CADCAMFUN_URL}/api/mcp/config/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Probieren Sie es aus
mcp.removeConfigById Erfordert Authorization: Bearer <token>.
| Name | In | Typ | Erforderlich |
|---|---|---|---|
| ausweis | weg | zeichenfolge | erforderlich |
204 <Kein Inhalt>
400 McpBadRequestEncoded application/json
McpBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 McpNotFoundEncoded application/json
McpNotFoundEncoded
405 McpMethodNotAllowedEncoded application/json
McpMethodNotAllowedEncoded
500 McpInternalEncoded application/json
McpInternalEncoded
SDK-Beispiel
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// McpRemoveConfigByIdInput
const result = await client.mcp.removeConfigById({
id: "<id>"
}) curl
curl --request DELETE "${CADCAMFUN_URL}/api/mcp/config/<id>" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" Probieren Sie es aus
/api/mcp/server-info
mcp.serverInfo Erfordert Authorization: Bearer <token>.
{ serverId?: string | null }
200 objekt application/json
{ name: string version?: string | null instructions?: string | null resources?: Array<{ name: string uriTemplate?: string | null description?: string | null arguments?: Array<{ name: string description?: string | null required?: boolean | null }> | null }> | null tools?: Array<{ name: string description?: string | null parameters?: unknown | null }> | null }
400 McpBadRequestEncoded application/json
McpBadRequestEncoded
401 UnauthorizedEncoded application/json
UnauthorizedEncoded
404 McpNotFoundEncoded application/json
McpNotFoundEncoded
405 McpMethodNotAllowedEncoded application/json
McpMethodNotAllowedEncoded
500 McpInternalEncoded application/json
McpInternalEncoded
SDK-Beispiel
import { CadCam } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
// McpServerInfoInput
const result = await client.mcp.serverInfo({
serverId: ""
}) curl
curl --request POST "${CADCAMFUN_URL}/api/mcp/server-info" \
--header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
--header "Content-Type: application/json" \
--data-binary @request.json Probieren Sie es aus
Schemata
Benannte Schemata, die über die Parameter, Körper und Antworten dieser Gruppe erreichbar sind. A ? markiert ein optionales Feld; | null markiert ein Feld, das möglicherweise mit einem Nullwert vorhanden ist.
McpBadRequestEncoded{ _tag: "McpBadRequest" error: string }
McpEnvBadRequestEncoded{ _tag: "McpEnvBadRequest" success: false error: string }
McpEnvInternalEncoded{ _tag: "McpEnvInternal" success: false error: string }
McpEnvMethodNotAllowedEncoded{ _tag: "McpEnvMethodNotAllowed" success: false error: string }
McpEnvNotFoundEncoded{ _tag: "McpEnvNotFound" success: false error: string }
McpInternalEncoded{ _tag: "McpInternal" error: string }
McpMethodNotAllowedEncoded{ _tag: "McpMethodNotAllowed" error: string }
McpNotFoundEncoded{ _tag: "McpNotFound" error: string }
Ich rufe diese Gruppe an
Vorgangs-IDs haben die Form mcp.<name>. Das generierte Promise SDK (@cadcamfun/api/sdk) entlarvt die meisten von ihnen als client.<namespace>.<method>(input), wo input ist ein flaches Objekt aus Pfadparametern und Körperfeldern; Das SDK-Beispiel jeder Karte zeigt den genauen Zugriffs- und Eingabetyp. Mehrteilige Uploads, Binär- oder JavaScript-Antworten und unformatierte Webhooks werden nicht generiert; Diese Karten zeigen fetch stattdessen.
import { CadCam, ClientError } from "@cadcamfun/api/sdk"
const client = CadCam.make({
baseUrl: process.env.CADCAMFUN_URL!,
headers: { authorization: `Bearer ${process.env.CADCAMFUN_TOKEN}` },
})
try {
await client.projects.list()
} catch (error) {
if (error instanceof ClientError) {
// Transport | UnexpectedStatus | UnsupportedContentType | MalformedResponse | SseEventTooLarge
} else {
// a declared error body: switch on error._tag
}
} Fehlerbehebung
| Symptom | Wahrscheinliche Ursache | Fix |
|---|---|---|
| 401 bei jedem Aufruf | Token von einem früheren Start oder fehlt Bearer präfix | Schicken Authorization: Bearer <token> mit dem Token wurde der Sidecar gestartet. |
| 400 bevor etwas passiert | Text oder Parameter stimmen nicht mit dem Schema überein | Vergleichen Sie die Nutzlast mit dem Anforderungsschema auf der Karte. |
| 403 oder 404 bei einem Datensatz, den du woanders siehst | Das amtierende Konto ist unterschiedlich | Schicken Sie das Richtige x-session-token, oder verwenden Sie das lokale Profil, das Eigentümer des Datensatzes ist. |
| 409 | Widersprüchlicher Status, z. B. ein doppelter Name oder ein veralteter Zweigkopf | Lesen Sie die Ressource erneut und versuchen Sie es erneut mit den aktuellen Daten. |
| Versuchen Sie es mit der Meldung „Von CORS blockiert“. | Die Dokumente werden von einem Nicht-Loopback-Ursprung bereitgestellt | Führen Sie die Dokumente lokal aus oder kopieren Sie die Anfrage als Curl. |
| Verbindung abgelehnt | Der Sidecar wurde an einem neuen Port neu gestartet | Lesen Sie den Port neu ready Zeile. |