Skip to main content

เชื่อมต่อ TypeScript (MCP SDK) กับ aicharged.io

215 เครื่องมือ, หนึ่งปลายทาง: https://aicharged.io/api/v1/mcp

TypeScript (MCP SDK)

MCP SDK อย่างเป็นทางการสำหรับ TypeScript (2.3.0 ขึ้นไป) พร้อม StreamableHTTPClientTransport

  • คีย์ API (Bearer)

ติดตั้งแพ็กเกจ

npm install @modelcontextprotocol/client@^2.3.0

ใช้ 2.3.0 ขึ้นไป (แก้ไขด้านความปลอดภัยกรณี headers ถูกส่งซ้ำเมื่อเกิด redirect)

โค้ดไคลเอนต์

แนะนำ
import { 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: {} }));

หรือให้ CLI ช่วยตั้งค่า

aicharged setup จะค้นหาไคลเอนต์ AI บนเครื่องนี้ ลงชื่อเข้าใช้งานผ่านเบราว์เซอร์ และเขียนไฟล์กำหนดค่าให้โดยอัตโนมัติ

เชื่อมต่อในบรรทัดเดียว

ติดตั้ง CLI · macOS / Linux
curl -fsSL https://aicharged.io/install.sh | sh && aicharged setup
ติดตั้ง CLI · Windows
irm https://aicharged.io/install.ps1 | iex; aicharged setup
ปลายทาง MCP
https://aicharged.io/api/v1/mcp

HTTP แบบสตรีมได้ ส่งเฮดเดอร์ Authorization: Bearer <API_KEY> หรือลงชื่อเข้าใช้งานด้วย OAuth หากไคลเอนต์ของคุณรองรับ

หรือบอกเอเจนต์ของคุณ
อ่าน https://aicharged.io/agent.md แล้วตั้งค่า aicharged.io ให้ฉัน

เปิดด้วยข้อความสั่งการนี้ใน Claude (เปิดในแท็บใหม่) ChatGPT (เปิดในแท็บใหม่) Perplexity (เปิดในแท็บใหม่)