mirror of
https://github.com/Dasemu/meta-social-mcp.git
synced 2026-11-26 07:16:21 +00:00
chore: bootstrap Claude setup
Add root CLAUDE.md, LESSONS.md, docs/ index, .claude hooks (syntax-check on edit/write and on stop, since no linter/test suite is configured yet), CI/version GitHub Actions workflows scoped to the existing master branch, and translate .env.example comments to English. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7be83fd764
commit
a1758b40b8
8 files changed
+154
-13
No files matched your search
@@ -0,0 +1 @@
|
||||
2
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(cat | python3 -c 'import json,sys; print(json.load(sys.stdin).get(\"tool_input\",{}).get(\"file_path\",\"\"))'); case \"$file\" in *.js) node --check \"$file\" ;; esac"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "cd \"$CLAUDE_PROJECT_DIR\" && status=0; for f in $(find src -name '*.js'); do node --check \"$f\" || status=1; done; exit $status"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
+13
-13
@@ -1,36 +1,36 @@
|
||||
# Copia este archivo a .env y rellena los valores
|
||||
# Copy this file to .env and fill in the values
|
||||
|
||||
# Token de acceso (largo, 60 dias) del usuario admin de la pagina/cuenta IG
|
||||
# Access token (long-lived, 60 days) of the admin user of the page/IG account
|
||||
META_ACCESS_TOKEN=
|
||||
|
||||
# App ID y App Secret de tu app en developers.facebook.com
|
||||
# App ID and App Secret of your app on developers.facebook.com
|
||||
META_APP_ID=
|
||||
META_APP_SECRET=
|
||||
|
||||
# Se obtienen con: npm run get-ids
|
||||
# Obtained with: npm run get-ids
|
||||
META_PAGE_ID=
|
||||
META_IG_BUSINESS_ID=
|
||||
|
||||
# Version de la Graph API a usar
|
||||
# Graph API version to use
|
||||
META_GRAPH_VERSION=v21.0
|
||||
|
||||
# Puerto e interfaz donde escucha el servidor HTTP del MCP
|
||||
# Port and interface the MCP HTTP server listens on
|
||||
PORT=3300
|
||||
HOST=127.0.0.1
|
||||
|
||||
# Token opcional para proteger el endpoint /mcp (header: Authorization: Bearer <valor>)
|
||||
# Dejalo vacio para desactivar la comprobacion (solo recomendable en local/dev)
|
||||
# Optional token to protect the /mcp endpoint (header: Authorization: Bearer <value>)
|
||||
# Leave empty to disable the check (only recommended in local/dev)
|
||||
MCP_AUTH_TOKEN=
|
||||
|
||||
# URL publica (con path si aplica) desde la que se sirven los archivos subidos
|
||||
# con upload_media, ej: https://mcp.zenvairo.es/zenvairosocial
|
||||
# Public URL (with path if applicable) from which files uploaded with upload_media are served,
|
||||
# e.g. https://mcp.zenvairo.es/zenvairosocial
|
||||
MEDIA_BASE_URL=
|
||||
|
||||
# Directorio donde se guardan los archivos subidos (por defecto ./media)
|
||||
# Directory where uploaded files are stored (defaults to ./media)
|
||||
MEDIA_DIR=
|
||||
|
||||
# Tamano maximo (MB) de un archivo subido con upload_media
|
||||
# Maximum size (MB) of a file uploaded with upload_media
|
||||
MAX_UPLOAD_MB=50
|
||||
|
||||
# Dias que se conservan los archivos subidos antes de borrarse automaticamente
|
||||
# Days uploaded files are kept before being automatically deleted
|
||||
MEDIA_RETENTION_DAYS=7
|
||||
@@ -0,0 +1,28 @@
|
||||
name: CI
|
||||
|
||||
# This repo currently only has a `master` branch (no `development`/`main` split yet).
|
||||
# Update these triggers if/when the standard `development`/`main` branches are introduced.
|
||||
on:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "npm"
|
||||
|
||||
- run: npm ci
|
||||
|
||||
# No linter or test suite is configured in package.json yet; this is the quickest
|
||||
# meaningful check available (catches syntax errors in every source file).
|
||||
- name: Syntax check
|
||||
run: |
|
||||
for f in $(find src -name '*.js'); do node --check "$f"; done
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Version
|
||||
|
||||
# Simplified for now: this repo only has a `master` branch (no `development`/`main` split yet).
|
||||
# Once that split exists, update this to the full development→main bump rules described in the
|
||||
# global CLAUDE.md (PATCH bump on push to development, MINOR bump + PATCH reset on an approved
|
||||
# development→main PR, PATCH bump on a direct hotfix push to main).
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
bump:
|
||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'github-actions[bot]' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
|
||||
- name: Bump patch version
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
npm version patch --no-git-tag-version
|
||||
VERSION=$(node -p "require('./package.json').version")
|
||||
git commit -am "chore(release): v${VERSION} [skip ci]"
|
||||
git push
|
||||
@@ -0,0 +1,41 @@
|
||||
# CLAUDE.md
|
||||
|
||||
## Overview
|
||||
SocialMCP: an MCP HTTP server that publishes to and manages a single Facebook Page and
|
||||
linked Instagram professional account via Meta's Graph API (stateless streamable-HTTP MCP
|
||||
transport).
|
||||
|
||||
## Commands
|
||||
- Dev/run: `npm start` (serves `http://HOST:PORT/mcp`, defaults `127.0.0.1:3300`)
|
||||
- Helper scripts: `npm run get-ids` (fetch Page/IG IDs and Page Access Token), `npm run extend-token`
|
||||
(exchange a short-lived user token for a 60-day one)
|
||||
- Test: none configured yet
|
||||
- Lint: none configured yet
|
||||
- Build: none (plain Node.js, no bundling/transpilation)
|
||||
|
||||
## Architecture
|
||||
Entry point `src/index.js` wires an Express HTTP server to the MCP SDK (`@modelcontextprotocol/sdk`).
|
||||
Tools are defined in `src/tools.js` and call the Graph API through `src/graph.js`. `src/media.js`
|
||||
handles local file uploads served back as public URLs for `publish_post`. See `README.md` for the
|
||||
full tool reference and `docs/` for anything longer-form.
|
||||
|
||||
## Conventions
|
||||
- ES modules (`"type": "module"` in package.json).
|
||||
- No TypeScript, no bundler: code runs directly with `node`.
|
||||
- Config is env-var only, read via `process.env` (see `.env.example` for the full list); never
|
||||
hardcode credentials.
|
||||
|
||||
## Workflow quirks
|
||||
- `get-ids` and `extend-token` are one-off setup scripts, not part of the server runtime.
|
||||
- The server is stateless: each JSON-RPC request is handled independently (no session state kept
|
||||
in memory between requests), per the MCP SDK's recommendation for streamable HTTP.
|
||||
|
||||
## Deployment
|
||||
Use the `web-deploy` skill for anything related to hosting this as a live service (LXC/VPS,
|
||||
systemd, update script, authenticated update endpoint).
|
||||
|
||||
## Gotchas
|
||||
- Instagram requires media (`imageUrl`/`videoUrl`/`media`) on every post; text-only posts are
|
||||
Facebook-only.
|
||||
- Graph API insight metric names change between API versions; see the README's Insights section
|
||||
for the metrics confirmed working on the current `META_GRAPH_VERSION`.
|
||||
@@ -0,0 +1,6 @@
|
||||
# LESSONS.md
|
||||
|
||||
Recurring mistakes and how to avoid them. Read before starting work; add an entry when a mistake
|
||||
repeats.
|
||||
|
||||
(No entries yet.)
|
||||
@@ -0,0 +1,6 @@
|
||||
# Documentation index
|
||||
|
||||
This directory is the standard location for longer-form docs. Right now the full setup guide and
|
||||
tool reference live in the root `README.md` (kept there since it currently doubles as the
|
||||
project's quick-start guide); move sections here as they grow instead of letting the root README
|
||||
turn into a long reference manual.
|
||||
Reference in new issue
Block a user