{
  "markdown": "# MSDS Chain MCP Server\n\n**Chemical safety intelligence for AI-assisted experiment design.**\n\nPowered by **ChainSDS** — a verified, always-current chemical safety database. *Verified. Current. Growing.*\n\nAn [MCP](https://modelcontextprotocol.io) server that gives AI agents (Claude Code, Cursor, Copilot, pi, etc.) access to chemical safety reasoning — compatibility checks, hazard analysis, regulatory compliance, PPE recommendations, storage guidance, and more.\n\nBuilt for researchers who design experiments with AI and need safety verification integrated into their workflow.\n\n## Why This Exists\n\nWhen you use Claude to plan a synthesis route or set up an Opentrons protocol, safety validation shouldn't be a separate step. This MCP server lets your AI assistant automatically:\n\n- Check if chemicals on the same deck are compatible\n- Flag dangerous mixing orders\n- Recommend PPE for the specific chemicals you're handling\n- Verify compliance with EU REACH, US OSHA/TSCA, and 7 other jurisdictions\n- Generate signed audit reports for GLP/GMP compliance\n\n## Tools (23)\n\n| Tool | Description |\n|------|-------------|\n| **`batch_safety_check`** | One-call report for a chemical list: pairwise compatibility + per-chemical risk warnings |\n| **`check_regulatory_lists`** | Cross-reference a chemical against 23 regulatory watch lists across 8 jurisdictions + 3 international conventions |\n| **`get_sds_section`** | Retrieve a specific SDS section (1-16) for a chemical |\n| **`get_sds_document`** | Signed download URL (~5 min) for the original SDS/MSDS PDF; includes source provenance |\n| **`get_chemical_alternatives`** | Safer substitutes for restricted or high-risk chemicals |\n| **`validate_protocol_chemicals`** | Extract & validate chemical names from protocol text or code |\n| **`check_mixing_order`** | Safe addition sequence for reagent pairs (e.g., acid into water) |\n| **`get_waste_disposal`** | Waste classification, container type, and disposal procedures |\n| **`upload_msds_pdf`** | Upload MSDS PDF for AI-powered parsing and data extraction (requires API key) |\n| **`compare_sds_versions`** | Hazard-change diff between two SDS versions (H-code additions/removals + whether they change a verdict) |\n| `check_chemical_compatibility` | Pairwise compatibility for 2+ chemicals |\n| `get_chemical_risk_warnings` | GHS classification, H-codes, signal words, flash point |\n| `get_ppe_recommendation` | Gloves, eye protection, respiratory, body protection |\n| `get_storage_guidance` | Storage class, cabinet type, temperature, isolation rules |\n| `get_emergency_response` | Spill, fire, or exposure emergency procedures |\n| `get_exposure_limits` | OEL/TLV/PEL/MAC across US, EU, JP, CN, INT |\n| `get_transport_classification` | UN number, hazard class, packing group, ADR/IATA/IMDG |\n| `check_regulatory_compliance` | Multi-region: EU, US, CN, JP, CA, AU, SG list-backed; KR/TW accepted but no list wired |\n| `search_chemical_database` | Look up chemicals by name, synonym, or CAS number |\n| `ask_chemical_safety` | Natural language catch-all for any safety question |\n| `create_audit_session` | Full audit with signed PDF report (requires API key) |\n| `get_audit_report` | Download link for the signed audit PDF |\n\n## Quick Start\n\n### 1. Get an API key\n\nSign up at [msdschain.lagentbot.com](https://msdschain.lagentbot.com) → **API Keys** tab → create a key.\n\n### 2. Install\n\n```bash\ngit clone https://github.com/littleblakew/msds-chain-mcp.git\ncd msds-chain-mcp\npip install -r requirements.txt\n```\n\n### 3. Add to your AI coding agent\n\n> **Architecture note:** the hosted endpoint `https://mcp.lagentbot.com` sits behind a\n> distribution **gateway** that terminates OAuth 2.1 (PKCE + DCR) and serves\n> `/.well-known/oauth-authorization-server`. The **OAuth / browser sign-in flow described\n> below applies only to that hosted gateway.** This repo's bare core server\n> (`python server_remote.py`, or the Docker image) does *not* implement OAuth or serve any\n> `/.well-known` endpoint — it only accepts `Authorization: Bearer sk-msds-...` or\n> `X-Api-Key` passthrough. If you self-host the core directly, use a static API key; there\n> is no browser sign-in step.\n\n**Claude Code (Remote — recommended):**\n```bash\nclaude mcp add msds-chain --transport http https://mcp.lagentbot.com/mcp\n```\nThen run `/mcp` in Claude Code and authenticate — a browser opens to sign in (email\ncode); your account is provisioned automatically and calls are metered to you (free\nplan includes a monthly free quota). The legacy SSE endpoint\n(`--transport sse https://mcp.lagentbot.com/sse`) still works but streamable\nHTTP is preferred.\n\n**Claude Code (Plugin — includes skill + MCP):**\n```bash\n/plugin install https://github.com/littleblakew/msds-chain-mcp.git\n```\n\n**Claude Code (npm — remote, shim registers the hosted endpoint):**\n```bash\nclaude mcp add msds-chain -- npx -y msds-chain-mcp@latest\n```\n\n**claude.ai (Web):**\nSearch \"msds-chain\" in Settings > Plugins (already published).\n\n**Manual config** (Claude Code `~/.claude.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"msds-chain\": {\n      \"type\": \"http\",\n      \"url\": \"https://mcp.lagentbot.com/mcp\"\n    }\n  }\n}\n```\n\nRestart Claude Code, run `/mcp`, and authenticate (OAuth). You should then see\n`msds-chain` in the MCP tools list. (Prefer a static key instead of OAuth? Pass it as\na header — `--header \"Authorization: Bearer sk-msds-your-key\"` — for headless clients.)\n\n## Claude Code Skill\n\nThe `/msds-safety-check` skill provides auto-detection and guided audit workflows.\n\n**Plugin install (includes skill + MCP automatically):**\n```bash\n/plugin install https://github.com/littleblakew/msds-chain-mcp.git\n```\n\n**Manual install (skill only, if MCP already configured):**\n```bash\ngit clone https://github.com/littleblakew/msds-chain-mcp.git /tmp/msds-chain-mcp\ncp -r /tmp/msds-chain-mcp/skills/msds-safety-check .agents/skills/msds-safety-check\nln -s ../../.agents/skills/msds-safety-check .claude/skills/msds-safety-check\n```\n\n### What the Skill Does\n- **Auto-detects** chemicals in your conversations and offers safety checks\n- **`/msds-safety-check`** — guided audit for lab protocols or EHS compliance\n- **Freemium** — basic queries work without API key, audit reports require free registration\n\n## Usage Examples\n\n### Experiment Protocol Review\n\n```\nUser: I'm planning a Grignard reaction with magnesium turnings, diethyl ether,\n      and bromobenzene. Check if this setup is safe.\n\nClaude:\n  → calls batch_safety_check([\"magnesium\", \"diethyl ether\", \"bromobenzene\"])\n  → Returns: compatibility matrix + per-chemical risk warnings (with source SDS)\n```\n\n### Opentrons Deck Safety Audit\n\n```\nUser: My Opentrons deck has these in different slots:\n      Slot 1: Acetone, Slot 3: Concentrated H2SO4, Slot 5: Methanol,\n      Slot 7: Sodium borohydride. Any safety issues?\n\nClaude:\n  → calls check_chemical_compatibility([\"acetone\", \"sulfuric acid\", \"methanol\", \"sodium borohydride\"])\n  → ⚠️ INCOMPATIBLE: Sodium borohydride + sulfuric acid (violent reaction, H2 gas evolution)\n  → ⚠️ CAUTION: Acetone + sulfuric acid (exothermic)\n  → Recommendation: Move sodium borohydride to maximum distance from acids\n```\n\n### Compliance Check Before Shipping\n\n```\nUser: We need to ship toluene and dichloromethane to our Japan lab.\n      What transport regulations apply?\n\nClaude:\n  → calls get_transport_classification([\"toluene\", \"dichloromethane\"])\n  → calls check_regulatory_compliance([\"toluene\", \"dichloromethane\"], regions=[\"JP\"])\n  → Returns: UN numbers, IATA packing instructions, Japan-specific regulations\n```\n\n### Generate Signed Audit Report\n\n```\nUser: Create a safety audit report for our quarterly review.\n      Chemicals: acetone, methanol, ethanol, isopropanol, hexane.\n\nClaude:\n  → calls create_audit_session(\"Q2 2026 Solvent Cabinet Review\", [\"acetone\", \"methanol\", \"ethanol\", \"isopropanol\", \"hexane\"])\n  → calls get_audit_report(\"SESSION-ID\")\n  → Returns: Signed PDF URL (Ed25519 signature, suitable for GLP/GMP compliance)\n```\n\n### Try These Prompts (one per tool)\n\nEach prompt reliably triggers the named tool. Use them to evaluate the connector end-to-end.\n\n| Tool | Example prompt | What a good response shows |\n|------|----------------|----------------------------|\n| `search_chemical_database` | \"Look up the chemical with CAS 67-64-1.\" | Acetone identified with synonyms + CAS |\n| `ask_chemical_safety` | \"Is it safe to store bleach next to ammonia?\" | Plain-language hazard answer (toxic chloramine gas) |\n| `check_chemical_compatibility` | \"Are acetone and hydrogen peroxide compatible?\" | Pairwise verdict + reaction risk |\n| `get_chemical_risk_warnings` | \"What are the GHS hazards of toluene?\" | H-codes, signal word, flash point |\n| `get_ppe_recommendation` | \"What PPE do I need to handle concentrated sulfuric acid?\" | Gloves/eye/respiratory/body guidance |\n| `get_storage_guidance` | \"How should I store sodium hydroxide and nitric acid?\" | Storage class, cabinet, isolation rules |\n| `get_emergency_response` | \"What do I do if I spill chloroform?\" | Step-by-step spill procedure |\n| `get_exposure_limits` | \"What's the OEL for benzene in the EU?\" | OEL/TLV/PEL values by region |\n| `get_transport_classification` | \"How is acetone classified for air freight?\" | UN number, hazard class, packing group |\n| `check_regulatory_compliance` | \"Is dichloromethane restricted in Japan and the EU?\" | Per-region compliance status |\n| `check_regulatory_lists` | \"Which regulatory watch lists include formaldehyde?\" | Matched lists across regions |\n| `get_waste_disposal` | \"How do I dispose of waste acetonitrile?\" | Waste class, container, procedure |\n| `check_mixing_order` | \"What's the safe order to mix sulfuric acid and water?\" | Correct addition sequence + why |\n| `get_chemical_alternatives` | \"Is there a safer substitute for hexane in extraction?\" | Lower-hazard alternatives |\n| `validate_protocol_chemicals` | \"Validate the chemicals in this protocol: [paste text]\" | Extracted + verified chemical list |\n| `get_sds_section` | \"Show me section 4 (first aid) of the SDS for methanol.\" | Requested SDS section content |\n| `compare_sds_versions` | \"What changed between SDS versions for acetone?\" | Hazard changes between the two versions |\n| `batch_safety_check` | \"Run a full safety check on acetone, methanol, and hexane.\" | Compatibility matrix + risk warnings |\n| `upload_msds_pdf` | \"Parse this MSDS PDF and extract its hazard data.\" *(API key)* | Structured extraction from the PDF |\n| `create_audit_session` | \"Create a signed audit report for our solvent cabinet.\" *(API key)* | Audit session + signed PDF |\n| `get_audit_report` | \"Give me the download link for that audit report.\" *(API key)* | Signed PDF URL |\n\n## Privacy & Data Handling\n\n- **Privacy Policy:** [msdschain.lagentbot.com/privacy](https://msdschain.lagentbot.com/privacy)\n- Read-only tools send only the chemical names / queries you provide; no personal data is required.\n- API-key tools (`upload_msds_pdf`, `create_audit_session`, `get_audit_report`) associate activity with your account for audit traceability.\n- Uploaded MSDS PDFs are processed for data extraction and contribute to the verified ChainSDS database per your account's data-sharing settings.\n\n## Third-Party AI Platform Integration\n\nConnect to the hosted MSDS Chain MCP server from any AI platform that supports MCP.\n\n**Server URL (preferred):** `https://mcp.lagentbot.com/mcp` (streamable HTTP)\n\nThe hosted endpoint serves **both** transports — streamable HTTP (`/mcp`, preferred) and SSE (`/sse`, for clients that only speak SSE: 悟空, Dify, Coze, etc.). Calls are metered per authenticated user.\n\n| Transport | Endpoint | Notes |\n|-----------|----------|-------|\n| Streamable HTTP | `https://mcp.lagentbot.com/mcp` | Preferred — broadest, most robust |\n| SSE | `https://mcp.lagentbot.com/sse` | For SSE-only clients |\n\n**Authentication:** either OAuth (the client opens a browser sign-in on first connect) or a static header — `Authorization: Bearer sk-msds-your-key` — for headless clients.\n\n### 悟空 (Wukong)\n\n1. 设置 → MCP 服务 → + 添加\n2. 类型：**SSE**\n3. 名称：`msds-chain`\n4. URL：`https://mcp.lagentbot.com/sse`\n5. HTTP Headers：`Authorization` : `Bearer sk-msds-your-key`\n6. 点击「添加」\n\n### Dify / Coze / other platforms\n\nGeneral steps:\n1. Find MCP server / tool integration settings\n2. Select **SSE** transport type\n3. Set URL to `https://mcp.lagentbot.com/sse`\n4. Add authentication header: `Authorization: Bearer sk-msds-your-key`\n\n> **Get an API key:** Sign up at [msdschain.lagentbot.com](https://msdschain.lagentbot.com) → API Keys tab → Create Key.\n\n---\n\n## Remote Mode (HTTP)\n\nFor cloud deployment or shared team access, run as an HTTP server:\n\n```bash\nMSDS_API_KEY=sk-msds-xxx python server_remote.py\n```\n\nA single `server_remote.py` process always serves **both** transports concurrently —\nStreamable HTTP at `/mcp` (recommended for Claude Code 2026+) and SSE at `/sse`\n(compatibility). The `MSDS_MCP_TRANSPORT` env var is kept for backward compatibility\nonly; it is ignored at runtime.\n\nConnect from Claude Code:\n\n```bash\nclaude mcp add msds-chain --transport http https://your-server.example.com/mcp\n```\n\n### Docker\n\n```bash\ndocker build -t msds-chain-mcp .\ndocker run -p 8080:8080 -e MSDS_API_KEY=sk-msds-xxx msds-chain-mcp\n```\n\n## Configuration\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `MSDS_API_KEY` | *(required)* | API key from the MSDS Chain dashboard |\n| `MSDS_API_URL` | Production URL | For development use only |\n| `MSDS_LANG` | `en` | Response language: `en`, `zh`, `ja`, `de`, `id` |\n\n## Use Cases\n\n### Lab Automation (Opentrons / Hamilton / Tecan)\n- Pre-run protocol safety audit\n- Deck layout compatibility verification\n- Automated run compliance reports\n\n### Electronic Lab Notebooks (Benchling / LabArchives)\n- Safety annotations on experiment entries\n- Chemical registration with auto-flagging\n\n### Pharmaceutical R&D\n- Synthesis route safety screening\n- Multi-region regulatory pre-checks for new compounds\n- GMP-ready audit trail with signed receipts\n\n## Data Coverage — ChainSDS\n\nIndustry-sourced, AI-verified, and cryptographically signed.\n\n- **4,000,000+ chemical records** with multi-language aliases (EN/ZH/JA)\n- **NFPA/GHS classification** for compatibility rules\n- **23 regulatory watch lists across 8 jurisdictions + 3 international conventions** (EU, US, CN, JP, KR, CA, AU, SG; no Taiwan and no IARC coverage)\n- **Occupational exposure limits** from 5 standards (OSHA PEL, ACGIH TLV, EU IOELV, JP OEL, CN GBZ)\n- **UN transport data** for 16+ common lab chemicals\n- **Version tracking** — detects a newer SDS and diffs its hazard classification against the one you relied on\n\n## Architecture\n\n```\nYour AI Agent                  MSDS Chain MCP Server\n┌──────────────────┐           ┌─────────────────────────┐\n│ Claude Code      │           │ 23 Safety Tools         │\n│ Cursor / pi      │──MCP────▶│   ↓                     │\n│ Any MCP client   │           │ ChainSDS Platform       │\n└──────────────────┘           └─────────────────────────┘\n```\n\nThe MCP server connects to the ChainSDS platform for verified safety reasoning.\n\n## Development\n\nTest locally with the MCP inspector:\n\n```bash\nexport MSDS_API_KEY=sk-msds-your-key\nnpx @modelcontextprotocol/inspector python server.py\n```\n\n## Troubleshooting\n\n| Symptom | Likely cause | Fix |\n|---------|--------------|-----|\n| `401 Unauthorized` on connect | Missing or invalid API key | Verify the `Authorization: Bearer sk-msds-...` header (or `MSDS_API_KEY` env var). Generate a fresh key at [msdschain.lagentbot.com](https://msdschain.lagentbot.com) → API Keys. |\n| Tools don't appear in the client | MCP server not loaded | Fully restart the client after adding the server. Confirm `msds-chain` shows in the MCP/tools list. |\n| Connection drops or times out | Wrong transport / endpoint | Prefer the streamable HTTP endpoint `https://mcp.lagentbot.com/mcp` (SSE sessions can drop when the server redeploys). Check `GET https://mcp.lagentbot.com/health` returns `{\"status\":\"ok\"}` — that is the gateway; the core's tool count lives on an internal endpoint that is not publicly reachable, so a missing `tools` field is expected. |\n| `Quota exceeded` / 429 | Monthly call limit hit | Free keys are limited; upgrade your plan or wait for the monthly reset. |\n| Empty results for a known chemical | Name not matched | Retry with the CAS number or a common synonym; `search_chemical_database` accepts name, synonym, or CAS. |\n| OAuth login fails in a browser client | OAuth metadata unreachable (hosted gateway only — self-hosted core has no OAuth) | Confirm `GET https://mcp.lagentbot.com/.well-known/oauth-authorization-server` returns 200; the client should auto-discover the authorize/token endpoints. If self-hosting `server_remote.py` directly, skip OAuth and use a static `Authorization: Bearer` key instead. |\n\nStill stuck? Email **contact@lagentbot.com** or open an issue at [github.com/littleblakew/msds-chain-mcp/issues](https://github.com/littleblakew/msds-chain-mcp/issues).\n\n## Roadmap\n\n- [x] `get_waste_disposal` — waste classification and disposal guidance\n- [x] `check_mixing_order` — safe addition sequence for reagent pairs\n- [x] `get_chemical_alternatives` — safer substitutes for restricted chemicals\n- [x] Remote MCP (HTTP SSE / Streamable HTTP) for cloud-hosted access\n- [x] OAuth 2.1 for Claude Marketplace integration (served by the distribution gateway in front of `mcp.lagentbot.com`, not by this core server)\n\n## License\n\nMIT\n\n## About\n\nBuilt by [LAgentBot](https://lagentbot.com) — AI-powered chemical safety infrastructure.\n\nPart of the [MSDS Chain](https://msdschain.lagentbot.com) platform — the world's first AI Agent-driven chemical safety data trust network, powered by [ChainSDS](https://msdschain.lagentbot.com): verified, current, and growing.\n",
  "bytes": 17800,
  "sha": "4003b355adcf043051d16385cb3255e4d0ee0654ec4f9924a8fe8ef385218e22",
  "repo_slug": "littleblakew/msds-chain-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_littleblakew_msds_chain_mcp_msds_chain_4d899a69/readme"
}