Developer & AI Integration

Connect FTIR.fun to Any AI Tool or App

Give your AI assistant or your own code direct access to 130,000+ reference spectra, knowledge-graph peak reasoning, and literature-backed interpretation. Choose one of three ways to connect — MCP for AI assistants, the REST API for code, or a ready-made Skill for no-code platforms. Every path below has step-by-step instructions written for first-time users.

Reviewed & listed on

Before you start — get your API key

MCP and the REST API both use one FTIR.fun API key. Coze/Doubao uses a service key configured by the plugin publisher, so end users do not paste a personal key. Getting a personal key takes about a minute:

  1. Sign in to FTIR.fun Create a free account if you do not have one. New accounts include free trial credits.
  2. Open the API Keys dashboard Go to Account → API Keys and click Generate.
  3. Copy and save the key immediately The full key (it starts with ftir_) is shown only once. Store it somewhere safe. If you lose it, just generate a new one.
🔑 Ready? Open the API Keys Dashboard in a new tab, then come back and follow the path you chose above.
⚠️ The hosted MCP server accepts only an account API key generated in the FTIR.fun API Keys Dashboard (starts with ftir_). Server-side master keys are for REST operators and cannot sign in to hosted MCP.

Step 1 — Which connection is right for you?

All three connect to the same engine: 130,000+ spectra, knowledge-graph reasoning, and literature citations. You only need one. Pick by how you work — not sure? MCP is the most popular choice for anyone using an AI assistant.

What your AI can actually do

The current MCP, REST, n8n, and LangChain distributions expose seven operations. The published Coze plugin exposes three tools (analyze, find, explain), and other templates may expose a smaller declared set; check each platform card before use. The operations below share the same FTIR.fun services.

Task MCP tool REST endpoint Say this to your AI
Read an instrument file parse_ftir_spectrum POST /parse-spectrum Parse sample.spc and list the detected peaks.
Identify an unknown spectrum analyze_ftir_spectrum POST /ftir/analyze_spectrum Identify what polymer this spectrum is.
Submit a full tri-axis report submit_ftir_report POST /ftir/reports Submit sample.spa for a full report in ATR mode.
Poll and retrieve that report get_ftir_report_status GET /ftir/reports/{task_id} Check the report task and give me the link when done.
Explain peaks explain_peaks POST /ftir/explain_peak_assignments What do the peaks at 1715 and 1450 cm-1 indicate?
Find a known reference spectrum find_spectra POST /ftir/find_spectra Find reference spectra for polystyrene.
Reopen an earlier result fetch_result GET /ftir/result/{result_num} Fetch result 20260528100755416137536.

Supported files: SPA, SPC, OPUS, JCAMP-DX, CSV, TSV, Excel, JSON. Valid sampling_mode values are KBr Pellet, Vapor, Solvent, Thin Film, Paraffin Mull, ATR, Diffuse Reflectance, Micro IR, and Others. Transmission is not a valid value. Keep the original file extension so FTIR.fun picks the correct parser.

find_spectra response example

find_spectra response
{
  "success": true,
  "query": "polystyrene",
  "match_mode": "synonym",
  "match_count": 3,
  "summary": "Found 3 reference spectrum candidates for 'polystyrene'.",
  "results": [
    {"num": 555, "spectrum_number": 555, "name": "PS/PPO",
     "cas": "-", "source_type": "direct_read:spa",
     "peaks": [697, 756, 1028, ...], "x": [...], "y": [...]}
  ]
}

explain_peaks response example

explain_peaks response
{
  "success": true,
  "search_mode": "peak_explanation",
  "peak_explanations": [
    {"peaks_cm1": [1715, 1450],
     "assignment": "1715 cm-1 suggests C=O stretching (ester or carboxylic acid)...",
     "evidence_type": "llm_general_knowledge"}
  ],
  "summary": "Peak explanation based on general FTIR knowledge..."
}

Getting the full report (async)

Quick screening (analyze_spectrum) returns immediately. The full tri-axis report runs in the background and typically takes 30–90 seconds. Do not resubmit while a report is running — keep the task_id and poll it.

  1. Submit Call submit_ftir_report (MCP) or POST /ftir/reports (REST). You get back a task_id and a reserved result_num. The file_base64 field is required; other fields (sampling_mode, prior_context, language_code, sample_name, sample_order_no) are optional.
    Submit example (REST)
    curl -X POST https://ftir.fun/ftir/reports \
      -H "X-API-Key: ftir_your_key_here" \
      -H "Content-Type: application/json" \
      -d '{"file_base64": "V2F2ZW51bWJlci...", "filename": "sample.spa", "sampling_mode": "ATR", "language_code": "en"}'
    Submit response
    {"success": true, "task_id": "rpt_abc123...", "result_num": "20260713...", "status": "queued"}
  2. Poll Call get_ftir_report_status (MCP) or GET /ftir/reports/{task_id} every 5–10 seconds until completed is true. The completed response includes report_url, report_view (structured report content), and result_num.
    Poll example
    curl https://ftir.fun/ftir/reports/rpt_abc123 \
      -H "X-API-Key: ftir_your_key_here"
    Poll response (in progress)
    {"success": true, "task_id": "rpt_abc123", "status": "running", "progress": 45, "completed": false}
    Poll response (completed)
    {"success": true, "task_id": "rpt_abc123", "status": "completed", "completed": true,
     "result_num": "20260713...", "report_url": "https://ftir.fun/outputdata/?num=20260713..."}
  3. Open the final report Open the full URL https://ftir.fun/outputdata/?num={result_num} in a browser to view the complete tri-axis result page rendered by FTIR.fun.
⚠️ Do not submit the same report again while it is queued or running. Keep the task_id and keep polling until it is complete or failed. Duplicate submissions waste points.

Troubleshooting

What you see What it means What to do
The client opens a browser authorization page, or says the authorization page does not exist. Your client is using an old OAuth-style server entry. FTIR.fun does not use OAuth — only an API key. Delete the old ftirfun server entry, paste the exact config from this page, reload the client, and start ftirfun again.
401 (MCP) / 401 invalid_api_key (REST) The API key is missing, expired, revoked, or pasted incorrectly. Restart the server and paste only the raw key (starts with ftir_). Generate a fresh key from the API Keys Dashboard if needed.
The server starts but no tools appear. The client has not refreshed its catalog, or the config uses the wrong key name. For VS Code, confirm mcp.json uses servers (not mcpServers). Then stop and start ftirfun, or reload the window.
403 insufficient_balance The account does not have enough points for that analysis. Check your balance or subscription in FTIR.fun, then retry.
429 rate_limit_exceeded REST analysis and parsing allow 60 requests per minute per API key; REST result and report-status reads use a separate 120 requests per minute bucket; MCP allows 60 calls per minute for each API key and tool. Wait for the retry period reported by the tool before calling again.
A report stays queued or running. Full reports run asynchronously and take longer than quick screening. Keep the same task_id and keep polling. Do not create duplicate report tasks.
422 or missing_input The request body is missing required fields or has invalid format. For analyze_spectrum, you must provide at least one of: peaks, query, or file_base64. Check that your JSON is valid, Content-Type is application/json, and required fields are present. See the example requests above.
413 file_too_large The uploaded spectrum file exceeds the size limit. Export a smaller file or use only peak positions via the spectrum.peaks field.

Ready to build?

The full REST reference has every endpoint, request and response formats, authentication, rate limits, error codes, MCP tool definitions, and code examples in Python and curl.

Submit Request Form