Use the MCP server from Claude Code or Cursor. Call the REST API with curl. Or install the SDK. Three paths, same protocol, no registration required.
// Add to MCP config, then talk:
> "Create a sourdough product, organic, ยฃ4.50"
โ substance.product a3f2c8...curl -X POST https://api.foodx.world/foodblock/ \
-H "Content-Type: application/json" \
-d '{"type":"substance.product","state":{"name":"Sourdough","organic":true,"price":4.5}}'import { create } from '@foodxdev/foodblock';
const bread = create('substance.product', {
name: 'Sourdough', organic: true, price: 4.50
}); // bread.hash โ SHA-256Add to Claude Code, Cursor, or Windsurf. 12 tools, natural language.
JavaScript, Python, Go, Swift. npm install and go.
POST blocks, GET chains, traverse provenance trees. No auth for sandbox.
Autonomous agents with Ed25519 keys, scoped permissions, draft/approve flow.
Interactive browser sandbox. Create blocks, view provenance.
Everything you need to build on the FoodBlock protocol
Create, read, update, and query FoodBlocks. The core primitive: three fields (type, state, refs), content-addressed by SHA-256.
Trace food history through hash-linked references. Follow update chains backwards or build full provenance trees.
Search blocks by content, browse personalised feeds, and find food data by location.
Introspect the block type system. Six base types, open subtype registry with required fields and industry identifier mappings.
Create and manage API keys for programmatic access. Scoped permissions, rate limits, and usage tracking.
Subscribe to real-time block events. HMAC-SHA256 signed payloads with automatic retries.
Register autonomous agents, manage permissions, create draft actions with human-in-the-loop approval, and store agent memory as FoodBlocks.
Interactive API documentation with live code examples
Create, read, update, and query FoodBlocks. The core primitive: three fields (type, state, refs), content-addressed by SHA-256.
/api/v1/foodblockCreate a new FoodBlock. The block hash is computed from canonical(type + state + refs) using SHA-256. Blocks are immutable and append-only.
/api/v1/foodblock/:hashRetrieve a single block by its content-addressed SHA-256 hash.
/api/v1/foodblockQuery blocks by type, refs, visibility, and state fields. Supports pagination with limit and offset.
/api/v1/foodblock/:hashCreate a new version of a block. Appends a new block with refs.updates pointing to the previous hash. The original block is never modified.
Get building with FoodBlock in your language of choice
npm install @foodxdev/foodblockimport { create } from '@foodxdev/foodblock';
const bread = create('substance.product', {
name: 'Sourdough Loaf',
price: 4.50,
organic: true,
weight: { value: 500, unit: 'g' }
});
console.log(bread.hash); // SHA-256 content addressconst res = await fetch('https://api.foodx.world/foodblock/blocks?type=substance.product&limit=10');
const { blocks } = await res.json();const tree = await fetch(`https://api.foodx.world/foodblock/tree/${bread.hash}`);
const provenance = await tree.json();
// Returns full ancestor chain: bread โ flour โ wheat โ farmAI agents are first-class participants. They register, trade, and learn using FoodBlocks.
Every API creates, reads, or traverses FoodBlocks. One primitive with three fields and six base types describes every food interaction.
One protocol across all 14 sectors of the food system. Every device, agent, and platform speaks the same language.
Autonomous agents, agent-to-agent networks, and MCP as the protocol bridge between AI and the global food system.
An autonomous agent tuned for farming. Checks soil sensors and weather APIs every hour, creates transform.harvest blocks when crops are picked, and messages the farmer on WhatsApp with yield summaries. Works offline first in any language.
// Farm Agent config
role: "Crop management & yield tracking"
tools: [foodblock-mcp, weather-api, whatsapp]
schedule: "every 1h"
// Agent loop:
// 1. Read soil moisture + weather forecast
// 2. If harvest window detected โ alert farmer
// 3. On harvest confirmation:
// create transform.harvest block
// refs: { field, grower, season }
// reply: "Logged 340kg tomatoes (af3cโฆ)"Vessel mounted agent logs catches via voice or NFC fish tags. Creates substance blocks geotagged to the catch zone, linked to the vessel, skipper, and fishing licence. Meets EU catch documentation requirements out of the box.
// Skipper voice logs at sea:
// "120kg haddock, zone IVa"
create('substance.product', {
species: 'Haddock',
weight_kg: 120,
method: 'line',
zone: 'ICES IVa',
vessel: 'FV Endeavour',
logged_via: 'voice'
}, { vessel: vesselBlock.hash,
licence: licenceBlock.hash,
zone: zoneBlock.hash });Every production batch is a transform block linking input ingredients to outputs. An MCP connected agent monitors the production line, creates blocks at each stage, and flags if any input has an expired certification.
// Agent monitors production line via MCP
create('transform.process', {
batch: 'B-2026-0441',
product: 'Tinned Tomatoes 400g',
line: 'Line 3',
output_units: 2400
}, { inputs: [tomato.hash, tin.hash,
water.hash, salt.hash],
facility: factory.hash,
operator: shift.hash });
// Agent auto-checks: all input certs valid?Cameras on the production line run real-time defect detection. Every inspection frame creates an observe block. Reject items are flagged and linked to the batch. The agent learns over time and shares defect patterns across a QC agent network.
// Vision model on production line
create('observe.inspection', {
model: 'foodqc-v3',
result: 'pass',
defects_found: 0,
frame: 'cam-02-frame-88421',
confidence: 0.99
}, { batch: batchBlock.hash,
line: lineBlock.hash });
// On defect: alert + reject block
// Agents share defect patterns via networkA fleet of autonomous agents, one per vehicle or warehouse zone. Every few minutes they read IoT sensors, create observation blocks, and chain them to the shipment. Break the cold chain and the block graph proves exactly where and when.
// Cold Chain Agent (runs every 5 min)
// 1. Read temperature sensors (zone A-F)
// 2. For each reading:
// create observe.measurement block
// chain to previous reading
// 3. If temp > 5ยฐC for > 10 min:
// create observe.alert block
// refs: { shipment, sensor, last_ok }
// notify duty_manager via SlackAn MCP powered copilot that sees every block in the supply chain. Ask it "which shipments are at risk?" and it queries observation blocks for temperature anomalies, cross references ETAs, and suggests rerouting. All through natural language.
// MCP tool call from Claude:
"Which chilled shipments arriving
tomorrow have had temp breaches?"
โ search_blocks({
type: 'observe.alert',
state: { severity: 'temp_breach' },
since: '24h'
})
โ get_chain(alert.refs.shipment)
โ "3 shipments flagged. SH-441 had
2 breaches in transit. Recommend
inspection on arrival."Computer vision on shelves tracks stock in real time. The agent creates substance blocks for new stock, observe blocks for shelf gaps, and triggers reorder transfer blocks when thresholds are hit. Connects to the supplier agent network for automated replenishment.
// Agent checks every 15 min:
create('observe.stockcheck', {
aisle: 'A3', shelf: 'S2',
items: [
{ sku: 'OAT-500', count: 3, min: 8 },
{ sku: 'RYE-400', count: 12, min: 6 }
]
}, { store: storeBlock.hash });
// count < min โ auto-reorder:
create('transfer.order', {
sku: 'OAT-500', qty: 24
}, { store: store.hash,
supplier: supplier.hash });Shoppers scan any barcode or NFC tag, resolve the block hash, and see the full story. Who grew it, how it travelled, every certification. One API call returns the entire provenance tree. Builds trust, drives brand loyalty.
// Scan barcode โ resolve GS1 โ tree
const tree = await fetch(
`${API}/foodblock/tree/${hash}`
);
// Returns:
// substance.product (Organic Oats)
// โโ actor.venue (Highland Farm)
// โโ observe.certification (Soil Assoc.)
// โโ transfer.shipment (EdinburghโLondon)
// โโ place.field (Inverness, Scotland)
// All hashes verifiable by the consumerA single agent managing inventory across multiple hotel kitchens. Syncs stock levels on a schedule, tracks inter venue transfers, and auto creates purchase orders. The MCP connection lets the head chef ask "what's the truffle stock across all venues?" in plain English.
// Chef asks via MCP:
"Truffle stock across all venues?"
โ search_blocks({
type: 'substance.ingredient',
state: { name: 'truffle' }
})
โ "The Savoy: 200g (received yesterday)
Claridge's: 50g (reorder suggested)
The Connaught: 0g (order in transit)"
// Auto-reorder for venues below thresholdEvery event is a place block. Every dish served is a transfer. Every ingredient is traced back to the supplier. Post event, the block graph generates allergen compliance reports, waste metrics, and supplier performance reviews automatically.
create('transfer.service', {
event: 'Tech Summit 2026',
covers: 450,
menu: ['salmon_canapes', 'vegan_bowl',
'chocolate_tart'],
allergen_protocols: ['nut_free_zone']
}, { event: eventBlock.hash,
caterer: catererBlock.hash,
menu_items: [salmon.hash, vegan.hash,
choc.hash] });
// Post-event agent generates full reportEvery order is a transfer block linked to menu items and suppliers. Surface allergens in real-time, trace ingredients back to the farm, and give diners a QR code on the receipt that resolves the full provenance chain for what they just ate.
create('transfer.order', {
items: ['sourdough_toast', 'flat_white'],
total: 12.50,
table: 4,
allergens: ['gluten', 'dairy'],
receipt_qr: true // generates trace URL
}, { venue: cafeBlock.hash,
menu: menuBlock.hash });
// Diner scans receipt QR:
// โ sees sourdough from Borough Bakery
// โ flour from Wessex Mill
// โ wheat from Hampshire farmOne physical kitchen, five virtual brands. An autonomous agent manages shared inventory across brands, creates separate transfer.order blocks per brand, and optimises prep schedules. Cross-brand ingredient sharing is tracked block-by-block.
// Agent manages 5 brands from 1 kitchen
// Shared inventory, separate order streams
// Brand A order:
create('transfer.order', {
brand: 'Burger Society',
items: ['classic_burger', 'fries'],
platform: 'deliveroo'
}, { kitchen: kitchen.hash,
brand: burgerBrand.hash });
// Agent: "Tomato stock shared across
// 3 brands, reorder at 5kg threshold"An agent network for food surplus. Restaurant agents post surplus blocks. Charity agents subscribe by food type and location. Logistics agents bid on pickup routes. No humans in the loop. Agents negotiate, match, and schedule autonomously.
// Bakery agent posts at 16:00:
create('transfer.donation', {
items: ['sourdough_x20', 'rye_x12'],
weight_kg: 18,
available_until: '18:00',
pickup: 'SE1 9SG'
}, { donor: bakery.hash });
// Charity agent auto-claims (4 min):
// Logistics agent routes pickup:
// โ "Driver ETA 17:15, 2.3km away"
// All blocks linked โ auditable trailAn agent that walks the block graph for any product and calculates total CO2 from farm to shelf. Transport distances, processing energy, packaging. Creates an observe.carbon block. Brands display verified carbon labels. Auditors verify on chain.
// Agent traverses full provenance chain:
const chain = await get_chain(product.hash);
// Calculates CO2 at each step:
create('observe.carbon', {
total_co2_kg: 2.4,
breakdown: {
farming: 0.8, processing: 0.3,
transport: 1.1, packaging: 0.2
},
methodology: 'GHG Protocol'
}, { product: product.hash,
chain: chain.map(b => b.hash) });An autonomous agent that monitors HACCP critical control points via connected sensors. Creates observation blocks for temperature, pH, and hygiene checks on a continuous schedule. Gaps in the record are flagged instantly. Inspection ready reports generated on demand via MCP.
// HACCP Agent (continuous monitoring)
- Check CCP sensors (temp, pH, metal det.)
- For each CCP:
โ create observe.measurement block
โ if out of limits:
โ create observe.alert (corrective action)
โ notify food_safety_manager
- Generate daily HACCP log (all blocks)
- Flag any gaps > 30 min (non-compliance)When a contamination is detected, an agent creates an observe.recall block and traverses every downstream ref. Every shipment, every store, every consumer scan. Within minutes, every affected party has a notification. The block graph IS the recall audit trail.
// Contamination detected at processor:
create('observe.recall', {
reason: 'Salmonella detected',
batch: 'B-2026-0441',
severity: 'class_1'
}, { batch: batchBlock.hash,
lab_report: labBlock.hash });
// Agent traces all downstream blocks:
// โ 12 shipments, 47 stores, 3 regions
// โ Auto-notifies each store agent
// โ Stores pull product within 2 hours
// โ Full audit trail in the block graphEvery recipe is a transform block with refs to ingredient substance blocks. Fork a recipe and the block chain preserves attribution. An MCP copilot lets users ask "what can I make with what's in my fridge?" and it cross-references inventory blocks with the recipe graph.
create('transform.recipe', {
name: 'Sourdough Bread',
servings: 1,
time_hours: 18,
steps: ['mix', 'fold_x4', 'prove',
'shape', 'bake_230c_35m']
}, { author: chefBlock.hash,
ingredients: [flour.hash, water.hash,
salt.hash, starter.hash],
forked_from: originalRecipe.hash });
// MCP: "What can I make with flour,
// eggs, and butter?" โ 47 matchesAn agent that generates provenance stories from block data. "This sourdough travelled 12 miles from a Hampshire wheat field, through Wessex Mill, to your local bakery." Content teams get verified narratives, not marketing copy. Every claim is verifiable on chain.
// Agent generates content from blocks:
"Tell the story of this sourdough"
โ get_tree(sourdough.hash)
โ Agent composes:
"This loaf started as Maris Otter wheat
grown by James at Leckford Farm (51.1ยฐN).
Milled at Wessex Mill on 12 Feb.
Baked at Bread & Butter, Borough Market.
12 miles, 3 hands, 0 additives."
// Every fact linked to a verifiable blockA WhatsApp agent for community fridges. Donors text what they're dropping off. The agent creates substance blocks, tracks stock, and broadcasts availability to local residents. When items aren't claimed, it alerts food bank agents nearby.
// Donor texts WhatsApp bot:
// "Dropping off 6 eggs and some milk"
create('transfer.donation', {
items: ['eggs_x6', 'milk_1L'],
donor_type: 'individual',
logged_via: 'whatsapp'
}, { fridge: communityFridge.hash,
donor: donor.hash });
// Agent broadcasts to local group:
// "Fresh items just added! 6 eggs,
// 1L milk. First come first served."
// Unclaimed after 12h โ food bank alertEvery plot, every planting, every harvest is a block. Gardeners log via voice or app. Agents aggregate harvest data across the network, coordinate seed swaps as transfer blocks, and generate seasonal yield reports for the whole community.
create('transform.harvest', {
crop: 'Courgettes',
quantity_kg: 4.2,
method: 'no-dig organic',
plot: 'Plot 17'
}, { garden: gardenBlock.hash,
grower: growerBlock.hash });
// Network agent aggregates:
// "This season: 2.4 tonnes across
// 34 plots. Top crop: tomatoes.
// Surplus courgettes โ food bank"Every meal, supplement, and biomarker is a block. A health agent reads your CGM, correlates glucose with meal blocks, and learns what works for your body. Clinical-grade data with cryptographic proof of what was consumed and when.
// Agent reads continuous glucose monitor:
create('observe.measurement', {
metric: 'blood_glucose',
value: 5.4, unit: 'mmol/L',
timing: 'post_meal_2h'
}, { meal: lunchBlock.hash,
subject: userBlock.hash });
// After 30 days, agent reports:
// "Your glucose spikes 40% less with
// sourdough vs white bread. Oats
// at breakfast keep you stable until
// lunch. Here's the block evidence."Participants log meals via voice or photo. Every entry is a cryptographically signed substance block. Researchers get tamper proof dietary compliance data. The block chain proves what was eaten, when, and by whom. Admissible as trial evidence.
// Participant logs via voice:
create('substance.meal', {
description: 'Grilled chicken, rice, broccoli',
photo_hash: 'sha256:a4f2...',
logged_via: 'voice',
trial_id: 'NCT-09284756',
compliant: true
}, { participant: participant.hash,
trial: trialBlock.hash,
dietary_protocol: protocol.hash });
// Signed with participant's Ed25519 key
// Immutable, auditable, compliantAn agent that monitors commodity markets and annotates substance blocks with real-time price data. Farmers get price alerts when their harvest blocks hit target values. Traders query the block graph for verified supply chain positions.
// Agent runs on every market tick:
create('observe.price', {
commodity: 'wheat_milling',
price: 215.40, currency: 'GBP',
unit: 'tonne',
exchange: 'LIFFE',
timestamp: '2026-02-17T14:30:00Z'
}, { commodity: wheatType.hash });
// Farmer alert: "Your 340kg Roma
// tomatoes are worth ยฃ612 at today's
// wholesale price (+8% vs last week)"Harvest blocks plus weather observation blocks equals automated claims. The agent verifies harvest yields against insured amounts, checks weather blocks for drought or flood events, and processes parametric payouts directly from the block graph. No paperwork, no adjusters.
// Weather agent creates:
create('observe.weather', {
event: 'drought',
rainfall_mm: 2.1, // vs 30mm expected
period: '2026-01-15/2026-02-15',
source: 'Met Office'
}, { region: regionBlock.hash });
// Insurance agent auto-processes:
// harvest.quantity < insured_yield
// AND drought.rainfall < threshold
// โ create transfer.payout block
// โ ยฃ4,200 released to farmer walletTraditional recipes as immutable transform blocks with refs to region, culture, and lineage. A grandmother's biryani recipe becomes a permanent, hash verified block. Attributed, timestamped, and linked to its cultural origin. Forks preserve the evolution.
create('transform.recipe', {
name: 'Nonna Rosa's Ragรน',
origin: 'Naples, Campania',
generation: 3,
oral_history: true,
technique: 'slow_braise_6h',
notes: 'Never add garlic. Only San Marzano.'
}, { author: nonnaBlock.hash,
region: campaniaBlock.hash,
tradition: italianCooking.hash,
parent_recipe: mammaRecipe.hash });
// Immutable. Attributed. Permanent.Link products to geography, climate, soil, and tradition. A block graph that proves Champagne is from Champagne, Parmigiano is from Parma. Place blocks carry GIS data. Observe blocks hold climate records. The terroir is encoded in the graph.
create('observe.terroir', {
product: 'Comtรฉ AOP',
altitude_m: 850,
soil_type: 'Jurassic limestone',
grass_species: ['fescue', 'clover'],
climate: 'continental_montane',
ageing_months: 18
}, { product: comteBlock.hash,
region: juraBlock.hash,
certification: aopBlock.hash });
// Consumers scan โ see the terroir
// "Aged 18 months in Jura caves, 850m.
// Milk from Montbรฉliarde cows grazing
// on limestone meadows since 1264."Every bioreactor cycle is a transform block. Cell line origin, growth media composition, harvest timestamps, all cryptographically linked. Consumers scan the pack and see the complete production history. Regulators audit the block graph, not paperwork.
create('transform.culture', {
product: 'Cultivated Chicken Breast',
cell_line: 'CL-2024-0087',
bioreactor: 'BR-12',
cycle_hours: 336,
yield_kg: 12.4,
media: 'serum-free v3'
}, { cell_line: cellLineBlock.hash,
facility: labBlock.hash,
analysis: [sterility.hash,
nutrition.hash,
safety.hash] });Install the FoodBlock MCP server and every LLM gains food system superpowers. Ask "trace this salmon to the farm" and the agent traverses the chain in one tool call. Build food aware agents, copilots, and assistants through the standard MCP protocol.
// claude_desktop_config.json
{ "mcpServers": {
"foodblock": {
"command": "foodblock-mcp",
"args": ["--api-url",
"https://api.foodx.world"]
}
}
}
// Now ask Claude anything about food:
// "Trace this salmon back to the farm"
// "Is this product certified organic?"
// "What's the carbon footprint of this
// supply chain?"
// โ All answered from the block graphThree ways to start using FoodBlocks. Pick whichever fits your workflow.
Add this to your MCP config. Your AI tool gets 12 food system tools instantly.
// Add to MCP config:
{
"mcpServers": {
"foodblock": {
"command": "npx",
"args": ["@anthropic/foodblock-mcp"]
}
}
}
// Then just ask:
// "Create a sourdough product, organic, ยฃ4.50"
// "Trace this block back to the farm"
// "Register an AI agent for my bakery"Hit the API directly. No auth needed for the sandbox.
# Create a block
curl -X POST https://api.foodx.world/foodblock/ \
-H "Content-Type: application/json" \
-d '{"type":"substance.product","state":{"name":"Sourdough","price":4.5,"organic":true}}'
# Query blocks by type
curl https://api.foodx.world/foodblock/?type=substance.product
# Get provenance tree
curl https://api.foodx.world/foodblock/HASH/treeInstall the SDK and build FoodBlocks into your application.
npm install @foodxdev/foodblock
import { create } from '@foodxdev/foodblock';
const bread = create('substance.product', {
name: 'Sourdough Loaf',
price: 4.50,
organic: true
});
console.log(bread.hash); // SHA-256 content addressAdd the MCP server to your AI tool and start creating FoodBlocks in natural language. No registration required.