If you work with social data, you know the drill: to answer one simple
question — "how many followers does this profile have?" or "what are the
top posts for this hashtag?" — you bounce between the Instagram app, a
spreadsheet, and some throwaway script you have to keep alive.
I wanted to ask those questions directly inside my AI assistant (Claude
Code) and get structured data back — without writing and maintaining
scraping code. Here's the setup that solved it: HikerAPI (a read-only
Instagram data API) exposed through MCP (the Model Context Protocol), the
open standard that lets AI assistants call external tools.
What you actually get
The hikerapi-mcp server auto-generates 100+ read tools from HikerAPI's
OpenAPI spec. You ask in natural language; the assistant picks the right
endpoint and hands you structured JSON. No glue code.
| Tool group | ~Tools | Examples |
|---|---|---|
| User Profile | 36 |
get_v2_user_by_username, get_v2_user_by_id
|
| Post Details | 20 |
get_v2_media_info_by_code, ..._comments
|
| Search | 13 |
get_v1_search_users, get_v1_search_hashtags
|
| Hashtags | 7 |
get_v2_hashtag_medias_top / ..._recent
|
| Stories | 7 |
get_v2_story_by_url, get_v1_story_by_id
|
| Location | 7 | get_v1_location_medias_recent |
Prerequisites
- Node.js 18+
- An MCP-capable assistant — Claude Code, Claude Desktop, Cursor, Windsurf, Zed, or OpenAI Codex
- A HikerAPI key from
hikerapi.com/tokens
Setup (Claude Code)
The README's quick command works:
claude mcp add hikerapi -e HIKERAPI_KEY=your-key -- npx -y hikerapi-mcp
…but it writes your key in plain text into .claude.json. If you sync or
version your config across machines (I do), that leaks the key.
The cleaner way — store the key in an environment variable and let the
config hold only a pointer to it:
# set the key once in your shell environment
export HIKERAPI_KEY="your-key" # macOS/Linux
# setx HIKERAPI_KEY "your-key" # Windows (PowerShell), then reopen
claude mcp add hikerapi --scope user \
-e 'HIKERAPI_KEY=${HIKERAPI_KEY}' \
-- npx -y hikerapi-mcp
Now your config literally stores ${HIKERAPI_KEY} — the real secret never
touches the file.
Keep the tool list lean
100+ tools is a lot of surface area for the model's context. Filter to the
groups you actually use with HIKERAPI_TAGS:
claude mcp add hikerapi --scope user \
-e 'HIKERAPI_KEY=${HIKERAPI_KEY}' \
-e 'HIKERAPI_TAGS=User Profile,Post Details,Search,Hashtags,Stories' \
-- npx -y hikerapi-mcp
Validate
Restart the assistant and ask:
Get the Instagram profile for @nasa.
Find the 5 most recent posts for #photography.
If you get structured data back, you're live.
Config reference
| Variable | What it does | Required |
|---|---|---|
HIKERAPI_KEY |
Your HikerAPI access key | yes |
HIKERAPI_URL |
Base URL override | no |
HIKERAPI_TAGS |
Comma-separated groups to include | no |
HIKERAPI_EXCLUDE_TAGS |
Groups to exclude | no |
HIKERAPI_TIMEOUT_MS |
Per-request timeout (default 30000) | no |
HIKERAPI_MAX_RESPONSE_BYTES |
Max response size (default 10 MB) | no |
A real use case
For me this became part of an AI marketing workflow: competitor research
(pull follower counts and engagement for a list of handles), hashtag
research before a campaign, and tracking the top posts in a niche — all from
natural-language prompts, without leaving the assistant.
Gotchas
- HikerAPI is prepaid. With a zero balance, endpoints return HTTP 402 Payment Required even though the key itself is valid (auth errors are 401/403). Top up before you validate.
-
npx -ydownloads the package on first run, so the first startup is slower. - Use environment variables for the key (see above) — don't commit secrets.
Wrap up
MCP + HikerAPI gets you structured Instagram data inside your AI assistant,
with zero glue code to maintain. Scope the tool tags to what you need, keep
the key in an env var, and you're a couple of commands away from asking your
assistant real questions about real profiles.
Repo: github.com/subzeroid/hikerapi-mcp · Package: npm i hikerapi-mcp
Top comments (0)