FetchPI
Log in

Guides

FetchPI MCP Server: Connect Claude Desktop, Cursor or Any Agent in Five Minutes

Install the official FetchPI MCP server and give your AI agent five honest tools — platform discovery, post search, profiles, user feeds and comments — with per-call Credits billing and remediation-first errors.

Last reviewed

Why MCP for a data API

The Model Context Protocol lets an LLM client (Claude Desktop, Cursor, any MCP host) call external tools through one stdio contract instead of ad-hoc shell-out. FetchPI ships an official server, fetchpi-mcp, that turns the workflow from the agent skill page — discover, inspect, call, read usage — into five typed tools. The agent never touches curl, never sees your key (it rides the server environment), and every answer carries the same meta block the REST API returns: request id, freshness layer, what the call cost.

Build the server

The server is a single dependency-free Go binary. Build it once from the open-source repository:

git clone https://github.com/AI-MeshGate/meshapi
cd meshapi/backend
go build -o fetchpi-mcp ./cmd/fetchpi-mcp

Register it with your MCP client

Point the client at the binary and put the API key in the environment — the key is read at startup and never leaves the process. The JSON below is Claude Desktop's claude_desktop_config.json; Cursor's .mcp.json uses the same shape.

{
  "mcpServers": {
    "fetchpi": {
      "command": "/absolute/path/to/fetchpi-mcp",
      "env": { "FETCHPI_API_KEY": "fp_live_..." }
    }
  }
}

The five tools

  • fetchpi_list_platforms — every platform with availability status and catalog metadata; no key needed. The agent should call this first.
  • fetchpi_search_posts — keyword search per platform (X, TikTok, Reddit, YouTube, Instagram, Xiaohongshu), cursor-paginated.
  • fetchpi_get_profile — one account by handle: follower counts, totals, verification.
  • fetchpi_get_user_posts — the account's recent posts with engagement metrics.
  • fetchpi_get_comments — comments on one post id.

Failure semantics your agent can act on

Tool failures come back as tool results, not protocol errors, with remediation text: a missing or revoked key says where to create one, 402 INSUFFICIENT_CREDITS links the billing console, 429 says to back off. One honest gap is built in — Douyin has no keyword-search capability, and the tool says so and points at the hashtag and hot-search endpoints instead of failing opaquely.

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | ./fetchpi-mcp

Under the tools: the same API by hand

The tools are a thin wrapper over the public REST contract — anything they do, plain HTTP does too. The search tool, for instance, is one GET:

curl -s -H "Authorization: Bearer $FETCHPI_API_KEY" \
  "https://fetchpi.com/v1/reddit/search/posts?q=openai&freshness=default"

Cost discipline for agent loops

Every tool call bills Credits exactly like the REST call it wraps — same per-call prices, same freshness economics. Agents loop, so pass freshness=default with a max_age for recap-style work (cache hits are cheaper) and keep live for breaking events. The meta.billing block in each result shows what an iteration actually spent.