Contrie
v1.2.1Extract structured data from a web page, read it as markdown, verify values against the source.
A stdio proxy with three default tools for Contrie's hosted REST API. The executable runs locally; fetching, rendering, extraction, customer accounting and signing run at the configured Contrie backend. This package contains no browser engine or local inference service. Two supplied-HTML verification tools are available only with the explicit local opt-in described below. Published on npm as @contrie/mcp.
Summary extracted from the README.
@contrie/mcp
A stdio proxy with three default tools for Contrie's hosted REST API. The executable runs locally; fetching, rendering, extraction, customer accounting and signing run at the configured Contrie backend. This package contains no browser engine or local inference service. Two supplied-HTML verification tools are available only with the explicit local opt-in described below.
Published on npm as @contrie/mcp. Most clients should use the hosted
endpoint https://www.contrie.com/mcp instead (listed in the MCP Registry as
com.contrie/contrie): nothing to install, sign-in with a Contrie account, and all
hosted tools. Use this package when a client only speaks stdio or runs headless
with an API key. Node >=20.18.1 is the dependency compatibility floor; the
artifact smoke test records the actual Node version tested.
| Tool | Input | Result |
|---|---|---|
contrie_extract |
url, optional extract instructions, JSON schema, render, maxAge, idempotencyKey |
The complete upstream JSON response in a text content block, including data, validation metadata, credits and available signed evidence. |
contrie_account |
No arguments | Own-account credits, reset time and current restrictions. Zero extraction credits; advisory only, no capacity reservation. |
contrie_read |
url, optional render, maxAge, idempotencyKey |
The complete upstream JSON response in a text content block, including markdown, metadata and available signed evidence. A successful read costs 1 credit and a failed one 0; a successful rendered read adds 2. Inspect metadata.credits for the charged amount. |
Parse the content block as JSON. Before consuming an extraction, check success
and metadata.valid; a score alone is insufficient. Upstream HTTP failures and
success: false extractions set MCP isError: true. A signature attests to the
packet's origin and integrity, not to the semantic truth of the webpage.
Both extraction and reading accept an optional idempotencyKey: choose a unique
8–200-character visible ASCII ID for the job, save the original arguments, and
repeat those arguments with the same ID if the response is lost. A completed
response can be recovered for 24 hours without another extraction or charge,
including the original signature and source time. Recovery does not refresh the
page. A new question or fresh check needs a new ID. Authentication is required;
the proxy forwards the ID as the REST Idempotency-Key header, never as a prompt.
Omitting it preserves separate work on each call. No automatic retries occur.
Inspect REQUEST_IN_PROGRESS, IDEMPOTENCY_CONFLICT, IDEMPOTENCY_EXPIRED and
IDEMPOTENCY_OUTCOME_UNKNOWN; do not silently replace a key to bypass them.
Hosted MCP exposes the same optional argument. Streaming and monitor creation
do not accept it. Like the hosted tools, the proxy does not send the REST-only
format: "both", options.timeout or options.waitFor. A rate-limiting source's
wait reaches only REST callers, as a Retry-After header; tool results carry the code
and a message that says to retry later, and no wait. Refresh the connected client's tool inventory after upgrading.
Compatibility change in this unreleased candidate: contrie_read previously
returned only the markdown string. It now retains the full response so clients
can verify the same evidence they receive over REST. Read the markdown member
after parsing the text block. No already-published version is being upgraded.
Hosted endpoint
https://www.contrie.com/mcp speaks MCP Streamable HTTP and needs no local
package. It exposes nine tools: contrie_extract, contrie_read,
contrie_search, contrie_verify, contrie_watch, contrie_changes, contrie_monitors,
contrie_unwatch, and contrie_account. The stdio package exposes
contrie_extract, contrie_read, and contrie_account by default; it does not
implement the hosted OAuth flow or monitor tools. Both transports can additionally
expose the two snapshot pilot tools when the corresponding operator flags permit.
Clients that support remote MCP can use that URL with their supported bearer header or OAuth configuration. Supply credentials through the client's secure environment/header settings rather than URLs, command arguments or agent chat.
The hosted endpoint permits anonymous initialization and tool listing. Only
exact recorded contrie_extract requests are keyless: URL, prompt, JSON format
and schema (or its absence) must match a request in
llms.txt. Live calls need authentication:
sign in with a Contrie account through the client (OAuth), or send an API key.
Client setup: docs/mcp.
Optional supplied-HTML verification
Set CONTRIE_AGENT_VERIFICATION_ENABLED=1 in the local client's secure environment
to register contrie_check_fields and contrie_verification alongside the three
default tools. Other values, including true, leave them disabled. Refresh the
client's tool inventory after changing this setting.
This local flag grants no access and does not enable the remote service. The
configured backend must enable both CONTRIE_AGENT_VERIFICATION_ENABLED=1 and
CONTRIE_VERIFICATION_WORKSPACE_ENABLED=1, with the existing authenticated
workspace and private storage available. The local proxy forwards
CONTRIE_API_KEY through the same bearer-header mechanism as its other tools.
Without a key, ordinary backend authentication fails. Prefer hosted MCP OAuth
when the client supports it; this package does not implement OAuth or require
OAuth users to obtain another key for their hosted connection.
contrie_check_fields accepts original HTML already held by the caller, plus an
explicit flat field contract. The URL describes the snapshot; neither the proxy
nor this supplied-snapshot workflow fetches it or establishes its origin. Do not
substitute contrie_read markdown for the original HTML. Example tool arguments:
{
"idempotencyKey": "10101010-2020-4030-8040-505050505050",
"source": {
"url": "https://example.invalid/plans",
"html": "<h2>Atlas</h2><dl><dt>price</dt><dd>25</dd></dl>"
},
"contract": {
"version": 1,
"fields": {
"price": {
"entity": "Atlas",
"property": "price",
"type": "number",
"normalization": "number"
}
}
},
"proposedData": { "price": 25 }
}
Generate and save a new UUID v4 for deliberately new work. Reuse the same UUID
and exact input after a lost response; the proxy forwards it only as the
Idempotency-Key header. It never retries automatically or changes the identity
after a refusal. Omit proposedData to select supported values from the snapshot;
when present, it must contain exactly the contract's field names and scalar
values. Nested values and supplied evidence IDs are refused. A null value needs
an explicitly nullable supported relation; it cannot stand in for missing data.
Contracts support 1–20 named fields, each with an explicit entity, property
and type (string, number or boolean). Optional normalization values are
identity, number, boolean, period and iso-date; origin may be any,
body, jsonld, metadata, microdata or form. Other options are
excludeDeclaredHidden, nullable, and qualifiers containing currency,
period, unit, temporal (current or previous) or variant. Unknown keys
are rejected. Entity/property names are bounded to 256/128 characters; qualifier
strings to 32, and proposed strings to 4096. Snapshot HTML is limited to 200,000
UTF-8 bytes and the JSON body to 250,000 bytes. Unpaired Unicode surrogates in
HTML/proposed strings are rejected before any backend request.
Malformed tool envelopes can return JSON-RPC InvalidParams (-32602) before
tool execution; in particular, unsafe root object keys are rejected before SDK
record parsing can discard them.
The tool POSTs to ./verification/runs relative to the configured scrape URL.
It returns the complete hosted packet, including run and dashboardUrl; the
dashboard link sits outside the signed result. A completed check whose
run.result.success is false is a useful workflow result, not MCP
isError: true. Inspect field decisions and reasons; data remains null unless
every requested field is supported. HTTP failures still set isError: true and
retain the backend packet. A signature establishes packet integrity, not
publisher truth, source authenticity, freshness, completeness or browser-computed
visibility. The bounded relation grammar may abstain on unsupported layouts or
ambiguous qualifiers; there is no model fallback or newly fetched evidence.
contrie_verification performs retrieval only:
| Arguments | Request |
|---|---|
{} |
List up to 25 recent private runs. |
{ "before": "<UUID-v4 nextCursor>" } |
Continue the prior list. |
{ "executionId": "<UUID-v4 executionId>" } |
Recover that saved run and original result. |
executionId and before cannot be combined. Payloads expire after seven days;
retry identities remain without source content for 30 days. Retrieval does not
refresh evidence, execute another check or write human review labels. The
supplied-snapshot tools make no model calls and consume no extraction credits;
the backend's shared pilot capacity, authentication and retention limits still
apply. HTTP refusals such as disabled service, conflicting identity, capacity
limit or expired history remain explicit; a new key is not a recovery strategy.
Install
No install step: point a stdio-capable client at npx and supply an API key
(create one at https://www.contrie.com/dashboard/keys) through the client's secure
environment configuration.
{
"mcpServers": {
"contrie": {
"command": "npx",
"args": ["-y", "@contrie/mcp"],
"env": { "CONTRIE_API_KEY": "<your key>" }
}
}
}
Build and install a local artifact
From a checked-out repository with its development dependencies installed:
corepack yarn workspace @contrie/mcp build
mkdir -p /tmp/contrie-packages
cd packages/mcp
npm pack --pack-destination /tmp/contrie-packages
npm pack builds the artifact first. It includes compiled dist/server.js and
dist/verification.js, the
package manifest, this README and the Apache license. A consumer does not need
TypeScript, tsx, repository source, or build tools:
# In your MCP client's separate local installation directory:
npm install --ignore-scripts /tmp/contrie-packages/contrie-mcp-0.1.1.tgz
Configure a stdio-capable client to execute the absolute installed bin path:
{
"mcpServers": {
"contrie": {
"command": "/absolute/install/path/node_modules/.bin/contrie-mcp",
"env": {
"CONTRIE_API_URL": "https://www.contrie.com/api/v1/scrape"
}
}
}
}
Supply CONTRIE_API_KEY through the client's secure environment configuration.
The package never loads .env files. Its default URL is already the canonical
www endpoint; the apex can strip Authorization during redirects.
| Environment variable | Default | Meaning |
|---|---|---|
CONTRIE_API_URL |
https://www.contrie.com/api/v1/scrape |
Full REST scrape endpoint. Use a trusted local/preview endpoint for development; your bearer key is sent to this destination. |
CONTRIE_API_KEY |
Unset | Required for live calls. Exact recorded extraction requests can work without it when supported by the configured backend. |
CONTRIE_AGENT_VERIFICATION_ENABLED |
Unset | Exactly 1 adds the two snapshot pilot tools locally. Does not enable the backend or grant access. |
For source development use corepack yarn workspace @contrie/mcp dev; for the
compiled server use corepack yarn workspace @contrie/mcp start after building.
Starting either server waits on stdio and makes no extraction request by itself.
Artifact regression check
From the repository root:
corepack yarn workspace @contrie/mcp test:package
This packs both Contrie packages, installs the tarballs in a disposable directory
with consumer install scripts disabled, imports AI through ESM/CommonJS and
TypeScript, and starts the real MCP bin. A loopback fixture verifies the three-tool
inventory, version handshake, request forwarding, evidence preservation and
error signaling. It makes zero production or model requests. It leaves the
artifacts and results.json at the printed temporary path for inspection.
The default install uses npm's local cache with --offline. If that cache lacks
existing declared dependencies, explicitly allow registry downloads with:
corepack yarn workspace @contrie/mcp test:package --allow-registry
That flag permits dependency retrieval from npm; it does not publish packages or contact Contrie. A registry install is a separate check from a cached install.
For the supplied-snapshot transport checks using already-installed dependencies, with no package installation:
corepack yarn workspace @contrie/mcp build
corepack yarn workspace @contrie/mcp test:verification
corepack yarn test packages/mcp/src/verification.test.ts
The compiled stdio check starts real child processes against a loopback fixture, checks three/five-tool registration, original packet preservation, replay header forwarding, recovery, errors, strict input/Unicode/byte bounds, and offline dry-pack contents. It prints the path to its JSON receipt. The separate parity test compares the package's explicit schema copy with the hosted contracts. These are local transport checks: fixture replay does not prove database idempotency, a real customer login, or an enabled deployment. The existing tarball installation check remains separate.
License
Apache-2.0; dist/LICENSE.md contains the license in each tarball. The Contrie
repository preserves attribution to Apify's Apache-2.0 Crawlee crawling substrate.