42 };
43
44 // Search packages API call
45 const searchPackages = async (loadMore = false) => {
46 try {
72 });
73
74 // Make API request
75 const response = await fetch(`/api/packages/search?${queryParams.toString()}`);
76 const result = await response.json();
77
43});
44
45// API routes
46app.route("/api/auth", authRoutes);
47app.route("/api/packages", packageRoutes);
48app.route("/api/agencies", agencyRoutes);
49app.route("/api/bookings", bookingRoutes);
50app.route("/api/payments", paymentRoutes);
51
52// Serve static files
70});
71
72// Handle 404 for API routes
73app.notFound((c) => {
74 if (c.req.path.startsWith("/api/")) {
75 return c.json({ success: false, error: "Endpoint not found" }, 404);
76 }
77
78 // For non-API routes, serve the index.html to support client-side routing
79 return c.redirect("/");
80});
110}
111
112// API response types
113export interface ApiResponse<T> {
114 success: boolean;
115 data?: T;
18โ โ โโโ migrations.ts # Schema definitions
19โ โ โโโ queries.ts # DB query functions
20โ โโโ routes/ # API route handlers
21โ โ โโโ agencies.ts # Agency-related endpoints
22โ โ โโโ auth.ts # Authentication endpoints
24โ โ โโโ packages.ts # Travel package endpoints
25โ โ โโโ payments.ts # Payment processing endpoints
26โ โโโ index.ts # Main API entry point
27โโโ frontend/
28โ โโโ components/
42## Technology Stack
43
44- **Backend**: Hono (API framework), SQLite (database)
45- **Frontend**: React, TailwindCSS
46- **Authentication**: JWT-based authentication
1# Livestorm API MCP Server
2
3This project creates a Model Context Protocol (MCP) server that wraps the Livestorm API, exposing:
4- GET endpoints as Resources
5- POST, PUT, DELETE endpoints as Tools
7## How it works
8
91. The server fetches and parses the Livestorm API's OpenAPI definition
102. It dynamically creates MCP Resources and Tools based on the API endpoints
113. When a client requests a Resource or Tool, the server proxies the request to the Livestorm API
124. Authentication is handled by passing through the Authorization header
13
14## Authentication
15
16The Livestorm API requires authentication via an API token. This token should be passed to the MCP server in the Authorization header, which will then be forwarded to the Livestorm API.
17
18See the [Livestorm API documentation](https://developers.livestorm.co/docs/api-token-authentication#use-the-api-token) for more details on authentication.
19
20## Files
21
22- `index.ts`: Main entry point with HTTP trigger
23- `livestormApi.ts`: Functions to fetch and parse the OpenAPI definition
24- `mcp.ts`: MCP server setup and configuration
72. Send notifications to your preferred platform (Discord, Slack, email, etc.)
8
9Reddit does not have an API that allows users to scrape data, so we are doing this with the Google Search API, [Serp](https://serpapi.com/).
10
11---
29
30---
31### 3. Get a SerpApi Key
32This template requires a [SerpApi](https://serpapi.com/) key to search Reddit posts via Google search results.
33
341. **Get a SerpApi key**:
35 - Sign up at [SerpApi](https://serpapi.com/) to create an account.
36 - Generate an API key from your account dashboard.
37
382. **Add the SerpApi key to your environment variables**:
39 - Go to your [Val Town environment variables](https://www.val.town/settings/environment-variables).
40 - Add a new key:
41 - Key: `SERP_API_KEY`
42 - Value: Your SERP API key.
43
44Without this key, the val will not function correctly.
75
76### NOTE: Usage Limits
77- **SerpApi:** Free SerpApi accounts have monthly call limits.
1import { searchWithSerpApi } from "https://esm.town/v/charmaine/searchWithSerpApi";
2import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
3
4// Customize your search parameters
5const KEYWORDS = "\"node\" OR \"node.js\"";
6const DISCORD_API_KEY = Deno.env.get("mentionsDiscord");
7const SERP_API_KEY = Deno.env.get("SERP_API_KEY");
8
9// Set isProd = false for testing and = true for production
13
14export async function redditAlert({ lastRunAt }: Interval) {
15 if (!SERP_API_KEY || !DISCORD_API_KEY) {
16 console.error("Missing SERP_API_KEY or Discord webhook URL. Exiting.");
17 return;
18 }
19
20 // Determine the time frame for the search
21 // Details on as_qdr: https://serpapi.com/advanced-google-query-parameters#api-parameters-advanced-search-query-parameters-as-qdr
22 const timeFrame = isProd
23 ? lastRunAt
27
28 try {
29 const response = await searchWithSerpApi({
30 query: KEYWORDS,
31 site: "reddit.com",
32 apiKey: SERP_API_KEY,
33 as_qdr: timeFrame,
34 });
62 if (isProd) {
63 await discordWebhook({
64 url: DISCORD_API_KEY,
65 content,
66 });
72. Send notifications to your preferred platform (Discord, Slack, email, etc.)
8
9Reddit does not have an API that allows users to scrape data, so we are doing this with the Google Search API, [Serp](https://serpapi.com/).
10
11---
29
30---
31### 3. Get a SerpApi Key
32This template requires a [SerpApi](https://serpapi.com/) key to search Reddit posts via Google search results.
33
341. **Get a SerpApi key**:
35 - Sign up at [SerpApi](https://serpapi.com/) to create an account.
36 - Generate an API key from your account dashboard.
37
382. **Add the SerpApi key to your environment variables**:
39 - Go to your [Val Town environment variables](https://www.val.town/settings/environment-variables).
40 - Add a new key:
41 - Key: `SERP_API_KEY`
42 - Value: Your SERP API key.
43
44Without this key, the val will not function correctly.
75
76### NOTE: Usage Limits
77- **SerpApi:** Free SerpApi accounts have monthly call limits.
1import { searchWithSerpApi } from "https://esm.town/v/charmaine/searchWithSerpApi";
2import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
3
4// Customize your search parameters
5const KEYWORDS = "\"node\" OR \"node.js\"";
6const DISCORD_API_KEY = Deno.env.get("mentionsDiscord");
7const SERP_API_KEY = Deno.env.get("SERP_API_KEY");
8
9// Set isProd = false for testing and = true for production
13
14export async function redditAlert({ lastRunAt }: Interval) {
15 if (!SERP_API_KEY || !DISCORD_API_KEY) {
16 console.error("Missing SERP_API_KEY or Discord webhook URL. Exiting.");
17 return;
18 }
19
20 // Determine the time frame for the search
21 // Details on as_qdr: https://serpapi.com/advanced-google-query-parameters#api-parameters-advanced-search-query-parameters-as-qdr
22 const timeFrame = isProd
23 ? lastRunAt
27
28 try {
29 const response = await searchWithSerpApi({
30 query: KEYWORDS,
31 site: "reddit.com",
32 apiKey: SERP_API_KEY,
33 as_qdr: timeFrame,
34 });
62 if (isProd) {
63 await discordWebhook({
64 url: DISCORD_API_KEY,
65 content,
66 });
3## Configuration
4
5Configure the following two environment variables: `OPENAI_API_KEY` and `EXA_API_KEY`