コンテンツへスキップ
CADCAMFUN
ドキュメント

ドキュメント

MCP 構成

MCP 接続構成 CRUD およびサーバー情報リクエスト。

英語から自動翻訳されています。 英語の原文を見る

プレイグラウンド

これらのリクエストを独自の実行中のサイドカーに送信します。値はこのブラウザ内に残ります。

接続されていません
仕組み

サイドカーは起動時に選択されたループバック ポートをリッスンし、それをそのポートに出力します。 ready ライン;その URL を使用し、 CADCAMFUN_TOKEN で始まりました。リクエストはこのページからそのアドレスに直接送信されます。

サイドカーは CORS ヘッダーを Tauri オリジンと http://localhost または http://127.0.0.1 どのポートでも。ホストされているドキュメントからはブラウザーが応答をブロックするため、ドキュメントをローカルで実行します (bun run dev で packages/web) プレイグラウンドを使用するか、リクエストをcurlとしてコピーします。実際のデータに触れることなく実験するには、次のようにしてサイドカーを開始します。 CADCAMFUN_DATA_DIR 使い捨てディレクトリを指す - を参照 aPI のチュートリアル.

運営

8 エンドポイント( mcp サイドカー自体から生成されたグループ OpenAPIドキュメント。保護された操作には時間がかかります Authorization: Bearer $CADCAMFUN_TOKEN;見る 認証。行動と制限は次のとおりです サブシステムガイド.

得る /api/mcp/config mcp.listConfig
役職 /api/mcp/config mcp.createConfig
置く /api/mcp/config mcp.updateConfig
消去 /api/mcp/config mcp.removeConfig
得る /api/mcp/config/{id} mcp.getConfig
置く /api/mcp/config/{id} mcp.updateConfigById
消去 /api/mcp/config/{id} mcp.removeConfigById
役職 /api/mcp/server-info mcp.serverInfo
3D での MCP 構成操作 ドラッグして周回します · スクロールしてズーム · 右ドラッグしてパンします
オペレーションごとに 1 つのブロック (8)、このページのリソース セクションごとにスタックされ、メソッドごとに色分けされます: 緑色の GET、オレンジ色の POST、青色の PUT、紫色の PATCH、赤色の DELETE。ビルド時に OpenAPI ドキュメントから生成されます。

/api/mcp/config

得る /api/mcp/config # mcp.listConfig

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
ソース クエリ 弦 | null オプション
応答
200 オブジェクト |物体 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
応答例 捕獲 · 200
/api/mcp/config を取得する
{
  "success": true,
  "source": "claude",
  "servers": [],
  "count": 0
}
SDKの例
mcp.listConfig
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
/api/mcp/config を取得する
curl --request GET "${CADCAMFUN_URL}/api/mcp/config" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください
役職 /api/mcp/config # mcp.createConfig

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
ソース クエリ 弦 | null オプション
リクエスト本文 · 必須 · application/json
{
  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 物体 application/json
{
  success: true
  source: "file"
  imported: number | "Infinity" | "-Infinity" | "NaN"
  message: string
}
201 物体 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
例を取得する
mcp.createConfig
// 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
POST /api/mcp/config
curl --request POST "${CADCAMFUN_URL}/api/mcp/config" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
試してみてください
置く /api/mcp/config # mcp.updateConfig

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
ソース クエリ 弦 | null オプション
リクエスト本文 · 必須 · application/json
{
  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 物体 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の例
mcp.updateConfig
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
PUT /api/mcp/config
curl --request PUT "${CADCAMFUN_URL}/api/mcp/config" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
試してみてください
消去 /api/mcp/config # mcp.removeConfig

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
ソース クエリ 弦 | null オプション
名前 クエリ 弦 | null オプション
応答
200 物体 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の例
mcp.removeConfig
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
/api/mcp/config を削除します
curl --request DELETE "${CADCAMFUN_URL}/api/mcp/config" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください
得る /api/mcp/config/{id} # mcp.getConfig

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
iD パス 弦 必須
応答
200 物体 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の例
mcp.getConfig
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
/api/mcp/config/{id} を取得します
curl --request GET "${CADCAMFUN_URL}/api/mcp/config/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください
置く /api/mcp/config/{id} # mcp.updateConfigById

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
iD パス 弦 必須
リクエスト本文 · 必須 · application/json
{
  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 物体 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
例を取得する
mcp.updateConfigById
// 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
PUT /api/mcp/config/{id}
curl --request PUT "${CADCAMFUN_URL}/api/mcp/config/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
試してみてください
消去 /api/mcp/config/{id} # mcp.removeConfigById

必要 Authorization: Bearer <token>.

パラメータ
名前でタイプ必須
iD パス 弦 必須
応答
204 <コンテンツなし>
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の例
mcp.removeConfigById
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
/api/mcp/config/{id} を削除します
curl --request DELETE "${CADCAMFUN_URL}/api/mcp/config/<id>" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}"
試してみてください

/api/mcp/server-info

役職 /api/mcp/server-info # mcp.serverInfo

必要 Authorization: Bearer <token>.

リクエスト本文 · 必須 · application/json
{
  serverId?: string | null
}
応答
200 物体 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の例
mcp.serverInfo
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
POST /api/mcp/サーバー情報
curl --request POST "${CADCAMFUN_URL}/api/mcp/server-info" \
  --header "Authorization: Bearer ${CADCAMFUN_TOKEN}" \
  --header "Content-Type: application/json" \
  --data-binary @request.json
試してみてください

スキーマ

このグループのパラメータ、本体、および応答から到達可能な名前付きスキーマ。あ ? オプションのフィールドをマークします。 | null null 値が存在する可能性があるフィールドにマークを付けます。

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
}
UnauthorizedEncoded
{
  _tag: "Unauthorized"
  message: string
}

このグループに電話をかける

オペレーション ID の形式は次のとおりです。 mcp.<name>。生成された Promise SDK (@cadcamfun/api/sdk) それらのほとんどを次のように公開します client.<namespace>.<method>(input)、 どこ input パスパラメータとボディフィールドの 1 つのフラットオブジェクトです。各カードの SDK の例は、正確なアクセサーと入力タイプを示しています。マルチパート アップロード、バイナリまたは JavaScript 応答、生の Webhook は生成されません。それらのカードが示しているのは fetch 代わりに。

Promise SDK からのエラー
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
  }
}

トラブルシューティング

症状考えられる原因修理
呼び出しごとの 401以前の起動からのトークン、または欠落しています Bearer 接頭辞送信 Authorization: Bearer <token> サイドカーが開始されたトークンを使用します。
何も起きる前の 400本体またはパラメータがスキーマと一致しませんペイロードとカード上のリクエスト スキーマを比較します。
別の場所で見えるレコードの 403 または 404代理アカウントは異なります権利を送信します x-session-token、またはレコードを所有するローカル プロファイルを使用します。
409重複した名前や古いブランチヘッドなどの矛盾した状態リソースを再読み込みし、現在のデータで再試行します。
「CORS によってブロックされました」と表示されてみてくださいドキュメントは非ループバックオリジンから提供されますドキュメントをローカルで実行するか、リクエストをcurlとしてコピーします。
接続拒否サイドカーが新しいポートで再起動されました新しいポートからポートを読み取ります ready 行。