集成

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

Tool描述
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 插件 — 在豆包内使用

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

搜索关键词:红外分析, FTIR, infrared, 光谱检索, 物质识别

REST API

库搜索API

POST /v1/search

光谱库检索。接受文件(全谱匹配)或峰值列表(峰值位置匹配)。如果同时提供两者,文件搜索优先。

身份验证

X-API-Key: your-api-key

请求体

字段类型必填描述
file_base64string其中之一Base64 编码的仪器文件(支持 CSV、SPA、OPUS、SPC、JCAMP-DX 等 15 种以上格式)
filenamestring使用 file_base64原始文件名(包含扩展名,例如 sample.spa)
peaksnumber[]其中之一峰值波数列表(单位:cm⁻¹,例如 [3026, 1601, 1493, 755])
top_kinteger否(默认 10)返回结果数量,最多 50 个
toleranceinteger否(默认 8)峰值匹配容差(cm⁻¹),范围 1–30

响应

{ "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 }

示例 — 文件上传

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())

示例 — 峰值列表

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分析

仅在搜索结果已存在后使用此端点。FTIR.fun首先读取或OCR提供的报告,提取报告的候选物和样品峰表,然后运行下游知识图谱和文献支持的分析。

POST /ftir/analyze_existing_results

报告必须包含报告的结果列表和样品峰表。此端点本身不执行光谱库搜索。

身份验证

X-API-Key: your-api-key

请求体

字段类型必填描述
report_textstring其中之一从现有仪器或库报告中复制的纯文本。文本必须包含报告的结果和样品峰表。
report_file_base64string其中之一Base64编码的报告文件。支持的格式:PDF、DOC、DOCX、TXT、CSV、PNG、JPG、JPEG、WEBP、GIF、BMP、TIF、TIFF。
report_filenamestring使用report_file_base64原始报告文件名(包括扩展名,例如report.pdf或report.docx)。
user_background_textstring可选的样品背景。仅作为软上下文处理,不作为证据。

硬输入边界

  • 必需元素1:至少一个报告的搜索结果候选,例如Top1命中或Top15列表
  • 必需元素2:同一报告中以cm-1为单位的样品峰列表或峰表
  • 如果缺少任一元素,端点返回HTTP 422并且不生成分析报告

成功响应

{ "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": {} }

缺少输入响应

{ "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 } } }

示例——现有报告文本

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())

示例——现有报告文件

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())

错误代码

HTTP 状态含义
200成功
401缺少或无效的 API 密钥
422无效的请求体、不支持的报告格式或缺少必需的报告元素
500服务器端错误
提交请求 表单