TypeScript (MCP SDK)
The official TypeScript MCP SDK (2.3.0 or newer) with the StreamableHTTPClientTransport.
- API key (Bearer)
Install the package
npm install @modelcontextprotocol/client@^2.3.0
Use 2.3.0 or newer (security fix for headers re-sent on redirects).
Client code
Recommendedimport { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
const client = new Client({ name: 'my-app', version: '1.0.0' });
await client.connect(new StreamableHTTPClientTransport(new URL('https://aicharged.io/api/v1/mcp'), {
requestInit: { headers: { Authorization: `Bearer ${process.env.AICHARGED_API_KEY}` } },
}));
const { tools } = await client.listTools();
console.log(tools.map((tool) => tool.name));
console.log(await client.callTool({ name: 'list_runs', arguments: {} }));