Skip to main content
POST
/
api
/
import
/
providers
Import Providers
curl --request POST \
  --url https://api.example.com/api/import/providers \
  --header 'Content-Type: application/json' \
  --data '
{
  "root": [
    {
      "name": "<string>",
      "code": "<string>",
      "baseUrl": "<string>",
      "authenticationType": {},
      "apiKeyLocation": {},
      "apiKeyName": "<string>",
      "apiKeyValue": "<string>",
      "isDynamicAuth": true,
      "dynamicAuthUrl": "<string>",
      "dynamicAuthMethod": {},
      "dynamicAuthPayloadType": {},
      "dynamicAuthPayloadLocation": {},
      "dynamicAuthPayload": "<string>",
      "dynamicAuthTokenExtractionPath": "<string>",
      "dynamicAuthInvalidationKeywords": "<string>",
      "customHeaders": {},
      "tools": [
        {
          "name": "<string>",
          "code": "<string>",
          "description": "<string>",
          "endpointPath": "<string>",
          "httpMethod": {},
          "parameters": [
            {
              "name": "<string>",
              "type": {},
              "description": "<string>",
              "required": true,
              "defaultValue": "<string>"
            }
          ]
        }
      ]
    }
  ]
}
'
{
  "message": "<string>"
}

Endpoint

POST /api/import/providers
Imports provider configurations with their associated tools and parameters. Uses upsert logic to create new providers or update existing ones based on the code field.

Request Body

root
array
required
Array of provider objects to import

Upsert Behavior

The import endpoint uses code-based upsert logic:

Providers

  • If code matches an existing provider → Update the existing provider
  • If code does not exist → Create a new provider
  • If code is missing or blank → Generate a new UUID and create a provider

Tools

  • Tools follow the same code-based upsert pattern
  • Existing tool parameters are cleared and replaced with the imported parameters
  • This ensures clean updates without orphaned parameters

Parameters

  • Parameters are always recreated with fresh UUIDs to avoid database conflicts
  • Old parameters are removed when updating a tool

API Key Handling

API key values are processed with special logic for security:
  • Values equal to <YOUR_API_KEY>Skipped (preserves existing key)
  • Empty or blank values → Skipped (preserves existing key)
  • Valid API key values → Encrypted and stored
This allows you to import exported configurations without exposing or overwriting production API keys.

Response

Returns a success message when the import completes.
message
string
Confirmation message: "Import successful"

Error Handling

The import process validates all data before persisting. Common errors include:
  • Missing required fields: Provider name, code, baseUrl, authenticationType
  • Invalid enum values: Unsupported HTTP methods or authentication types
  • Malformed JSON: Invalid customHeaders structure
  • Database constraints: Duplicate codes (should not occur with upsert logic)

Cache Refresh

After a successful import, the tool cache is automatically refreshed. This ensures that:
  • MCP clients immediately see the new/updated tools
  • No server restart is required
  • Changes are reflected in the next tools/list call

Example Request

curl -X POST http://localhost:8080/api/import/providers \
  -H "Content-Type: application/json" \
  -d @providers.json

Full Example Payload

[
  {
    "name": "Tavily AI Search",
    "code": "tavily",
    "baseUrl": "https://api.tavily.com",
    "authenticationType": "API_KEY",
    "apiKeyLocation": "IN_BODY",
    "apiKeyName": "api_key",
    "apiKeyValue": "<YOUR_API_KEY>",
    "isDynamicAuth": false,
    "customHeaders": {
      "Content-Type": "application/json"
    },
    "tools": [
      {
        "name": "Búsqueda Tavily",
        "code": "tavily-search",
        "description": "Realiza una búsqueda impulsada por IA optimizada para obtener respuestas y fuentes precisas.",
        "endpointPath": "/search",
        "httpMethod": "POST",
        "parameters": [
          {
            "name": "api_key",
            "type": "STRING",
            "description": "Clave API de Tavily (requerida en el cuerpo de la petición).",
            "required": true,
            "defaultValue": ""
          },
          {
            "name": "query",
            "type": "STRING",
            "description": "La consulta de búsqueda a procesar.",
            "required": true,
            "defaultValue": ""
          },
          {
            "name": "search_depth",
            "type": "STRING",
            "description": "Profundidad de búsqueda ('basic' o 'advanced').",
            "required": false,
            "defaultValue": "basic"
          },
          {
            "name": "include_images",
            "type": "BOOLEAN",
            "description": "Si se deben incluir imágenes en los resultados (true/false).",
            "required": false,
            "defaultValue": ""
          }
        ]
      }
    ]
  },
  {
    "name": "Bluesky API",
    "code": "bluesky",
    "baseUrl": "https://bsky.social/xrpc",
    "authenticationType": "BEARER_TOKEN",
    "apiKeyLocation": "HEADER",
    "apiKeyName": "Authorization",
    "apiKeyValue": "",
    "isDynamicAuth": true,
    "dynamicAuthUrl": "https://bsky.social/xrpc/com.atproto.server.createSession",
    "dynamicAuthMethod": "POST",
    "dynamicAuthPayloadType": "JSON",
    "dynamicAuthPayloadLocation": "BODY",
    "dynamicAuthPayload": "{\"identifier\":\"your_handle.bsky.social\",\"password\":\"your_app_password\"}",
    "dynamicAuthTokenExtractionPath": "accessJwt",
    "dynamicAuthInvalidationKeywords": "ExpiredToken,AuthenticationRequired",
    "customHeaders": {},
    "tools": [
      {
        "name": "Ver Timeline",
        "code": "bluesky-timeline",
        "description": "Obtiene las últimas publicaciones del feed de inicio del usuario autenticado en Bluesky.",
        "endpointPath": "/app.bsky.feed.getTimeline",
        "httpMethod": "GET",
        "parameters": [
          {
            "name": "limit",
            "type": "NUMBER",
            "description": "Cantidad de posts a recuperar (ej. 10)",
            "required": false,
            "defaultValue": "10"
          }
        ]
      }
    ]
  }
]

Example Response

{
  "message": "Import successful"
}

Import from Export

You can directly import the output from the export endpoint:
# Step 1: Export from source instance
curl http://source-server:8080/api/export/providers > export.json

# Step 2: Update API keys in export.json if needed
# Replace <YOUR_API_KEY> placeholders with real values

# Step 3: Import to target instance
curl -X POST http://target-server:8080/api/import/providers \
  -H "Content-Type: application/json" \
  -d @export.json
API Keys Are Not Exported
The export endpoint masks all API keys as <YOUR_API_KEY>. You must manually add real API keys to the JSON before importing, or the import will preserve existing keys (or skip if creating new providers).

Validation Notes

  • All required fields must be present
  • Enum values must match exactly (case-sensitive)
  • customHeaders must be a valid JSON object
  • isDynamicAuth defaults to false if omitted
  • dynamicAuthInvalidationKeywords defaults to standard keywords if omitted
  • Parameter types must be valid: STRING, NUMBER, BOOLEAN, OBJECT, ARRAY

Side Effects

  1. Database Changes: Creates or updates provider, tool, and parameter records
  2. Tool Cache Refresh: All MCP tool caches are invalidated and rebuilt
  3. Timestamps: createdAt set for new records, updatedAt set for all records
  4. Encryption: Valid API keys are encrypted using the configured encryption service
  5. Exportable Flag: All imported providers are marked as exportable = true

Build docs developers (and LLMs) love