Skip to content

MCP Tools Reference

Complete API reference for all Cyborg MCP tools.

upload_docs

Upload documentation files to the Cyborg backend for processing and indexing.

Parameters

ParameterTypeRequiredDefaultDescription
publishableKeystringNoenv varCyborg publishable key (falls back to CYBORG_PUBLISHABLE_KEY env var)
filePathsstring[]Yes-Array of glob patterns for files to upload
docsDirstringNo./cyborg-docsBase directory for state file location
documentType'markdown' | 'text'NomarkdownDocument type for backend processing

Example

json
upload_docs({
  "filePaths": ["./docs/**/*.md", "./README.md"],
  "docsDir": "./docs",
  "documentType": "markdown"
})

Response

json
{
  "success": true,
  "uploaded": [
    { "path": "getting-started.md", "documentId": "doc_abc123" },
    { "path": "api-reference.md", "documentId": "doc_def456" }
  ],
  "failed": []
}

Error Response

json
{
  "success": false,
  "uploaded": [
    { "path": "getting-started.md", "documentId": "doc_abc123" }
  ],
  "failed": [
    { "path": "large-file.md", "error": "File too large (max 10MB)" }
  ]
}

sync_docs

Detect changes in documentation and sync them with the backend efficiently.

Parameters

ParameterTypeRequiredDefaultDescription
publishableKeystringNoenv varCyborg publishable key (falls back to CYBORG_PUBLISHABLE_KEY env var)
docsDirstringNo./cyborg-docsDocumentation directory to sync
dryRunbooleanNofalsePreview changes without uploading

Example

json
sync_docs({
  "docsDir": "./docs",
  "dryRun": true
})

Dry Run Response

json
{
  "success": true,
  "dryRun": true,
  "changes": {
    "toUpload": ["new-guide.md"],
    "toUpdate": ["getting-started.md"],
    "unchanged": ["api/useChat.md", "api/useCyborg.md"],
    "deleted": ["old-file.md"]
  }
}

Full Sync Response

json
{
  "success": true,
  "uploaded": [
    { "path": "new-guide.md", "documentId": "doc_xyz789" }
  ],
  "updated": [
    { "path": "getting-started.md", "documentId": "doc_abc123" }
  ],
  "unchanged": 2,
  "deleted": ["old-file.md"]
}

Change Detection Algorithm

The sync process uses a 3-pass algorithm:

  1. Pass 1 - Local Hash Comparison: Reads local files, calculates SHA-256 hashes, compares against stored hashes
  2. Pass 2 - Backend Comparison: Fetches backend hashes only for potentially modified files
  3. Pass 3 - Upload/Update: Uploads new files and updates modified files

update_doc

Update a single documentation file on the backend.

Parameters

ParameterTypeRequiredDefaultDescription
publishableKeystringNoenv varCyborg publishable key (falls back to CYBORG_PUBLISHABLE_KEY env var)
documentIdstringYes-ID of the document to update
contentstringYes-New content for the document
filePathstringNo-Optional file path to read content from

Example - Direct Content

json
update_doc({
  "documentId": "doc_abc123",
  "content": "# Updated Guide\n\nNew content here..."
})

Example - From File

json
update_doc({
  "documentId": "doc_abc123",
  "filePath": "./docs/getting-started.md"
})

Response

json
{
  "success": true,
  "documentId": "doc_abc123",
  "updatedAt": "2025-01-15T10:30:00Z"
}

Error Response

json
{
  "success": false,
  "error": "Document not found",
  "documentId": "doc_abc123"
}

delete_doc

Delete a documentation file from the backend.

Parameters

ParameterTypeRequiredDefaultDescription
publishableKeystringNoenv varCyborg publishable key (falls back to CYBORG_PUBLISHABLE_KEY env var)
documentIdstringYes-ID of the document to delete

Example

json
delete_doc({
  "documentId": "doc_abc123"
})

Response

json
{
  "success": true,
  "documentId": "doc_abc123",
  "deletedAt": "2025-01-15T10:30:00Z"
}

Error Response

json
{
  "success": false,
  "error": "Document not found",
  "documentId": "doc_abc123"
}

Common Parameters

All tools accept these common parameters:

ParameterTypeDescription
publishableKeystringYour Cyborg publishable key. If not provided, falls back to the CYBORG_PUBLISHABLE_KEY environment variable.

State File

All tools that modify documents update the .cyborg-state.json file:

json
{
  "apiUrl": "https://api.cyborgsdk.dev/api/v1",
  "lastSyncedAt": "2025-01-15T10:30:00Z",
  "files": {
    "getting-started.md": {
      "documentId": "doc_abc123",
      "contentHash": "sha256:e3b0c44298fc...",
      "syncedAt": "2025-01-15T10:30:00Z"
    }
  }
}

Error Handling

All tools return a consistent error format:

json
{
  "success": false,
  "error": "Error message describing what went wrong"
}

Common error types:

  • Authentication failed - Invalid or missing API key
  • Document not found - Document ID doesn't exist
  • File too large - File exceeds size limit (10MB)
  • Invalid file type - Unsupported document format
  • Rate limited - Too many requests, try again later

Next Steps

Built with VitePress