Repository avatar
Monitoring
v0.1.0
active

mcp

io.github.xtikapi/mcp

Social media data MCP for 19 platforms (Douyin, Xiaohongshu, WeChat, TikTok, YouTube, X, Reddit).

Documentation

XTikAPI — CLI, TypeScript SDK, MCP Server & Agent Skills

npm version MCP npm License: MIT

One API key and hosted MCP server for 19 social media platforms (229 normalized endpoints): Douyin, Xiaohongshu (RedNote), WeChat Official Accounts (公众号), WeChat Channels (视频号), Kuaishou, Bilibili, Weibo, Zhihu, Xingtu, Pugongying, TikTok, YouTube, Instagram, X (Twitter), Reddit, Threads, Telegram, and LinkedIn.

  • Pay per call ($0.002 – $0.04) — No monthly subscription, credits never expire, errors and timeouts are never charged.
  • 94.5% fewer tokens for AI agents — Measured across 147 live platform recordings (2026-11-18): raw platform JSON averages 4.71M tokens (18.9 MB) vs 427k via REST (90.9% fewer) and 258k via MCP (94.5% fewer; Douyin 97.5%, TikTok 97.1%, WeChat MP 96.3%).
  • Free trial credit — Sign up at xtikapi.com/settings/apikeys (no credit card required).

1. One-Command MCP Setup (Claude Code, Cursor, Codex, Windsurf, Claude Desktop)

npx xtikapi setup

npx xtikapi setup writes the MCP server config for your installed AI coding tools (hosted Streamable HTTP at https://xtikapi.com/v1/mcp or stdio via @xtikapi/mcp) and can also install the XTikAPI Agent Skill.

Manual MCP Config (Hosted Streamable HTTP — Recommended)

Supports both OAuth 2.1 (one-click sign-in in ChatGPT, Claude, Cursor, Claude Code) and Bearer API keys:

{
  "mcpServers": {
    "xtikapi": {
      "type": "http",
      "url": "https://xtikapi.com/v1/mcp",
      "headers": {
        "Authorization": "Bearer dk_your_api_key"
      }
    }
  }
}

Manual MCP Config (Stdio via @xtikapi/mcp)

For MCP clients that only support local stdio servers:

{
  "mcpServers": {
    "xtikapi": {
      "command": "npx",
      "args": ["-y", "@xtikapi/mcp"],
      "env": {
        "XTIKAPI_API_KEY": "dk_your_api_key"
      }
    }
  }
}

MCP Tools Exposed

ToolCostDescription
findFreeSearch all 229 endpoints in English or Chinese (e.g. "douyin video comments", "小红书 笔记 搜索")
describeFreeFull parameter definitions, exact USD price, billing rule, paging rule, and example item
call$0.002–$0.04Execute an endpoint with optional max_price_usd and idempotency_key
accountFreeCheck remaining balance and per-key spend limit

2. TypeScript / JavaScript SDK

Zero runtime dependencies (Node.js 18+, Cloudflare Workers, Deno, Bun).

npm install xtikapi

Basic Call

import { XTikClient, XTikError } from "xtikapi";

const client = new XTikClient({
  apiKey: process.env.XTIKAPI_API_KEY!,
});

// Search TikTok videos ($0.002)
const tiktok = await client.call("tiktok.videos.search", {
  keyword: "ai agents",
});
console.log(tiktok.data.items);
console.log("Remaining balance:", tiktok.meta.billing?.balance_usd);

// Search Douyin videos with a per-call price cap & safe retry key
const douyin = await client.call(
  "douyin.videos.search",
  { keyword: "AI工具" },
  {
    maxPriceUsd: 0.05,
    idempotencyKey: "search-ai-tools-2026-11-26",
  }
);

Automatic Pagination (paginate)

Every list endpoint returns data.items, data.has_more, and data.next. The SDK merges data.next automatically:

for await (const page of client.paginate("youtube.comments.list", {
  video_id: "dQw4w9WgXcQ",
}, { maxPages: 3 })) {
  for (const comment of page.data.items) {
    console.log(comment.author?.name, comment.text);
  }
}

Free Catalog Discovery

const status = await client.status(); // { ok: true, endpoints: 229 }
const catalog = await client.catalog(); // all 229 endpoint specs
const spec = await client.endpoint("xiaohongshu.notes.search");

Typed Error Handling

try {
  await client.call("weibo.posts.search", { keyword: "AI" });
} catch (err) {
  if (err instanceof XTikError) {
    console.error(err.code, err.status, "charged:", err.charged, "retryable:", err.retry);
  }
}

3. CLI Usage

# Check gateway health (free)
npx xtikapi status

# Search endpoints by natural language or platform (free)
npx xtikapi search "wechat article"
npx xtikapi search --platform xiaohongshu comments

# Inspect parameters & pricing for an endpoint (free)
npx xtikapi describe douyin.videos.search

# Call any endpoint directly from the terminal
XTIKAPI_API_KEY=dk_your_key npx xtikapi call tiktok.videos.search --param keyword="claude code" --max-price 0.01

# Auto-configure MCP + Agent Skills for Claude Code / Cursor / Codex
npx xtikapi setup

4. Packages in This Repository

Related Repositories

License

MIT © XTikAPI

No installation packages available.

Remote