feat: réécriture Go du serveur MCP (client de l'API /v1) — reads - #2
Open
t0m-car wants to merge 1 commit into
Open
feat: réécriture Go du serveur MCP (client de l'API /v1) — reads#2t0m-car wants to merge 1 commit into
t0m-car wants to merge 1 commit into
Conversation
Porte le serveur MCP de Next.js/TS vers Go dans go/ (le TS reste intact à la racine). Le serveur devient un client HTTP mince de footics-api /v1 : il vérifie le JWT Supabase localement (double-mode JWKS/HS256, même logique que footics-api internal/auth) puis relaie le Bearer vers /v1. Zéro accès DB. - SDK officiel github.com/modelcontextprotocol/go-sdk v1.6.1 (Streamable HTTP stateless + auth.RequireBearerToken + PRM RFC 9728 sur les 2 chemins well-known) - 9 outils de lecture mappés sur /v1, formes de sortie GELÉES (identiques au TS lib/tools.ts) ; inputSchema fixés explicitement - submit_prediction = stub gated OFF (POST /v1/predictions = M4, non livré) - Tests : unit (auth double-mode, mapping de forme par outil vs contrat TS) + intégration contre l'API staging (skip propre si injoignable) Gate vert : go build && go vet && gofmt -l (vide) && go test ./... Validé à la main contre l'API staging (127.0.0.1:8099). Claude-Session: https://claude.ai/code/session_01CsRaJpQmoPyXRqH7g29mwN
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Réécriture Go du serveur MCP Footics en client HTTP mince de
footics-api/v1(PRD 15). Livrable de staging à valider — pas une bascule prod. Le MCP live (mcp.footics.appsur Vercel) et tout le code TS restent intacts.Ne pas merger. Le retrait du TS et la bascule = décision de Tom.
Ce qui est livré (
go/)cmd/mcp+internal/{config,auth,apiclient,tools}.AUTH_JWKS_URL|AUTH_JWT_SECRET,aud), même logique quefootics-api/internal/auth(cache JWKS + cooldown copiés). Zéro accès DB.apiclientrelaie le Bearer de l'appelant versFOOTICS_API_URL+?competition=;footics-apire-vérifie (frontière de confiance).github.com/modelcontextprotocol/go-sdk@v1.6.1: Streamable HTTP stateless,auth.RequireBearerToken,auth.ProtectedResourceMetadataHandler(RFC 9728) sur les 2 chemins well-known + défiWWW-Authenticate. Routage = stdlibnet/http.ServeMux(5 routes ; chi n'apporterait rien).lib/tools.ts),inputSchemafixés explicitement (internal/tools/schemas.go).submit_prediction= stub gated OFF (voir plus bas).127.0.0.1:8099, JWT alice minté, assert la forme de chaque outil ; skip propre si injoignable).go/) +.env.example.Mapping outil → endpoint
/v1whoamisub/email)list_matchesGET /v1/matches?competition=&status=&limit=get_matchGET /v1/matches/{id}(+events[], 404 → « Match introuvable. »)get_my_standingGET /v1/me?competition=(404 → « Profil introuvable. »)get_my_predictionsGET /v1/predictions?competition=&when=&limit=get_leaderboardGET /v1/leaderboard?competition=&group=&limit=list_my_groupsGET /v1/groups?competition=get_joker_statusGET /v1/jokers?competition=searchGET /v1/search?q=submit_predictionPOST /v1/predictions(M4)Projections pour rester byte-identique au TS :
kickoffAtnormalisé au formattoISOString()(.000Z—/v1/predictionset/v1/searchl'émettent sans millis) ;venuevide →null;score=Score(fini) /LiveScore(live) ;predictionsanswinnerTeamCode;result/pointsprésents-null.Ce qui attend M4 (writes)
footics-api POST /v1/predictionsn'est pas livré (M4).submit_predictionest enregistré (la prod tourne writes ON) mais reste un stub :MCP_ENABLE_WRITES=false→ « écriture pas encore disponible sur cette instance » ; writes ON → « arrivera avec l'API /v1 POST (M4) ». Câblage réel = un appel à ajouter dansapiclient+ le handler une fois M4 mergé.Structure de repo choisie :
go/Livré sous
go/→ branche purement additive : aucun fichier TS de la racine n'est déplacé/supprimé, Vercel intact. PRD 15 §9 prévoit à terme une réécriture en place (TS → historique + tagv0-nextjs) ; promouvoirgo/à la racine et archiver le TS = décision séparée de Tom.Non inclus (arrivent au cutover N4) : Dockerfile/GHCR, CI Go, service compose + route tunnel.
Gate
go build ./... && go vet ./... && gofmt -l .(vide) +go test ./...→ vert. Validé à la main contre l'API staging (sorties d'outils réelles dans le rapport de session).