Skip to main content

Model Context Protocol (MCP) - Claude Integration

Integrate AnyDB with Claude Desktop and other AI assistants using the Model Context Protocol (MCP). This enables natural language interactions with your AnyDB databases, records, and files.

What is MCP?

The Model Context Protocol (MCP) is an open protocol that standardizes how AI applications connect to external data sources and tools. The AnyDB MCP service allows AI assistants like Claude to interact with your AnyDB account through natural language commands.

Features

  • 🤖 Natural Language Database Operations: Create, read, update, and delete records using conversational commands
  • 🔍 Intelligent Search: Search across your databases with natural language queries
  • 📁 File Management: Upload and download files directly from conversations
  • 🔗 Multi-Database Support: Work with multiple teams and databases seamlessly
  • 🔒 Secure: Uses your AnyDB API key for authentication

Installation

Prerequisites

  • Node.js 16 or higher
  • An AnyDB account
  • Claude Desktop (for Claude integration)
  • Your AnyDB API key

Install the MCP Service

You can install the service globally or use it directly with npx:

# Global installation
npm install -g anydb-mcp-service

# Or use with npx (recommended)
npx anydb-mcp-service

Getting Your AnyDB API Key

  1. Log in to your AnyDB account at app.anydb.com
  2. Click on the user icon in the bottom right corner of the browser UI
  3. In the Profile Dialog, navigate to the Integration tab
  4. Copy your API key from the Integration settings
warning

Keep your API key secure. Never commit it to version control or share it publicly.

Configuration

Claude Desktop Setup

To use with Claude Desktop, add the service to your Claude configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
"mcpServers": {
"anydb": {
"command": "npx",
"args": ["-y", "anydb-mcp-service"],
"env": {
"ANYDB_DEFAULT_API_KEY": "your_api_key_here",
"ANYDB_DEFAULT_USER_EMAIL": "your_email@example.com",
"ANYDB_API_BASE_URL": "https://app.anydb.com/api"
}
}
}
}

Important: After adding the configuration, restart Claude Desktop for the changes to take effect.

Environment Variables

The MCP service uses these environment variables:

