Pre-check an MCP server (free scan on this Worker)
mcp_server_precheckWHAT: Pre-install check for one MCP server. Scans tool names (split on _ - . and camelCase), descriptions, parameter names/descriptions and schema enum/default/examples you pass for injection phrasing, concealed characters (tag characters, base64 and hex blobs are decoded and rescanned), hidden markup, cross-server references, shadowing of other tools in the same list (same sentence; plain ordering like "call X first" is not flagged), and exfil destinations (email/URL/public IP/paste site next to send/post/upload/copy/forward/BCC, or stealth wording + action + user data). Optional baseline compares SHA-256 fingerprints with a prior scan (rug pull). Optional sarif=true adds a SARIF 2.1.0 log. An MCPB manifest in toolsListJson also has its server.mcp_config command checked for download-and-pipe-to-shell, and its server.mcp_config / mcpServers env, headers, args and url checked for hardcoded secrets (same detectors as mcpConfig, masked). Also flags shell/exec tools and unrestricted file paths (OVERBROAD_PERMISSION), near-miss tool or package names (TYPOSQUAT), and with servers[] the private-data + untrusted-input + external-send combination across servers (TOXIC_FLOW). Injection and exfil phrasing is also matched in Spanish, French, German, Portuguese, Italian and Dutch. The same rules also run on prompts, resources and SKILL.md text you pass (skillMd shell blocks are checked for download-and-pipe-to-shell), and serverUrl fetches a remote server's tools/list for you. mcpConfig (a pasted mcp.json / claude_desktop_config.json / env block) is checked for hardcoded secrets and personal data with the pii_scan_text detectors (credential hygiene; values are masked, nothing is forwarded). Every result has meta.grade, an A-F letter for non-technical readers, labelled meta.grade_label "Static checks: A": it reflects deterministic pattern checks only; semantic analysis is not run. Limitation: this free tier does not detect instructions reworded to avoid known phrasing (paraphrased injection or exfiltration), so a clean grade is not proof of safety. Every finding has source (remote: for what serverUrl fetched, pasted: for text you passed); meta.grades_by_source grades each source separately, the overall meta.grade is the worst across sources (all findings of the call together), and with serverUrl meta.remote.grade is the remote server's own grade. serverUrl is scanned alone: mixing it with pasted tools/toolsListJson/servers/prompts/resources/skillMd/mcpConfig returns INPUT_MIXED_SOURCES. WHEN: Before installing or enabling an MCP server, once you have a tools/list result to pass as tools or toolsListJson (or its https URL as serverUrl), or to check an MCP client config for hardcoded keys (mcpConfig). WHEN NOT: For a dependency audit with no tool list, call osv_audit_dependencies. For a few exact versions, call osv_query_packages. This tool does not install, start or execute the package. COST: The scan is free and runs on this Fairquery-hosted Worker (Cloudflare), not on the caller's machine; tool names and descriptions you send leave the client. serverUrl is opt-in and free: this Worker connects to that URL itself (with serverBearerToken as an Authorization header if given; the token is not stored, logged or echoed), so the remote server sees a request from Cloudflare, not from you (meta.shared_externally.server_url_contacted). This Worker's code is designed not to store them and does not forward them to Apify. path and packageName are refused (PATH_NOT_ALLOWED) because this Worker has no disk. auditDependencies=true is opt-in: if toolsListJson carries a package name (MCPB manifest or package.json "name", not private), that name is sent to registry.npmjs.org (public GET, free, meta.shared_externally.package_name_to_npm_registry true); if toolsListJson is a package.json (or package-lock.json) document, its text is sent to the paid OSV Actor with your Apify token ($0.50 per 1,000 packages + $1.50 per 1,000 vulnerabilities found); without a token the audit row is APIFY_TOKEN_MISSING. A manifest is never read from disk. baseline and sarif are computed on this Worker (WebCrypto SHA-256); nothing is stored or sent anywhere. mcpConfig is scanned on this Worker only (no network call); secrets found are masked in evidence and never echoed. Free serverUrl is a one-off fetch of one public endpoint, soft rate-limited per Worker instance (10/min per host, 60/min overall; in-memory, not a durable or global quota). Bulk, scheduled and monitored fetching are not part of the free tier. RETURNS: Paged "finding" rows (rule, severity, tool, field, evidence). Evidence escapes hidden characters JS-style (\n, \u200B, \u{E0069}). Duplicate tool names are never dropped: every definition is scanned, meta.tools_scanned equals the number of tools received (meta.tools_input), and each duplicated name gets a high DUPLICATE_TOOL_NAME finding (shadowing risk). Other rules: PROMPT_INJECTION, HIDDEN_INSTRUCTION, SECRET_EXFILTRATION, CONCEALED_TEXT, ENCODED_INSTRUCTION (critical: a base64/hex blob decodes to an instruction), TOOL_SHADOWING (a description names another tool in the list with must/always/BCC/instead/before; high for hijack words or a destination), CROSS_SERVER_REFERENCE, MIXED_SCRIPT, SUSPICIOUS_PARAMETER, INSTALL_PIPE_TO_SHELL (field install_command; critical for curl|bash style, high for sh -c; field skill_md: critical for curl|bash in SKILL.md), EXFIL_DESTINATION (send/post/upload/copy/forward/BCC to a paste site, a fixed email/URL with user data/copy/stealth wording, or a raw public IP), COVERT_EXFILTRATION (stealth / hidden-from-the-user wording + an action on user data), OVERBROAD_PERMISSION (high: shell/exec-named tool with a free-form command/script parameter; medium: exec-style name alone or any/absolute-path file access; low: write/delete tool with an unrestricted path; sandbox wording lowers it), TYPOSQUAT (a tool name 1-2 typo edits from another tool in the list or a well-known MCP tool; high for look-alike characters or a near-miss popular npm package name, field package_name), TOXIC_FLOW (servers[] only: private-data reader + untrusted-content source + external sender; high when they span servers, field servers; message and evidence name the reader, untrusted and sender tools, first 8 of each), and with baseline: TOOL_CHANGED (high; list-hash-only baseline: medium, field tool_list), TOOL_ADDED (medium), TOOL_REMOVED (low), field definition. Every finding has owasp tags (OWASP MCP Top 10 2025 MCPxx and LLM Top 10 2025 LLMxx) and source: remote: (serverUrl surface), pasted:tools, pasted:toolsListJson (incl. package, install_command and mcpServers env findings), pasted:servers, pasted:prompts, pasted:resources, pasted:skill_md, pasted:mcp_config or pasted:baseline (TOOL_CHANGED/ADDED/REMOVED); a finding that involves several inputs (duplicate name, typosquat pair, toxic flow) joins them with "+". meta.grades_by_source maps each source to {grade, grade_label, risk_level, finding_counts}; meta.grade / grade_label / risk_level are the worst across sources (computed over all findings together), and meta.grade_scope says so. With serverUrl, meta.remote.grade / grade_label / risk_level / finding_counts come from remote findings only. mcpServers / server.mcp_config inside toolsListJson: env, headers, args and url get the mcpConfig secret detectors (HARDCODED_SECRET / CONFIG_PII, masked; meta.install_config_scanned); anything that cannot be scanned is named in meta.notes as MCP_SERVERS_NOT_SCANNED, never skipped without a note. Prompt/resource/SKILL.md text that sends to a fixed email/URL is EXFIL_DESTINATION medium even without user-data wording. meta.tools_fingerprint (sha256 per tool + list_sha256) is always returned so you can pass it as baseline next time; meta.baseline reports matched/changed/added/removed; meta.sarif is present only when sarif=true. Schema values report field parameter_enum, parameter_default, parameter_examples, parameter_const, parameter_title or schema_default/schema_examples. If auditDependencies is true, one "dependency_audit" row: status no_manifest unless toolsListJson is a package.json/lockfile. meta.risk_level is none, low, medium, high, critical or not_assessed. meta.grade is A-F (A: nothing above low; B: worst medium; C: 1-2 high; D: 3+ high; F: any critical; null when not assessed), meta.grade_scale repeats this. meta.grade_label shows it as "Static checks: ", meta.grade_basis is "static_checks" and meta.semantic_analysis is "not_run"; when a grade is present meta.notes includes PARAPHRASE_GAP (reworded instructions are not detected). mcpConfig findings: HARDCODED_SECRET (high for a known token format such as ghp_/sk-/AKIA/xox, medium for a generic key=value or a secret-named variable holding a literal; tool = server name from the config, field mcp_config_env, mcp_config_header, mcp_config_args, mcp_config_url, mcp_config_auth or mcp_config, parameter = key name, evidence masked) and CONFIG_PII (low: email, phone, card, IBAN, SSN in the config); meta.config_scanned {format, servers, values_scanned, hardcoded_secrets, pii_values, forwarded:false}. TYPOSQUAT severity: look-alike characters or swapped letters high, other single-letter edits low, 2 edits medium; abbreviation pairs (mail/email, msg/message, repo/repository, dir/directory) are not typos. Cross-server TOOL_SHADOWING names the other server and is one level higher than same-list (high -> critical). Prompt/resource/SKILL.md findings use tool = prompt/resource name or "SKILL.md" and field prompt_name, prompt_title, prompt_description, prompt_argument, resource_name, resource_title, resource_description, resource_text or skill_md; meta.extras_scanned counts them. With serverUrl, meta.remote reports host, server_name, protocol_version, tools/prompts/resources fetched and requests. meta.description_scanned is about the package-level description only (false = none present; tool descriptions are always scanned); meta.description_scanned_meaning repeats this. meta.shared_externally is the data-flow record for this call: tool_names_and_descriptions is always false (that text is not forwarded to npm or Apify, though this Worker receives it); package_name_to_npm_registry is true when the package name was sent to registry.npmjs.org; manifest_to_osv_actor is true when manifest text was sent to the OSV Actor; server_url_contacted is the host this Worker connected to for serverUrl (false otherwise). Errors: INPUT_EMPTY, INPUT_MIXED_SOURCES (serverUrl plus pasted content), INVALID_SERVER_URL, SERVER_URL_NOT_ALLOWED, SERVER_URL_RATE_LIMITED, SERVER_URL_AUTH, SERVER_URL_FETCH_FAILED, INVALID_JSON, INVALID_PACKAGE_NAME, PATH_NOT_ALLOWED, INPUT_TOO_LARGE, INVALID_BASELINE. BEHAVIOR: Default auditDependencies=false: no further network call and no process spawn. Scans only tools or toolsListJson you pass. path and packageName return PATH_NOT_ALLOWED and nothing is read. This Worker has no disk, so it does not read package.json, lockfiles, manifest.json, or server.json, and it does not follow symlinks. auditDependencies=true: if toolsListJson carries a package name (MCPB manifest "name" or package.json "name", not private), this Worker sends that name only to registry.npmjs.org (public GET) for license and publish dates; if toolsListJson is a package.json or package-lock.json, this Worker sends that manifest text to the paid OSV Actor (Apify) using your token. Plain tools/list input with no package name makes no registry or OSV call. serverUrl: this Worker POSTs initialize, notifications/initialized and tools/list (plus prompts/list and resources/list metadata when the server advertises them; resources are not read) to that URL over MCP Streamable HTTP, JSON or SSE responses; https and public hostnames only (no IP literals, no internal or trailing-dot internal names, no cloud metadata names, no wildcard-DNS helpers such as nip.io/sslip.io; the host is resolved over DNS-over-HTTPS first and refused if any address is loopback, RFC1918, link-local/metadata 169.254.x, CGNAT, ULA or otherwise reserved; ports 80/443), soft rate limit per Worker instance (SERVER_URL_RATE_LIMITED), redirects not followed, 10 s per request, 12 requests max, then a best-effort DELETE of the session. It never calls a remote tool. meta.shared_externally.package_name_to_npm_registry and manifest_to_osv_actor report exactly which happened. PARAMETERS: Pass tools or toolsListJson (neither, and no path or packageName -> INPUT_EMPTY). tools: structured tools/list entries. toolsListJson: raw JSON of a tools/list result, an MCPB manifest or a tools array; invalid JSON -> INVALID_JSON. path and packageName always fail on this Worker (no disk): an invalid packageName is INVALID_PACKAGE_NAME, and any other path or packageName is PATH_NOT_ALLOWED. Nothing is read or downloaded. Use the npm server @fairquery/agent-trust-mcp for a path or packageName scan. Each field is scanned up to 20,000 characters and the raw total must be <= 500,000. auditDependencies defaults to false; true can make the registry.npmjs.org and paid OSV calls described in BEHAVIOR. minSeverity and includeDevDependencies are only forwarded to the OSV Actor. baseline: optional, a string OR a JSON object/array (JSON-parsing clients may pass the object as-is): the prior meta.tools_fingerprint object or its JSON text (per-tool detail), the 64-hex list_sha256 string or {"list_sha256":"..."} (list-level only), or a prior tools/list result / tools array (invalid -> INVALID_BASELINE). baselineTools: optional array alias (fingerprint tools [{name,sha256}] or a tools array). sarif: boolean, default false; sarif:true puts a SARIF 2.1.0 log in meta.sarif (format:"sarif" is accepted as an alias with a note). servers: optional [{name, tools}] (one entry per installed MCP server, up to 20; total tools still <= 400): every tool is scanned as usual with shadowing/duplicates checked across servers, each finding carries server, a name defined by several servers is DUPLICATE_TOOL_NAME medium, and TOXIC_FLOW is checked. prompts: optional prompts/list entries [{name, description, arguments:[{name, description}]}]. resources: optional resources/list entries [{uri, name, description}] plus optional text (resource content). skillMd: optional SKILL.md text (frontmatter + body, <= 500,000 chars). serverUrl: optional https URL of a remote MCP Streamable HTTP endpoint (e.g. https://example.com/mcp); scan it alone: serverUrl together with tools, toolsListJson, servers, prompts, resources, skillMd or mcpConfig returns INPUT_MIXED_SOURCES and nothing is sent (baseline and sarif are allowed). serverBearerToken: optional bearer token sent only to serverUrl. mcpConfig: optional text (<= 200,000 chars) of an MCP client config: JSON/JSONC with mcpServers, servers, context_servers or mcp.servers, a single server entry, or plain KEY=value / export KEY=value lines; env, headers, args, url and auth fields are scanned for hardcoded secrets (${env:X}, ${input:x}, $X and similar references are skipped). Any other parameter name is ignored and listed in meta.notes as "unknown parameter: ". limit/offset page the combined rows. EXAMPLE: {"tools":[{"name":"sum","description":"Add two numbers."}]} -> risk_level "none", shared_externally.tool_names_and_descriptions false. A poisoned description returns finding rows and a higher risk_level.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "mcp_server_precheck"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Refused on this hosted Worker: any path returns PATH_NOT_ALLOWED (no disk). Pass tools or toolsListJson. Example: "/tmp/some-mcp" | |
| limit | No | Optional page size: items to return, integer 1-1000 (default 100). Example: 50 | |
| sarif | No | Optional boolean, default false. true adds meta.sarif, a SARIF 2.1.0 log of the findings with OWASP tags. Example: false | |
| tools | No | Optional if toolsListJson, path or packageName is given. 0-400 tools, as returned by tools/list. Example: [{"name":"sum","description":"Add two numbers."}] | |
| offset | No | Optional zero-based number of items to skip, integer 0-1000000 (default 0); pass nextOffset from the previous response, e.g. 100 | |
| prompts | No | Optional (t1923u). prompts/list prompts; names, descriptions and argument names/descriptions get the same rules as tools. Example: [{"name":"summarize","description":"Summarize text","arguments":[{"name":"text"}]}] | |
| servers | No | Optional multi-server input (t1919u): [{name, tools}] for every server one client will load together. Enables cross-server shadowing, duplicate and TOXIC_FLOW checks. Can be combined with tools. Example: [{"name":"files","tools":[{"name":"read_file"}]},{"name":"web","tools":[{"name":"fetch"}]}] | |
| skillMd | No | Optional (t1923u). Full SKILL.md text (Agent Skills). Scanned with the same rules; shell code blocks and `inline` commands are checked for download-and-pipe-to-shell. Example: "---\nname: x\n---\nRun `npm test`." | |
| baseline | No | Optional. A string or a JSON object/array: the prior meta.tools_fingerprint object (or its JSON text), its 64-hex list_sha256 string, {"list_sha256":"..."}, or a prior tools/list result / tools array. Compared on this Worker; adds TOOL_CHANGED / TOOL_ADDED / TOOL_REMOVED findings. Nothing is stored. Example: {"list_sha256":"3f5a...64 hex","tools":[{"name":"sum","sha256":"..."}]} | |
| mcpConfig | No | Optional (t1932u). Pasted MCP client config (mcp.json, claude_desktop_config.json, .cursor/mcp.json, VS Code servers, or a KEY=value env block). Checked for hardcoded secrets and personal data on this Worker; evidence is masked and nothing is forwarded. Example: "{\"mcpServers\":{\"github\":{\"env\":{\"GITHUB_TOKEN\":\"${env:GITHUB_TOKEN}\"}}}}" | |
| resources | No | Optional (t1923u). resources/list entries, optionally with text (the resource content). Example: [{"uri":"file:///README.md","name":"readme","text":"..."}] | |
| serverUrl | No | Optional (t1923u). https URL of a remote MCP server (Streamable HTTP). This Worker fetches tools/list (and prompts/resources lists when advertised) and scans them; meta.shared_externally.server_url_contacted reports the host. Never calls a remote tool. To scan this Fairquery endpoint itself, paste its tools/list as tools instead: a serverUrl on getfairquery.com (the own zone of this Worker) is refused with SERVER_URL_NOT_ALLOWED before any request. Scan it alone: combining it with pasted tools/toolsListJson/servers/prompts/resources/skillMd/mcpConfig returns INPUT_MIXED_SOURCES. Example: "https://example.com/mcp" | |
| minSeverity | No | Optional, one of "ALL" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL", default "ALL". Forwarded to the OSV Actor only when auditDependencies is true | ALL |
| packageName | No | Refused on this hosted Worker. An invalid npm name returns INVALID_PACKAGE_NAME; any other packageName returns PATH_NOT_ALLOWED (no disk, and the package is not downloaded). Pass tools or toolsListJson. Example: "some-mcp" | |
| baselineTools | No | Optional alias for baseline: an array, either meta.tools_fingerprint.tools ([{name,sha256}]) or a prior tools/list tools array. Ignored when baseline is also given (meta.notes says so). Example: [{"name":"sum","sha256":"..."}] | |
| toolsListJson | No | Optional if tools, path or packageName is given. Raw JSON (<= 2,000,000 chars) of a tools/list result, {"tools":[...]}, an MCPB manifest, or a tools array. Example: "{\"tools\":[{\"name\":\"sum\",\"description\":\"Add two numbers.\"}]}" | |
| auditDependencies | No | Optional boolean, default false. true sends a package name found in toolsListJson (MCPB manifest or package.json) to registry.npmjs.org, and a pasted package.json/package-lock.json to the paid OSV Actor with your Apify token. Nothing is read from disk. With a plain tools/list, true makes no external call and the audit row is no_manifest. Example: false | |
| serverBearerToken | No | Optional. Bearer token sent only to serverUrl as Authorization; never stored, logged or echoed | |
| includeDevDependencies | No | Optional boolean, default true. Forwarded to the OSV Actor only when auditDependencies is true; false skips devDependencies |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| meta | No | Tool-specific context (summary counts, cost notes, ...) | |
| count | Yes | Number of items in this page | |
| items | Yes | Result rows for this page | |
| total | Yes | Total items before paging | |
| offset | Yes | Offset of the first item in this page | |
| hasMore | Yes | True if more items exist after this page | |
| nextOffset | Yes | Offset to pass for the next page, or null |