14 {
15 status: "error",
16 message: "Failed to connect to Notion API",
17 error: error.message,
18 },
8
9 try {
10 // 1. Récupération des fromages depuis l'API OpenDataSoft
11 const response = await fetch(
12 "https://public.opendatasoft.com/api/explore/v2.1/catalog/datasets/fromagescsv-fromagescsv/records?limit=100",
13 );
14
15 if (!response.ok) {
16 throw new Error(`Erreur API: ${response.status}`);
17 }
18
21
22 if (!fromages || fromages.length === 0) {
23 throw new Error("Aucun fromage trouvé dans l'API");
24 }
25
14 {
15 status: "error",
16 message: "Failed to connect to Notion API",
17 error: error.message,
18 },
13
14 const data = await response.json();
15 console.log("API Response:", data);
16 } catch (error) {
17 console.error("Error fetching API:", error);
18 }
19}
371 '<p class="text-gray-500">Generating roll-up summary...</p>';
372
373 // TODO: Implement actual API call to analytics val
374 }
375 `}</script>
4// Usage: node test-mcp-server.js
5
6const BASE_URL = "https://sprintsummarizer-pdw.web.val.run/api/mcp";
7
8async function testMCPServer() {
5 "args": [
6 "-X", "POST",
7 "https://sprintsummarizer-pdw.web.val.run/api/mcp",
8 "-H", "Content-Type: application/json",
9 "-d", "@-"
13} from "https://val.town/v/pdw/prDatabase";
14
15// Get Gemini API key from environment
16const GEMINI_API_KEY = Deno.env.get("GEMINI_API_KEY") || "";
17
18interface RollupRequest {
29 focus: string = "executive"
30): Promise<string> {
31 if (!GEMINI_API_KEY) {
32 return "AI summary generation unavailable - Gemini API key not configured";
33 }
34
35 const genAI = new GoogleGenerativeAI(GEMINI_API_KEY);
36 const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
37
211}
212
213// Main HTTP handler for analytics API
214export default async function(req: Request): Promise<Response> {
215 const url = new URL(req.url);
70 try {
71 const response = await fetch(
72 `https://api.github.com/repos/${GITHUB_REPO}/actions/workflows/${GITHUB_WORKFLOW_ID}/dispatches`,
73 {
74 method: "POST",
121 } else {
122 const error = await response.text();
123 throw new Error(`GitHub API returned ${response.status}: ${error}`);
124 }
125 } catch (error) {
13
14 const data = await response.json();
15 console.log("API Response:", data);
16 } catch (error) {
17 console.error("Error fetching API:", error);
18 }
19}