Skip to main content

Quickstart: curl, JavaScript and MCP

Copy-paste examples for calling the data API with curl and JavaScript, and for connecting an MCP client to the hosted server.

1. Get a key

Create an API key on the Developer account page with the scopes you need, such as catalog.search, entities.list and account.usage (see Authentication). Put it in an environment variable, not in your code:

export OYSTER_API_KEY='odk1_...'   # from Developer account > Keys

2. Call the API with curl

curl 'https://oysterlist.com/api/v1/catalog?q=population&limit=10' \
  -H "Authorization: Bearer $OYSTER_API_KEY" \
  -H "X-Request-Id: $(uuidgen)"

curl 'https://oysterlist.com/api/v1/entities?q=Oslo&type=city' \
  -H "Authorization: Bearer $OYSTER_API_KEY"

curl 'https://oysterlist.com/api/v1/account/usage' \
  -H "Authorization: Bearer $OYSTER_API_KEY" -i

The third call prints the response headers too, including RateLimit-Remaining and X-Quota-Read-Remaining.

3. Call it from JavaScript

// Node 18+ or any server runtime with fetch. Keep the key on the server.
const base = 'https://oysterlist.com/api/v1';

async function oyster(path, params = {}) {
  const url = new URL(base + path);
  for (const [key, value] of Object.entries(params)) url.searchParams.set(key, String(value));
  const response = await fetch(url, {
    headers: {
      authorization: `Bearer ${process.env.OYSTER_API_KEY}`,
      'x-request-id': crypto.randomUUID()
    }
  });
  const body = await response.json();
  if (!response.ok) {
    // application/problem+json: { type, title, status, detail, code, requestId }
    throw new Error(`${body.code} (${body.status}): ${body.detail} [${body.requestId}]`);
  }
  return body;
}

const page = await oyster('/catalog', { q: 'population', limit: 10 });
console.log(page.data, page.cursor, page.usage);

Never call the API from browser code with your key: anyone who opens the page can read it. Call it from your server and pass on only the data you need.

MCP

The hosted MCP server gives AI assistants tools over the same operations as the REST API. Point a client that supports remote MCP servers at https://oysterlist.com/mcp/data. It discovers the OAuth server, asks you to sign in and approve its scopes, and receives a token bound to the MCP resource. Protocol versions: 2026-07-28, 2025-11-25.

{
  "mcpServers": {
    "oyster": { "type": "http", "url": "https://oysterlist.com/mcp/data" }
  }
}
MCP tools
Tool Operations
search_catalog catalog.search
resolve_entities entities.list
get_metadata datasets.get, indicators.get, entities.get, products.get, releases.get
get_records records.list
list_products products.list
get_source_artifact sourceArtifacts.get
get_job jobs.get
get_usage account.usage

Tool results keep decimals, nulls, release pins, source notices and usage. A result larger than 100 records or 64 KiB returns a reference to the full query instead of a cut-down list.