DataMagik MCP API

Plug DataMagik into any AI agent that speaks the Model Context Protocol.

The DataMagik MCP server exposes the full platform — scripts, document templates, lookup tables, dashboards, automations, SQL queries, app designer entries, email templates, schedules, allowed domains, credentials, documentation, and the Plex database schema — to AI tools that speak MCP. If you're building an AI agent, IDE plugin, or LLM-driven workflow that needs to read or modify DataMagik resources on a user's behalf, this is the surface.

Quick start

  1. Generate a bearer token on your user profile page under API Keys. Same token authorises both the DataMagik REST API and the MCP server — no second key to manage.
  2. Point your MCP client at the endpoint below using Authorization: Bearer <token>.
  3. Start with the initialize handshake, then tools/list, then call any tool.

Endpoint

POST https://mcp.data-magik.com/mcp

The server speaks MCP Streamable HTTP — JSON-RPC 2.0 in, single JSON or SSE stream out depending on the tool.

Authentication

Every request requires an Authorization: Bearer <token> header. The MCP server resolves the bearer into the issuing user's (user_id, company_id) pair and enforces ownership inside every tool: a token for Customer A cannot read or modify Customer B's resources, even if the model requests it.

Rate limit

60 requests per minute per API key, enforced as a sliding window. Every response includes:

Exceeding the limit returns 429 Too Many Requests with a Retry-After header. Need a higher rate? Contact support.

Initialize handshake

curl -X POST https://mcp.data-magik.com/mcp \
  -H 'Authorization: Bearer dm_pat_...' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2024-11-05",
      "capabilities": {},
      "clientInfo": {"name": "my-agent", "version": "1.0.0"}
    }
  }'

List available tools

curl -X POST https://mcp.data-magik.com/mcp \
  -H 'Authorization: Bearer dm_pat_...' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'

Returns 114+ tools across 13 families. Highlights below.

Tool families

Click a family to see every tool it exposes.

plex_* 12 tools

Plex DB schema introspection. Walk databases, tables, columns, and foreign-key relationships.

plex_search Free-text search across tables and columns in one call
plex_describe Compact table summary: columns + types + FK targets
plex_summary High-level stats for a database (table count, size, key entities)
plex_neighborhood Given a table, return its FK neighborhood (1-hop graph)
plex_join_path Shortest FK-join path between two tables, ready to translate to SQL
plex_validate_sql Static-check a SQL string against the Plex schema before running
plex_list_databases List the 32 known Plex databases
plex_list_tables List tables in a database
plex_search_tables Search table names by pattern
plex_search_columns Search column names by pattern, optionally scoped to a table
plex_get_table Full schema for one table
plex_find_relationships List all FK relationships in/out of a table
scripts_* 12 tools

Read and write Plex scripts. Versions are tracked; executions stream output back via status polling.

scripts_list List all scripts in the company
scripts_get Get one script with code + metadata
scripts_create Create a new script (writes a version row)
scripts_update Update script metadata or code
scripts_delete Soft-delete a script
scripts_execute Run the saved script (returns execution_id; poll with _get_execution_status)
scripts_test_run Run code against a test input without saving
scripts_get_execution_status Poll one execution for output/status
scripts_list_executions Recent executions for a script
scripts_list_versions Version history
scripts_create_version Snapshot current code as a new version
scripts_validate_syntax Quick parse-check of script code
sql_* 8 tools

Saved SQL queries against Plex. Async execution model (submit then poll), plus a synchronous test_run for verification.

sql_list_queries List all saved queries
sql_get_query Get one query with body + metadata
sql_create_query Save a new query
sql_update_query Update a saved query
sql_delete_query Delete a saved query
sql_execute Submit for execution; returns execution_id
sql_test_run Synchronous run with row cap + timeout; returns rows in the same call
sql_get_execution_status Poll for results/errors
dashboards_* 9 tools

CRUD on dashboards plus live data reads of dashboard elements.

dashboards_list List dashboards
dashboards_get Get one dashboard config
dashboards_create Create a dashboard
dashboards_update Update title, layout, or elements
dashboards_update_settings Update only settings (filters, refresh interval)
dashboards_toggle Enable or disable
dashboards_delete Delete a dashboard
dashboards_get_data Read live data for the whole dashboard
dashboards_get_element_data Read live data for one element
apps_* 8 tools

