Tattoo Feed
Enables browsing and curating posts from Instagram tattoo artists via Business Discovery API, with features like inspiration feed, bookmarking, and preference tracking, optimized for ChatGPT integration.
README
Tattoo Pal
A calm, bounded way to spend time with the tattoo artists you admire — inside your AI chat, without Instagram's feed.
Tattoo Pal brings an artist's recent work to you one piece at a time, in a conversation, so you can sit with it, react, keep what resonates, and over time see how your own taste shows up across real work. It is the opposite of an infinite algorithmic scroll: you look at what you asked for and leave when you're done, not when a feed decides to release you.
Under the hood it is a Model Context Protocol (MCP) server. You point it at the artists you follow (by Instagram handle); from your chat client you can pull a merged feed, discover one post at a time, bookmark favourites, and record notes about your taste that a future session can reload. Recent work is fetched through Instagram's Business Discovery API.
The image renders inline only in ChatGPT. next_inspiration returns a
ChatGPT Apps SDK widget that draws the preview image directly in the
conversation. This matters because no other tested client shows the image inline
— ChatGPT does not render raw MCP image blocks, and Claude receives the image
but does not display it. Since actually seeing the work is the whole point, the
product targets the ChatGPT connector over HTTP. A stdio transport exists for
local development, but it does not render the image.
Read-and-curate only: Tattoo Pal never posts, comments, or messages, and previews are downscaled copies — see Attribution.
How it works
You ──▶ ChatGPT ──(OAuth-gated HTTP)──▶ Tattoo Pal (MCP server) ──▶ Instagram
│ Business
renders the ◀────┘ next_inspiration Discovery
Apps SDK widget returns a widget +
(image inline) downscaled preview
- MCP tools expose the actions (track artists, pull a feed, discover one piece, save, record taste). See The MCP tools.
- Two-layer codebase: all logic lives in a transport-agnostic
core; a thinserveradapter exposes it as MCP. See Repository layout. - OAuth 2.1 resource server: in HTTP mode every request must carry a valid
bearer token from your identity provider. An unauthenticated request gets
401with aWWW-Authenticate: Bearer resource_metadata=...header (RFC 9728); the ChatGPT connector follows this to complete login automatically. - The widget: the ≤640px preview travels as a data URL in the tool result's
_meta, which the ChatGPT host forwards to the widget iframe without ever putting the base64 through the model's context window.
Repository layout
Code — src/tattoo_feed/
A deliberate two-layer split so a future GUI can reuse the logic without a
rewrite. core knows nothing about MCP; server holds no business logic.
src/tattoo_feed/
config.py # lazy env config (IG_ACCESS_TOKEN, IG_USER_ID)
errors.py # typed error hierarchy (TattooFeedError + subclasses)
models.py # Pydantic v2 frozen value objects
imaging.py # preview downscale + EXIF strip (≤640px JPEG)
repositories/ # Repository ABC + JSON-file stores (atomic writes)
graph/client.py # Instagram Business Discovery client
services/ # Feed / Artist / Inspiration / Preference services
server/app.py # build_server() factory; MCP tools; stdio/HTTP entrypoint
server/auth.py # OAuth 2.1 JWT verifier (resource-server side)
server/widgets/ # Apps SDK widget HTML, served as a ui:// MCP resource
tests/ mirrors this with a fully hermetic suite — Instagram HTTP is mocked
with respx, JWKS with test-generated RSA keypairs, zero live network calls.
Non-code documentation
The repo keeps two kinds of written record alongside the code. Neither is needed to run the project; both are kept deliberately, as a window into how it was built.
-
scratchpads/— in-build engineering notes and design deep-dives. The working reasoning behind specific decisions and bug investigations, written as they happened: e.g.removing-the-global.md(why the module-level server global was removed),auth-wiring-seam.mdandhost-header-421.md(an auth refactor and the DNS-rebinding421it surfaced),rate-limiting.md,built-for-chatgpt.md. Think of these as the project's lab notebook. -
build_artifacts/— an archived record of the phased build. The project was built in stages (Phase 1–Phase 3), each driven by its own governing docs — an implementation plan, a technical-contract reference, process rules, and an acceptance checklist — plus the autonomous build-loop scripts and the per-phase build logs. It is purely historical: a snapshot of how each stage was specified and run, not live configuration. -
Root docs —
RETROACTIVE_PRD.mdreconstructs, at product altitude, the why / for whom / what "good" means (a teaching artifact written after the fact);CLAUDE.mdis the process governance for the build tooling.
Setup
Requirements: Python 3.12 and uv.
uv sync # create the venv and install pinned deps
cp .env.example .env # then edit .env with your real credentials
Environment variables
Always required — Instagram credentials:
| Variable | Meaning |
|---|---|
IG_ACCESS_TOKEN |
A long-lived Instagram Graph API access token. |
IG_USER_ID |
The Instagram Business/Creator account id that owns the token (not your Facebook user id). |
TATTOO_FEED_DATA_DIR |
Optional. Where the JSON stores live (default ./data). |
Required for HTTP / ChatGPT mode — OAuth resource-server config:
| Variable | Meaning |
|---|---|
MCP_AUTH_ISSUER |
Issuer URL of your IdP — must exactly match the token's iss claim. |
MCP_AUTH_JWKS_URL |
JWKS endpoint used to verify JWT signatures. |
MCP_AUTH_AUDIENCE |
Canonical public URL of this server — the RFC 8707 audience binding. |
MCP_AUTH_REQUIRED_SCOPES |
Comma-separated required scopes (blank for none). |
NGROK_AUTHTOKEN / NGROK_DOMAIN |
ngrok auth token and your reserved domain for stable TLS ingress. |
.env is gitignored and must never be committed — only .env.example (with
placeholders) is in the repo.
Getting Instagram credentials is a one-time manual step on Meta's side: create a Meta app, link an Instagram Business/Creator account to a Facebook Page, and mint a long-lived token with Business Discovery permission. The
IG_USER_IDmust be the Instagram account id (viaGET /me/accounts?fields=instagram_business_account), not your Facebook user id.
Running
ChatGPT over HTTP — the product
./run-server.sh builds the image and starts the server + ngrok tunnel together
(a thin wrapper over docker compose up --build):
cp .env.example .env # fill in all values, including MCP_AUTH_* and NGROK_*
./run-server.sh
Then:
- Open the ngrok inspector at
http://localhost:4040to confirm the public URL. - In ChatGPT, add a custom connector:
- URL:
https://<your-ngrok-domain>/mcp - Authentication: OAuth
- URL:
- ChatGPT walks through OAuth discovery and a browser login against your IdP, then lists the tools.
Identity provider. The server is IdP-agnostic — it only needs an issuer
supporting OAuth 2.1 + PKCE, metadata discovery (RFC 8414 / OIDC), and the RFC
8707 resource indicator. Auth0
has a documented walkthrough for exactly this setup (Stytch, WorkOS, Descope are
alternatives). Configure your IdP to issue tokens whose audience is the server's
public URL (MCP_AUTH_AUDIENCE), and register a matching API/resource for it.
Stable domain. Reserve a domain at
https://dashboard.ngrok.com/domains and set NGROK_DOMAIN in .env, so the
public URL — and the connector configuration — survive restarts.
Local development (stdio)
A credential-free local entrypoint, useful for exercising the tools without a tunnel or IdP, and the transport the test suite boots over. It does not render the inspiration image — use ChatGPT for the visual experience.
uv run python -m tattoo_feed.server.app
Wire it into a local MCP client with command: "uv",
args: ["run", "python", "-m", "tattoo_feed.server.app"], the project as cwd,
and IG_ACCESS_TOKEN / IG_USER_ID in env.
The MCP tools
| Tool | What it does |
|---|---|
list_artists |
List tracked artists. |
add_artist(handle) |
Validate the handle is a reachable professional account, then track it. |
remove_artist(handle) |
Stop tracking a handle. |
get_feed(limit_per_artist=10) |
Merged, newest-first feed — metadata + permalinks only (no images). |
next_inspiration() |
One not-yet-seen post, marked seen. Returns the Apps SDK widget; image renders inline only in ChatGPT. |
save_to_inspiration(post_id, notes=None) |
Bookmark a post into the saved collection. |
list_inspiration() |
The saved collection, in save order. |
remove_from_inspiration(post_id) |
Remove a saved item. |
reset_seen() |
Clear the seen-set so inspiration starts fresh. |
record_preference(observation) |
Persist a taste note (propose-then-confirm). |
get_preference_summary() |
All recorded preferences, to reload taste in a fresh session. |
Design notes
- Two-layer split (core / server). MCP concepts never leak into
core; business logic never leaks intoserver. A future GUI is a bolt-on, not a rewrite. - JSON-file persistence behind a
Repositoryinterface. Simple, inspectable, swappable. Writes are atomic (temp file +os.replace) so a crash mid-write can't corrupt a store. - Lazy credentials. The server boots and lists its tools with no network and no real credentials; tokens are read only when a tool calls Instagram or the auth middleware validates a bearer token.
- Constructor-injected auth via a factory.
build_server(auth_cfg)is the single place a server instance is created, with auth supplied through the SDK's publicauth=/token_verifier=parameters — no private-attribute writes. PassingNonebuilds the unauthenticated stdio server. - Widget image as a data URL in
_meta. Onlynext_inspirationreturns a rendered image — the one-at-a-time moment that earns the context.get_feedstays metadata-only to keep the context window light. - Typed errors, frozen models, strict typing. Every external failure maps to
a
TattooFeedError; boundary data is validated once into immutable Pydantic v2 values;mypy --strict,ruff, and a 90% coverage floor are enforced.
Limitations (by design)
- Inline image rendering is ChatGPT-only — the Apps SDK widget is the one channel that shows the image; no other tested client displays it.
- No video, carousels show the first image only. Still imagery, filtered at the Graph-client layer.
- Single account. Wired to one Instagram account (
IG_USER_ID); OAuth gates who may call, not which account is queried. - Manual token refresh. No auto-refresh; an expired token fails with a clear
TokenExpiredError. - Resource-server only. The server validates tokens but does not issue them — it relies on an external IdP that must be configured first.
- Widget render is human-verified. The gate confirms the widget is registered
and the
_metais present; whether the image actually paints in ChatGPT is an eyeball check.
Attribution & copyright
Posts belong to the artists who made them. This tool is for personal discovery and curation, not redistribution:
- Previews are downscaled copies (≤640px, EXIF stripped), never full-res.
- Every image and saved item carries the artist's handle and the post's permalink, so attribution travels with the content.
- Respect each artist's rights: don't repost or reuse their work without permission.
Development
The full gate (all must exit 0):
uv run ruff format --check .
uv run ruff check .
uv run mypy --strict src
uv run pytest -q --cov=src/tattoo_feed --cov-report=term-missing --cov-fail-under=90
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。