VariableRequiredDescription
ANYDB_DEFAULT_API_KEYYesYour AnyDB API key
ANYDB_DEFAULT_USER_EMAILYesEmail associated with your API key
ANYDB_API_BASE_URLNoAPI base URL (defaults to https://app.anydb.com/api)

Available Tools

The MCP service provides 12 tools for comprehensive AnyDB integration:

Team & Database Management

list_teams

List all teams accessible with your API credentials. Teams are organizations or workspaces with their own databases and users.

Parameters: None

Example Usage:

"Show me all my AnyDB teams"

list_databases_for_team

Get all databases within a specific team.

Parameters:

  • teamid (string, required): The team ID (MongoDB ObjectId)

Example Usage:

"List all databases in team MyTeam"

Record Operations

list_records

List all records in a database with optional filtering and pagination.

Parameters:

  • teamid (string, required): The team ID
  • adbid (string, required): The database ID
  • parentid (string, optional): Filter by parent record ID
  • templateid (string, optional): Filter by template ID
  • templatename (string, optional): Filter by template name
  • pagesize (string, optional): Number of records per page
  • lastmarker (string, optional): Pagination marker from previous response

Example Usage:

"List all records in database MyDatabase"
"Show me the first 20 records in this database"

get_record

Get a specific record with all its cell data and metadata.

Parameters:

  • teamid (string, required): The team ID
  • adbid (string, required): The database ID
  • adoid (string, required): The record ID

Example Usage:

"Show me the details of record some_record_name"

create_record

Create a new record in a database.

Parameters:

  • adbid (string, required): The database ID
  • teamid (string, required): The team ID
  • name (string, required): The record name
  • attach (string, optional): Parent record ID to attach to
  • template (string, optional): Template ID to use
  • content (object, optional): Initial content data (key-value pairs)

Example Usage:

"Create a new record named 'Q1 Sales Report' in database ABC"
"Create a project record with description 'New website redesign'"

update_record

Update an existing record's metadata and content.

Parameters:

  • meta (object, required): Record metadata including:
    • adoid (string, required): The record ID
    • adbid (string, required): The database ID
    • teamid (string, required): The team ID
    • name (string, optional): New name
    • description (string, optional): Description
    • status (string, optional): Status
    • locked (boolean, optional): Lock status
    • assignees (object, optional): User and group assignments
  • content (object, optional): Cell content updates

Example Usage:

"Update record XYZ to set the status to 'Complete'"
"Change the name of this record to 'Final Report'"

delete_record

Delete a record permanently or unlink it from parent records.

Parameters:

  • adoid (string, required): The record ID
  • adbid (string, required): The database ID
  • teamid (string, required): The team ID
  • removefromids (string, optional): Comma-separated parent IDs to unlink from, or 000000000000000000000000 for permanent deletion

Example Usage:

"Delete record 507f1f77bcf86cd799439014"
"Remove this record from its parent"

copy_record

Create a copy of an existing AnyDB record. The copy will be an independent record with its own ID. You can optionally attach the copy to a different parent record and control how file attachments are handled.

Parameters:

  • adoid (string, required): The source record ID to copy
  • adbid (string, required): The database ID
  • teamid (string, required): The team ID
  • attachto (string, optional): Parent record ID to attach the copied record to
  • attachmentsmode (string, optional): How to handle file attachments:
    • noattachments - Copy without any file attachments
    • link (default) - Copy with linked attachments (files reference same storage)
    • duplicate - Copy with fully duplicated attachments (creates independent file copies)

Attachment Modes Explained:

  • noattachments: Use when you want a clean copy without files. Fastest option, no file operations needed.
  • link: Files reference the same storage location as the original. Quick operation, minimal storage. Changes to original files affect the copy. Use for related records that should share the same files.
  • duplicate: Creates independent copies of all files. Slowest but creates true independent records. Changes to original files don't affect the copy. Use when you need completely separate file copies.

Example Usage:

"Copy record XYZ and duplicate all attachments"
"Make a copy of this record without any files"
"Copy this project and link to the same attachments"
"Duplicate this record under parent ABC with full file copies"

move_record

Move an existing AnyDB record to a new parent. This changes the parent-child relationship of the record in the database hierarchy. The record itself remains the same, but its location in the tree structure changes.

Parameters:

  • adoid (string, required): The record ID to move
  • adbid (string, required): The database ID
  • teamid (string, required): The team ID
  • parentid (string, required): The target parent record ID to move this record under

Example Usage:

"Move record XYZ under parent ABC"
"Relocate this task to the other project"
"Move this record to be a child of that record"

search_records

Search for records by keyword across a database.

Parameters:

  • adbid (string, required): The database ID
  • teamid (string, required): The team ID
  • search (string, required): Search keyword
  • parentid (string, optional): Filter by parent record
  • start (string, optional): Pagination start offset
  • limit (string, optional): Result limit

Example Usage:

"Search for records containing 'budget' in database ABC"
"Find all records with the word 'invoice'"

File Operations

download_file

Download a file or get a download URL from a record cell.

Parameters:

  • teamid (string, required): The team ID
  • adbid (string, required): The database ID
  • adoid (string, required): The record ID
  • cellpos (string, required): Cell position (e.g., 'A1', 'B2')
  • redirect (boolean, optional): Return redirect URL for browser download
  • preview (boolean, optional): Return preview URL for inline display

Example Usage:

"Download the file from cell A1 in record XYZ"
"Get the file URL from this record"

Note: The tool returns a JSON response with a url field. Claude Desktop will display this as a clickable link.

upload_file

Upload a file to an AnyDB record cell.

Parameters:

  • filename (string, required): File name (e.g., 'document.pdf')
  • fileContent (string, required): File content (not a file path)
  • teamid (string, required): The team ID
  • adbid (string, required): The database ID
  • adoid (string, required): The record ID
  • cellpos (string, optional): Cell position (defaults to 'A1')
  • contentType (string, optional): MIME type (e.g., 'application/pdf')

Example Usage:

"Upload this document to record ABC"
"Attach this image file to the project record"

Understanding AnyDB Concepts

Teams

Teams are organizations or workspaces in AnyDB. Each team has its own databases and users. Use list_teams to discover available teams.

Identifier: teamid (MongoDB ObjectId)

Databases (ADB)

Databases (ADBs) are collections of records within a team, similar to spreadsheet files or database tables.

Identifier: adbid (MongoDB ObjectId)

Records (ADO)

Records (ADOs) are individual data entries within a database, similar to rows in a spreadsheet. Each record contains:

  • Metadata: Name, description, status, assignees, etc.
  • Cells: Data organized in a grid (A1, B2, etc.) with typed values

Identifier: adoid (MongoDB ObjectId)

Cell Positions

Cell positions (e.g., 'A1', 'B2', 'C5') identify specific data cells within a record. Each cell has a type (text, number, date, file, etc.).

Usage Examples

Basic Workflow

User: "List my AnyDB teams"
Claude: [Uses list_teams tool]

User: "Show me databases in the first team"
Claude: [Uses list_databases_for_team with the teamid]

User: "List records in the Projects database"
Claude: [Uses list_records with teamid and adbid]

User: "Create a new project record called 'Website Redesign'"
Claude: [Uses create_record with appropriate parameters]

User: "Search for all budget-related records"
Claude: [Uses search_records with search="budget"]

Working with Files

User: "Show me record ABC details"
Claude: [Uses get_record to see cell structure]

User: "Download the file from cell B3"
Claude: [Uses download_file with cellpos="B3"]

User: "Upload this document to that record"
Claude: [Uses upload_file with provided file content]

Advanced Operations

User: "Update the status of record XYZ to 'Complete'"
Claude: [Uses update_record with status change]

User: "Create a child record under project ABC"
Claude: [Uses create_record with attach parameter]

User: "Copy record XYZ with all file attachments duplicated"
Claude: [Uses copy_record with attachmentsmode="duplicate"]

User: "Make a copy of this template without the files"
Claude: [Uses copy_record with attachmentsmode="noattachments"]

User: "Move this task record under the 'In Progress' project"
Claude: [Uses move_record with new parentid]

User: "Get the next page of results"
Claude: [Uses list_records with lastmarker from previous response]

Troubleshooting

Connection Issues

Problem: "Authentication failed" or "Invalid API key"

Solutions:

  • Verify your API key is correct in the configuration
  • Ensure your email matches the account associated with the API key
  • Check that the API key hasn't expired

Problem: Claude Desktop doesn't show AnyDB tools

Solutions:

  • Restart Claude Desktop after editing the configuration
  • Verify the configuration JSON is valid (use a JSON validator)
  • Check that npx is available in your system PATH

Common Errors

Problem: "teamid, adbid, and adoid are required"

Solution: Use list_teams and list_databases_for_team first to discover the correct IDs.

Problem: "File upload failed"

Solution:

  • Ensure the record exists (use get_record to verify)
  • Check that the cell position is valid
  • Verify file content is provided correctly (not a file path)

Debugging

Enable detailed logging by checking the Claude Desktop logs:

macOS: ~/Library/Logs/Claude/mcp*.log Windows: %APPDATA%\Claude\logs\mcp*.log

Best Practices

  1. Always start with discovery: Use list_teams and list_databases_for_team to find the correct IDs
  2. Check record structure: Use get_record before uploading files to see available cell positions
  3. Use pagination: For large databases, use pagesize and lastmarker parameters
  4. Search before creating: Use search_records to avoid duplicate records
  5. Secure your credentials: Never share your API key or commit it to version control

Additional Resources

License

MIT License