FatSecret
FatSecret MCP server in Go β food search, barcode, NLP, image recognition, recipes, food/exercise/weight diaries over stdio and Streamable HTTP Topics
Documentation
FatSecret MCP Server (Go) 
[!IMPORTANT] This is not an official MCP server by FatSecret. It uses the FatSecret Platform API which requires a free developer account.
An MCP (Model Context Protocol) server that connects Claude/Cursor to the FatSecret Platform API. Search foods, track your diet, manage recipes, and monitor weight directly from your AI assistant.
56 tools, config in ~/.fatsecret-mcp/config.json.
Built on the official modelcontextprotocol/go-sdk.
β¨ Features
- π Authentication β Interactive credential setup and OAuth authorization
- π¨βπ©βπ§ Multi-user β
X-MCP-Userheader over HTTP selects the household member; each authorizes separately, tokens stored per user in the config file - β Draft β confirm β Stage any write with
prepare_call(validated + human-readable preview), execute withconfirm_draft. SetFATSECRET_REQUIRE_CONFIRM=1to block direct writes entirely - π Food Search β Search FatSecret's extensive food database with detailed nutrition data
- π· Barcode Lookup β Find foods by GTIN-13 barcode
- π³ Recipe Search β Browse and filter recipes by calories, macros, and prep time
- π Food Diary β Add, edit, copy, and delete food diary entries
- π½οΈ Saved Meals β Create and manage reusable meal templates
- βοΈ Weight Tracking β Record and view weight history
- πββοΈ Exercise Tracking β View exercises and manage activity entries
- β Favorites β Manage favorite foods and recipes
π Why this server
Comparison as of November 2026, based on public Glama listings. The official server is described in FatSecret's own docs.
| This server | Official mcp.fatsecret.com | Strongest community alternatives | |
|---|---|---|---|
| Tools | 56 | 4 | 44 / 39 / 28 (best three) |
| Diary / weight / exercise writes | β full | β read-only | β (all three) |
| Write confirmation | β draftβconfirm + strict mode | β | β two of them (prepare/commit style) |
| Multi-user household | β
X-MCP-User header | β one seat per person | β one of them |
| Works on a free API key | β (v6 β v1 fallback) | β Premier only | varies by server |
| Single binary, no runtime | β Go, ~14 MB, ~10 MB RAM | β hosted seats | β Python/JS runtimes |
| stdio + Streamable HTTP | β | remote only | β one of them, varies otherwise |
Endpoints covered here that neither the official server nor β to our
knowledge β any community server exposes: create_food_feedback,
get_food_classification_levels, commit_exercise_day,
create_profile / get_profile_auth.
π Quick Start
Build the binary (Go 1.27+):
go build -o fatsecret-mcp ./cmd/fatsecret-mcp
Or grab a ready binary / Docker image from Releases:
docker run -i --rm \
-e FATSECRET_CLIENT_ID=... \
-e FATSECRET_CLIENT_SECRET=... \
ghcr.io/kondratjev/fatsecret-mcp-go:latest
Add to your MCP client configuration:
{
"mcpServers": {
"fatsecret": {
"command": "/absolute/path/to/fatsecret-mcp"
}
}
}
That's it! On first use, the AI will guide you through setup:
check_auth_statusβ detects missing credentials and tells you what to dosetup_credentialsβ you provide your API keys (saved to~/.fatsecret-mcp/config.json)start_authβcomplete_authβ authorize your FatSecret account for diary/weight tools
Alternatively, you can pass credentials as environment variables:
{
"mcpServers": {
"fatsecret": {
"command": "/absolute/path/to/fatsecret-mcp",
"env": {
"FATSECRET_CLIENT_ID": "your_client_id",
"FATSECRET_CLIENT_SECRET": "your_client_secret",
"FATSECRET_CONSUMER_SECRET": "your_consumer_secret"
}
}
}
}
π Where to Get Credentials
- Create a free account at platform.fatsecret.com
- Navigate to My Account β API Keys
- You'll see three values:
- Client ID (used for both OAuth 2.0 and OAuth 1.0)
- Client Secret (OAuth 2.0 - for public food/recipe search)
- Consumer Secret (OAuth 1.0 - for user profile/diary access)
π Step-by-step guide: Getting Started with FatSecret API
π Premier Keys
Premier keys work out of the box. FatSecret grants OAuth 2.0 scopes per key, so the server asks for basic premier barcode nlp image-recognition localization feedback and, if FatSecret refuses any of them, keeps just the ones your key is entitled to (free keys end up with basic). Premier keys get Premier-only data such as branded foods and search_foods v6; free keys get search_foods v1. Barcode lookup needs the barcode scope; parse_food_text and recognize_food_image need the paid NLP and image recognition add-ons.
Claude Desktop (Manual)
~/Library/Application Support/Claude/claude_desktop_config.json β same JSON as above.
Claude Code (CLI)
claude mcp add fatsecret -- /absolute/path/to/fatsecret-mcp
Or with env vars:
claude mcp add fatsecret \
-e FATSECRET_CLIENT_ID=your_client_id \
-e FATSECRET_CLIENT_SECRET=your_client_secret \
-e FATSECRET_CONSUMER_SECRET=your_consumer_secret \
-- /absolute/path/to/fatsecret-mcp
Verify with claude mcp list.
Cursor
- Settings UI β
Settings β MCP β + Add new MCP server, then fill in the command and env - Project config β add JSON to
.cursor/mcp.jsonin your project root - Global config β add JSON to
~/.cursor/mcp.json
ChatGPT
Remote only β paste your self-hosted URL (Settings β Connectors β Add):
https://<DOMAIN>/<MCP_SECRET>/mcp
OpenCode
~/.config/opencode/opencode.json β note the key is mcp, env is environment:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"fatsecret": {
"type": "local",
"command": ["/absolute/path/to/fatsecret-mcp"],
"environment": {
"FATSECRET_CLIENT_ID": "your_client_id",
"FATSECRET_CLIENT_SECRET": "your_client_secret",
"FATSECRET_CONSUMER_SECRET": "your_consumer_secret"
},
"enabled": true
}
}
}
Or point at your self-hosted server instead of a local binary:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"fatsecret": {
"type": "remote",
"url": "https://<DOMAIN>/<MCP_SECRET>/mcp",
"enabled": true
}
}
}
π οΈ Available Tools
| Tool | Description |
|---|---|
| π Setup & Auth | |
check_auth_status | Check if credentials and profile auth are configured. Call this first. |
setup_credentials | Save FatSecret API credentials to persistent config |
start_auth | Start OAuth 1.0 authorization β returns URL for user to visit |
complete_auth | Complete OAuth with verifier PIN from authorization page |
prepare_call | Stage a write as a single-use draft (validated + preview, nothing written) |
confirm_draft | Execute a draft staged by prepare_call |
| π Food Search (public) | |
search_foods | Search the food database |
get_food | Get detailed nutrition info for a food |
find_food_by_barcode | Find food by GTIN-13 barcode |
autocomplete_foods | Get search autocomplete suggestions |
| π€ Recognition (paid add-ons) | |
parse_food_text | Match a free-text meal description to foods and servings (NLP) |
recognize_food_image | Recognize foods in a meal photo (image recognition) |
create_food_feedback | Report food/barcode data issues, get upload URLs (paid feedback add-on) |
| π³ Recipes (public) | |
search_recipes | Search recipes with filters |
get_recipe | Get recipe details with ingredients and directions |
| π Reference (public) | |
get_food_categories | Get food categories |
get_food_sub_categories | Get food sub categories |
get_food_classification_levels | Get food classification hierarchy (Premier) |
get_brands | Get food brands |
get_recipe_types | Get recipe types |
| π Food Diary (profile auth) | |
log_meal | Log a whole meal in one call (grams or servings) and get day totals |
get_food_entries | Get food diary entries for a date |
get_food_entries_month | Get monthly nutrition summary (calories & macros per day) |
create_food_entry | Add a food diary entry |
edit_food_entry | Edit a food diary entry |
delete_food_entry | Delete a food diary entry |
copy_food_entries | Copy entries from one date to another |
copy_saved_meal_entries | Copy a saved meal to a date |
| β Favorites (profile auth) | |
get_favorite_foods | Get favorite foods |
add_favorite_food | Add food to favorites |
delete_favorite_food | Remove food from favorites |
get_most_eaten_foods | Get most eaten foods |
get_recently_eaten_foods | Get recently eaten foods |
get_favorite_recipes | Get favorite recipes |
add_favorite_recipe | Add recipe to favorites |
delete_favorite_recipe | Remove recipe from favorites |
| π½οΈ Saved Meals (profile auth) | |
get_saved_meals | Get saved meals |
create_saved_meal | Create a saved meal |
edit_saved_meal | Edit a saved meal |
delete_saved_meal | Delete a saved meal |
get_saved_meal_items | Get items in a saved meal |
add_saved_meal_item | Add food to a saved meal |
edit_saved_meal_item | Edit saved meal item |
delete_saved_meal_item | Remove item from saved meal |
| βοΈ Weight (profile auth) | |
update_weight | Record weight for a date |
get_weight_month | Get weight history for a month |
| πββοΈ Exercise (profile auth) | |
get_exercises | Get exercise types |
get_exercise_entries | Get exercise entries for a date |
edit_exercise_entries | Shift exercise time between activities |
get_exercise_entries_month | Get exercise data for a month |
save_exercise_template | Save exercise template for weekdays |
commit_exercise_day | Commit template entries for a date |
| π€ Profile (profile auth) | |
get_profile | Get user profile info |
create_food | Create a custom food (Premier) |
create_profile | Create a detached profile (returns tokens, no switch) |
get_profile_auth | Get auth tokens for a detached profile |
API reference: FatSecret Postman Collection
π§ͺ Test Connection
List tools over stdio (keep stdin open β the server exits on EOF):
{ printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'; sleep 4; } | ./fatsecret-mcp
Or serve HTTP and probe it:
PORT=8000 ./fatsecret-mcp &
curl localhost:8000/healthz # β ok
With credentials:
FATSECRET_CLIENT_ID='...' FATSECRET_CLIENT_SECRET='...' FATSECRET_CONSUMER_SECRET='...' ./fatsecret-mcp
π Requirements
- Go 1.27+ to build (or just the binary β no runtime needed)
- FatSecret Platform API account (platform.fatsecret.com)
- MCP-compatible client (Claude Desktop, Cursor, etc.)
π Self-Hosted Server (Docker)
Run the server on your own machine or VPS and connect remote clients (Claude.ai, ChatGPT connectors) over HTTPS.
- Copy
.env.exampleto.envand fill it in:FATSECRET_CLIENT_ID,FATSECRET_CLIENT_SECRET,FATSECRET_CONSUMER_SECRETTZβ time zone for the default diary "today" (e.g.Europe/Moscow)DOMAINβ public host name (an IP works too, e.g.203-0-113-5.sslip.io)MCP_SECRETβ long random string:openssl rand -hex 24
docker compose up -d --build
Caddy issues HTTPS automatically and proxies only https://<DOMAIN>/<MCP_SECRET>/mcp to the server β everything else gets 404. The secret path is the access control, since remote MCP connectors can't send auth headers. Guard the URL like a password. The image is a static Go binary serving stateless Streamable HTTP natively (no gateway, no per-session processes), so memory stays flat no matter how many prompts hit it.
Profile tokens persist in ./data, so setup_credentials and favorites survive restarts and rebuilds.
π¨βπ©βπ§ Multi-user (household)
One server can serve several people: over HTTP, the X-MCP-User header selects the member (any string, e.g. anna). Each member authorizes separately β start_auth β complete_auth under their own header β and tokens are stored per user in the config file. check_auth_status reports the current user. Requests without the header (and all stdio clients) use the default member.
Note: remote connectors that can't send custom headers (ChatGPT) only reach the default member β multi-user needs a client with header support (Claude, OpenCode, direct HTTP).
π Deploy to VPS
Single source of truth is this repo β never edit code on the server. The server copy is a clean mirror (git reset --hard; .env and ./data are git-ignored and survive).
VPS_SSH=user@host VPS_DIR=/opt/fatsecret-mcp-go ./scripts/deploy.sh
This pushes the current branch, then on the server pulls it, rebuilds and restarts (docker compose, or legacy docker-compose if v2 is missing). Export VPS_SSH/VPS_DIR in your shell rc to run bare ./scripts/deploy.sh. On a tiny VPS: docker builder prune -af if a build runs out of disk, add swap if the build OOMs.
π§ Development
.
βββ cmd/fatsecret-mcp/ # entrypoint: stdio vs stateless HTTP, tool registration
βββ internal/
β βββ api/ # Server state, OAuth2 token cache, public/profile requests
β βββ auth/ # OAuth 2.0 (scopes, detection) + OAuth 1.0 (HMAC-SHA1)
β βββ config/ # ~/.fatsecret-mcp/config.json + env overrides
β βββ httpx/ # resilientFetch: timeouts + GET-only retries
β βββ platform/ # dates, servings, scope-14 detection, search trimming
β βββ tools/ # 56 tool definitions + handlers
βββ Dockerfile
βββ docker-compose.yml # mcp + Caddy (HTTPS, secret path)
go build ./... # build
go vet ./... # lint
go test ./... # tests (OAuth1 RFC 5849 vector, dates, servings)
Debugging with MCP Inspector:
FATSECRET_CLIENT_ID=X FATSECRET_CLIENT_SECRET=X FATSECRET_CONSUMER_SECRET=X npx -y @modelcontextprotocol/inspector /absolute/path/to/fatsecret-mcp
π License
MIT License - see LICENSE file for details.