Create connection¶
Create connection metadata and credential references that the agent can reference.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/connections
Before you call¶
The example below uses $AI_STUDIO_API_KEY and $WORKSPACE_ID.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/connections" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "MCP 服务",
"kind": "mcp_server",
"endpoint_uri": "https://mcp.example.com"
}'
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Connection name. |
|
string |
Yes |
Connection service address. |
|
string |
No |
Connection instructions. |
|
string |
No |
Connection status. |
|
string |
No |
Connection type. |
|
string |
No |
Authentication type. |
|
string |
No |
A reference to a saved credential. |
|
string[] |
No |
List of connection capabilities. |
|
string |
No |
Connection owner user ID. |
|
string |
No |
Visible range. |
|
object |
No |
Connection configuration. |
|
object |
no |
Label. |
|
object |
No |
Comment. |
|
object |
No |
Extended metadata. |
|
object |
No |
Credentials, which can contain |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Successful response¶
Returns 201 and a new connection on success.
{"code":0,"data":{"id":"connection_01","name":"MCP 服务"}}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
New connection ID. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{"code":2,"message":"invalid connection metadata"}