JSON to CSV Converter MCP Server
Convert JSON to CSV on the MCP server from raw data or public .json URLs for fast, reliable format transformation.
npx -y @he-yang/json-to-excel-mcpOverview
This MCP (Model Context Protocol) server provides a simple, production-ready service to convert JSON data into CSV format. It accepts either raw JSON payloads or publicly accessible .json URLs, performs robust parsing (including basic flattening of nested structures), and returns a CSV file suitable for spreadsheets, BI tools, or downstream ETL pipelines.
The server is designed for developers who need a fast, reliable transformation endpoint that can be integrated into CI pipelines, microservices, or data ingestion flows. It exposes straightforward HTTP endpoints and supports common configuration options such as delimiter selection, header inclusion, and temporary file handling.
Features
- Convert JSON arrays or newline-delimited JSON to CSV
- Accept raw JSON POST bodies or a public .json URL to fetch and convert
- Options for delimiter (comma, semicolon, tab) and header row control
- Basic flattening of nested objects (dot notation)
- Return CSV directly in response or provide a downloadable file link
- Size and timeout controls to protect against very large inputs
- Minimal, RESTful API suitable for automation and scripting
Installation / Configuration
Clone and run the server locally, or run with Docker.
Using Git and Node (example):
# Install dependencies (example uses npm; project may use yarn)
# Run in development
# Or run with environment variables
PORT=8080 TMP_DIR=/tmp/json-to-csv
Using Docker:
# Build
# Run
Example .env configuration (adapt to your deployment):
PORT=8080
TMP_DIR=/tmp/json_to_csv
MAX_PAYLOAD_MB=10
REQUEST_TIMEOUT_MS=30000
DEFAULT_DELIMITER=,
INCLUDE_HEADERS=true
Available Resources
- Source code and issues: https://github.com/he-yang/json-to-excel-mcp
- Example JSON files and sample CSV outputs are usually included in the repo under an
examples/directory (check the repo for specifics) - Use the server’s OpenAPI/Swagger (if bundled) or read the README in the repository for endpoint details
API Examples / Usage
Convert raw JSON (POST):
# Response: CSV text with headers id,name,meta.age
Convert from a public .json URL (GET or POST depending on server implementation):
Python example using requests:
=
=
=
Request parameters (common):
| Parameter | Type | Default | Description |
|---|---|---|---|
| url | string | — | Public URL to fetch JSON from |
| delimiter | string | “,” | CSV delimiter (e.g., “,”, “;”, “\t”) |
| headers | boolean | true | Include header row in CSV |
| flatten | boolean | true | Flatten nested objects using dot notation |
Response:
- 200 OK: CSV content (Content-Type: text/csv or application/octet-stream)
- 400 Bad Request: malformed JSON or missing data
- 502/504: upstream fetch failure or timeout when downloading a URL
Use Cases
- Export API results to CSV for business reporting or Excel analysis
- Transform dataset snapshots hosted as public JSON into CSV for BI ingestion
- Lightweight ETL step: fetch public .json URL, convert, and push CSV to storage
- Integration in serverless workflows where a small HTTP call returns a CSV file
Example concrete scenario:
- A monitoring system exposes daily metrics at https://data.example.com/metrics.json. Call the MCP server with the URL, receive a flattened CSV with headers, and pipe that into a data warehouse loader.
Notes and Limits
- The server is intended for public URLs and provided data; it does not fetch private/authenticated endpoints unless you configure credentials.
- For very large JSON files, use streaming-compatible endpoints or increase MAX_PAYLOAD settings cautiously.
- Nested arrays inside objects may require pre-processing or custom flattening rules; check the repository for advanced configuration.
For implementation details, refer to the repository at https://github.com/he-yang/json-to-excel-mcp and inspect configuration files and example scripts included there.