Integration

FTIR.fun MCP Server & REST API

Connect FTIR.fun to your AI assistant or automation pipeline. MCP server for Claude/Cursor/Codex. REST API for custom integrations. Same 130,000+ reference spectra and literature-backed AI interpretation across all methods.

MCP Server — Claude, Cursor, Codex

FTIR.fun's MCP (Model Context Protocol) server has been reviewed and officially listed on the Anthropic MCP Registry, Smithery, and MCP.so. It exposes FTIR spectral search, peak explanation with DOI-cited literature, and material identification as callable tools for any MCP-compatible client.

Quick Connect

# Claude Desktop / Claude Code claude mcp add ftirfun https://ftir.fun/mcp # Cursor # Add to ~/.cursor/mcp.json: {"mcpServers": {"ftirfun": {"url": "https://ftir.fun/mcp"}}} # OpenAI Codex codex mcp add ftirfun https://ftir.fun/mcp

Available Tools

ToolDescription
search_ftir_librarySearch 130K+ reference spectra by peaks or uploaded file. Returns ranked matches with CAS numbers and similarity scores.
search_public_ftir_resultsSearch community-shared analysis results by keyword.
fetch_public_ftir_resultFetch a specific public FTIR analysis result by ID for detailed review.

Server Card & Registry Links

View All Platform Integrations

Coze Plugin — Use Inside Doubao

Open Doubao → Plugin Store → search "FTIR" or "红外分析" → tap Add. No configuration needed. Doubao will automatically route infrared-related queries to our spectral search engine.

Search keywords: 红外分析, FTIR, infrared, 光谱检索, 物质识别

REST API

Library Search API

POST /v1/search

Spectral library search. Accepts a file (full-spectrum matching) or a peak list (peak-position matching). If both are provided, file search takes priority.

Authentication

X-API-Key: your-api-key

Request Body

FieldTypeRequiredDescription
file_base64stringone ofBase64-encoded instrument file (supports CSV, SPA, OPUS, SPC, JCAMP-DX, and 15+ other formats)
filenamestringwith file_base64Original filename including extension (e.g. sample.spa)
peaksnumber[]one ofList of peak wavenumbers in cm⁻¹ (e.g. [3026, 1601, 1493, 755])
top_kintegerno (default 10)Number of results to return, max 50
toleranceintegerno (default 8)Peak match tolerance in cm⁻¹, range 1–30

Response

{ "success": true, "search_mode": "full_spectrum", "n_matches": 10, "matches": [ { "rank": 1, "name": "Polystyrene", "cas": "25086-18-4", "num": 326, "similarity": 0.9586 } ], "file_format": "Thermo SPA", "n_points": 3601, "error": null }

Example — File Upload

import base64, requests with open("sample.spa", "rb") as f: b64 = base64.b64encode(f.read()).decode() resp = requests.post( "https://api.ftir.fun/v1/search", headers={"X-API-Key": "your-key", "Content-Type": "application/json"}, json={"file_base64": b64, "filename": "sample.spa", "top_k": 5}, ) print(resp.json())

Example — Peak List

import requests resp = requests.post( "https://api.ftir.fun/v1/search", headers={"X-API-Key": "your-key", "Content-Type": "application/json"}, json={"peaks": [3082, 3026, 2923, 1601, 1493, 1451, 1028, 906, 755, 699], "top_k": 5}, ) print(resp.json())

AI-Only Analysis for Existing Results

Use this endpoint only after a search result already exists. FTIR.fun first reads or OCRs the supplied report, extracts the reported candidates and sample peak table, then runs downstream KG and literature-backed analysis.

POST /ftir/analyze_existing_results

The report must contain both the reported search result list and the sample peak table. This endpoint does not perform spectral-library search by itself.

Authentication

X-API-Key: your-api-key

Request Body

FieldTypeRequiredDescription
report_textstringone ofPlain text copied from an existing instrument or library report. The text must include both the reported results and the sample peak table.
report_file_base64stringone ofBase64-encoded report file. Supported formats: PDF, DOC, DOCX, TXT, CSV, PNG, JPG, JPEG, WEBP, GIF, BMP, TIF, TIFF.
report_filenamestringwith report_file_base64Original report filename including extension (for example report.pdf or report.docx).
user_background_textstringnoOptional sample background. This is treated as soft context only and not as evidence.

Hard Input Boundary

  • Required element 1: at least one reported search result candidate, such as a Top1 hit or a Top15 list
  • Required element 2: the sample peak list or peak table in cm-1 from the same report
  • If either element is missing, the endpoint returns HTTP 422 and does not generate an analysis report

Success Response

{ "success": true, "analysis_mode": "ai_only_existing_results", "message": "AI-only analysis completed from the supplied existing results report.", "input_requirements": { "service_boundary": "AI-only analysis starts after a search result already exists.", "required_inputs": [ "At least one reported search result candidate (Top1 or Top15).", "The sample peak table or peak list in cm-1." ] }, "missing_requirements": [], "missing_requirement_messages": [], "extracted_report": { "source_kind": "pdf", "used_ocr": true, "peak_values_cm1": [1736, 1601, 1241], "library_candidates": [ {"rank": 1, "name": "Polyethylene terephthalate", "cas_number": "25038-59-9", "raw_score_text": "856/1000", "normalized_similarity": 0.856} ] }, "summary": "Reported library results rank Polyethylene terephthalate first.", "report_view": {}, "final_decision": {}, "direct_evidence": {}, "related_literature": {} }

Missing-Input Response

{ "detail": { "success": false, "analysis_mode": "ai_only_existing_results", "error": "missing_required_report_elements", "message": "AI-only analysis requires both reported library results and a sample peak table.", "missing_requirements": ["sample_peak_table"], "missing_requirement_messages": [ "Missing sample peak table. Provide the sample peak list or peak table in cm-1 from the same report." ], "input_requirements": { "failure_behavior": "If either the reported result list or the sample peak table is missing, the service stops and returns a 422 response." }, "extracted_report": { "report_has_library_results": true, "report_has_peak_table": false } } }

Example — Existing Report Text

import requests report_text = """ Sample: PET fragment Top1: Polyethylene terephthalate Score: 856/1000 Top2: Polyester resin Score: 801/1000 Peak table (cm-1): 3435, 2932, 1715, 1409, 1241, 1093, 1017, 872, 722 """ resp = requests.post( "https://api.ftir.fun/ftir/analyze_existing_results", headers={"X-API-Key": "your-key", "Content-Type": "application/json"}, json={"report_text": report_text, "user_background_text": "consumer packaging fragment"}, ) print(resp.json())

Example — Existing Report File

import base64, requests with open("instrument-report.pdf", "rb") as f: b64 = base64.b64encode(f.read()).decode() resp = requests.post( "https://api.ftir.fun/ftir/analyze_existing_results", headers={"X-API-Key": "your-key", "Content-Type": "application/json"}, json={ "report_file_base64": b64, "report_filename": "instrument-report.pdf", "user_background_text": "suspected packaging adhesive", }, ) print(resp.json())

Error Codes

HTTP StatusMeaning
200Success
401Missing or invalid API key
422Invalid request body, unsupported report format, or missing required report elements
500Server-side error
Submit Request Form