Application Designer apps. Versioned + auditable; saves and rollbacks are explicit.

apps_list List apps
apps_get Get one app config
apps_create Create an app
apps_update Update app metadata
apps_delete Delete an app
apps_list_versions Version history
apps_save_version Snapshot current state as a new version
apps_rollback_version Restore a prior version
automations_* 17 tools

Automation parent records plus actions, screens, questions, and execution lifecycle.

automations_list List automations
automations_create Create a new automation parent row (required before adding actions/screens/questions)
automations_get Get one automation by id (cross-tenant safe)
automations_delete Delete an automation and cascade its children
automations_list_actions List actions in an automation
automations_create_action Add an action
automations_get_action Get one action
automations_update_action Update an action
automations_delete_action Delete an action
automations_list_screens List screens
automations_add_screen Add a screen
automations_list_questions List questions
automations_create_question Add a question
automations_update_question Update a question
automations_delete_question Delete a question
automations_execute Run an automation
automations_get_execution_status Poll one execution
doc_templates_* 11 tools

Document templates: edit, preview, commit versions, render output to PDF/CSV/Excel/etc.

doc_templates_list List templates
doc_templates_get Get template metadata
doc_templates_get_editor Get full editor payload (sections, styles)
doc_templates_create Create a template
doc_templates_preview Render preview with test data
doc_templates_commit_version Snapshot current state as a new version
doc_templates_activate_version Mark a version as active
doc_templates_rollback_version Restore a prior version
doc_templates_list_versions Version history
doc_templates_list_generated Recently generated documents from this template
doc_templates_generate_pdf Render a template against a data context to PDF/HTML/CSV/Excel/XML/JSON/custom_text (queued via pdf-service)
schedules_* 8 tools

Scheduled script + task execution. Cron-style, with on/off toggle and run history.

schedules_list List schedules
schedules_get Get one schedule
schedules_create Create a schedule
schedules_update Update a schedule
schedules_delete Delete a schedule
schedules_toggle Enable / disable
schedules_history Recent run history
schedules_validate_cron Validate a cron expression
lookup_tables_* 10 tools

Lookup tables and entries (bulk add + by-key access).

lookup_tables_list List lookup tables
lookup_tables_get Get one table
lookup_tables_create Create a table
lookup_tables_update Update a table
lookup_tables_delete Delete a table
lookup_entries_add Add one entry
lookup_entries_bulk_add Bulk add many entries
lookup_entries_update Update an entry
lookup_entries_delete Delete an entry
lookup_by_key Fetch a value by lookup key
email_templates_* 7 tools

Email templates: CRUD + duplicate + send test.

email_templates_list List templates
email_templates_get Get one template
email_templates_create Create a template
email_templates_update Update a template
email_templates_delete Delete a template
email_templates_duplicate Clone a template
email_templates_send_test Send a test email
credentials_* 4 tools

Per-company credential vault for scripts and integrations. AES-encrypted at rest.

credentials_list List credentials
credentials_create Create a credential
credentials_update Update (re-encrypts secret on every write)
credentials_delete Delete a credential
allowed_domains_* 3 tools

Allow-list of domains scripts can reach from outbound HTTP.

allowed_domains_list List allowed domains
allowed_domains_add Add a domain
allowed_domains_remove Remove a domain
documentation_* 5 tools

Customer-facing markdown docs hosted on the platform.

documentation_list List docs
documentation_get Get one doc
documentation_create Create a doc
documentation_update Update a doc
documentation_delete Delete a doc

Write-tool approval flow

Tools that mutate state (anything with verbs like _create / _update / _delete) are recorded to the ai_audit_log table with the calling user_id, company_id, tool name, arguments, and outcome. Tools called from the in-product chat additionally require the user to click Approve on a preview card before they execute. External MCP clients do not get the preview UI — the audit log is the authoritative record.

Discovery

A discovery document is published at /.well-known/mcp:

curl https://mcp.data-magik.com/.well-known/mcp

Returns the endpoint URL, transport name, auth scheme, and a pointer to this docs page. MCP-aware clients can use this for auto-configuration.

Compatibility

Need help?

The companion in-product AI assistant uses this same MCP server. If you can't get a tool call working, ask the in-product chat — it has access to the same tools and can debug alongside you.