Call from code

Make a read-only ClearLine call with the MCP TypeScript SDK.

Use this example when your application already has a user OAuth access token and an authorized account context. It reads the current ClearLine account and closes the connection.

Need interactive sign-in instead? Start with client setup.

1. Prepare the example

Use Node.js 22 or later. In a new directory, install the SDK version used by this example:

npm install @modelcontextprotocol/sdk@1.25.2

Save read-account.mjs in that directory.

2. Supply identity and account

Set these variables through your application's local environment or secret store:

VariableValue
MCP_GATEWAY_URLThe direct ClearLine URL from the directory
MCP_ACCESS_TOKENThe user's current Magnite OAuth access token, issued for the gateway's audience and environment
MCP_AUTH_CONTEXTThe authorized account value, such as clearline/dsp_sub/ACCOUNT_ID

Replace ACCOUNT_ID with the account assigned to that user. Keep tokens out of source files and shell history.

3. Run a read

node read-account.mjs

The MCP result contains the current account. Check its name and ID against the intended account. The sample performs no writes and does not print credentials.

Choose the right URL and tool name

ConnectionPathExample tool name
One server/mcp/server/SERVER_IDget_products on Orchestration
All servers visible to you/mcporchestration__get_products
A configured group/mcp/group/GROUP_IDorchestration__get_products

Use the exact URL from Magnite and the names returned by tools/list. The connection's local name is just a label in your client; changing it does not change the server URL.

Streamr developers can follow the integration walkthrough in the repository.