Summary
The create_card tool consistently fails with 500 errors when attempting to create new Metabase cards, even when the payload is correctly formatted and the Metabase API is functioning properly. Direct curl requests to the same endpoint with identical payloads succeed without issues.
It seems possible this is the result of untested AI code, and other commands will similarly fail.
Steps to Reproduce
- Configure MCP server with valid Metabase URL and API key:
{
"mcpServers": {
"metabase-all": {
"command": "npx",
"args": ["@cognitionai/metabase-mcp-server", "--all"],
"env": {
"METABASE_URL": "https://your-metabase-instance.com/",
"METABASE_API_KEY": "mb_your_api_key"
}
}
}
}
- Attempt to create a card using the
create_card tool with the following parameters:
{
"name": "Sample Card Name",
"description": "Top 10 rows from random table",
"visualization_settings": {},
"collection_id": 63,
"dataset_query": {
"database": 2,
"type": "native",
"native": {
"query": "SELECT * FROM schema.table LIMIT 10",
"template-tags": {}
}
},
"display": "table"
}
- Observe the error response
Expected Behavior
The card should be created successfully and return the card object with HTTP 200/201 status.
Actual Behavior
The tool fails with:
Tool 'create_card' execution failed: Failed to create card: Request failed with status code 500
Note: The error message does not include the response body from Metabase, which would normally contain detailed error information.
Workaround
Direct API calls using curl work correctly with the exact same payload:
curl -X POST "https://your-metabase-instance.com/api/card" \
-H "Content-Type: application/json" \
-H "X-API-KEY: mb_your_api_key" \
-d '{
"name": "Sample Card Name",
"description": "Top 10 rows from random table",
"visualization_settings": {},
"collection_id": 63,
"dataset_query": {
"database": 2,
"type": "native",
"native": {
"query": "SELECT * FROM schema.table LIMIT 10",
"template-tags": {}
}
},
"display": "table"
}'
This returns HTTP 200 with the created card object.
Error response body not exposed
The MCP tool only returns the HTTP status code without the response body. This makes debugging difficult because:
- Metabase API typically returns detailed error messages in the response body
- The error message format is:
Failed to create card: Request failed with status code 500
- No additional details about what went wrong are provided
Suggested Fix
- Investigate the request formation in
metabase-client.ts createCard() method to identify why it differs from a working curl request
- Expose full error responses in the MCP tool error messages to aid debugging
- Add error body to error message - even if the root cause is fixed, including the response body in error messages would help with future issues
Related Code
The implementation is in src/client/metabase-client.ts#L321:
async createCard(card: Partial<Card>): Promise<Card> {
const response = await this.axiosInstance.post("/api/card", card);
return response.data;
}
The Metabase API documentation for this endpoint: POST /api/card
Summary
The
create_cardtool consistently fails with 500 errors when attempting to create new Metabase cards, even when the payload is correctly formatted and the Metabase API is functioning properly. Directcurlrequests to the same endpoint with identical payloads succeed without issues.It seems possible this is the result of untested AI code, and other commands will similarly fail.
Steps to Reproduce
{ "mcpServers": { "metabase-all": { "command": "npx", "args": ["@cognitionai/metabase-mcp-server", "--all"], "env": { "METABASE_URL": "https://your-metabase-instance.com/", "METABASE_API_KEY": "mb_your_api_key" } } } }create_cardtool with the following parameters:{ "name": "Sample Card Name", "description": "Top 10 rows from random table", "visualization_settings": {}, "collection_id": 63, "dataset_query": { "database": 2, "type": "native", "native": { "query": "SELECT * FROM schema.table LIMIT 10", "template-tags": {} } }, "display": "table" }Expected Behavior
The card should be created successfully and return the card object with HTTP 200/201 status.
Actual Behavior
The tool fails with:
Note: The error message does not include the response body from Metabase, which would normally contain detailed error information.
Workaround
Direct API calls using
curlwork correctly with the exact same payload:This returns HTTP 200 with the created card object.
Error response body not exposed
The MCP tool only returns the HTTP status code without the response body. This makes debugging difficult because:
Failed to create card: Request failed with status code 500Suggested Fix
metabase-client.tscreateCard()method to identify why it differs from a working curl requestRelated Code
The implementation is in
src/client/metabase-client.ts#L321:The Metabase API documentation for this endpoint:
POST /api/card