Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$2?q=api&page=25&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 18048 results for "api"(983ms)

LiveStormMCPREADME.md10 matches

@supagroova•Updated 1 day ago
1# Livestorm API MCP Server
2
3This project creates a Model Context Protocol (MCP) server that wraps the
4Livestorm API, exposing:
5
6- GET endpoints as Resources
9## How it works
10
111. The server fetches and parses the Livestorm API's OpenAPI definition
122. It dynamically creates MCP Resources and Tools based on the API endpoints
133. When a client requests a Resource or Tool, the server proxies the request to
14 the Livestorm API
15
16## MCP Definition
24{
25 "mcpServers": {
26 "livestorm-api": {
27 "type": "streamable-http",
28 "url": "https://supagroova--7fab7ae4322911f080e9569c3dd06744.web.val.run/mcp",
38{
39 "mcpServers": {
40 "livestorm-api": {
41 "type": "sse",
42 "serverUrl": "https://supagroova--7fab7ae4322911f080e9569c3dd06744.web.val.run/sse"
49
50- `index.ts`: Main entry point with HTTP trigger
51- `livestorm.ts`: Functions to fetch and parse the OpenAPI definition
52- `mcp.ts`: MCP server setup and configuration
53
67RUN_LOCAL=1
68PORT=8787
69LIVESTORM_API_TOKEN=your-livestorm-api-token-here
70```
71
72This is useful for API tokens and local configuration.
73
74You can run this MCP server locally using the [Deno](https://deno.land/)

LiveStormMCPcreate_event_endpoint.json4 matches

@supagroova•Updated 1 day ago
10 "security": [
11 {
12 "api_key": []
13 },
14 {
21 "description": "Created",
22 "content": {
23 "application/vnd.api+json": {
24 "schema": {
25 "type": "object",
207 },
208 "examples": {
209 "application/vnd.api+json": {
210 "value": {
211 "data": {
343 "requestBody": {
344 "content": {
345 "application/vnd.api+json": {
346 "schema": {
347 "type": "object",

LiveStormMCPtypes.ts3 matches

@supagroova•Updated 1 day ago
1
2// Types for OpenAPI schema
3export interface OpenApiSchema {
4 paths: Record<string, PathItem>;
5 // Other OpenAPI properties we might need
6}
7

LiveStormMCPmcp.ts16 matches

@supagroova•Updated 1 day ago
6 extractGetEndpoints,
7 extractMutationEndpoints,
8 fetchOpenApiSpec,
9 proxyRequest,
10} from "../src/livestorm.ts";
28
29/**
30 * Sets up the MCP server with resources and tools based on the Livestorm API
31 * Uses a cached instance if available
32 */
39 // Create a new MCP server
40 const server = new McpServer({
41 name: "livestorm-api-server",
42 version: "1.0.0",
43 description: "MCP server that provides access to Livestorm API endpoints",
44 }, { capabilities: { logging: {} } });
45
46 try {
47 console.log("Fetching Livestorm API OpenAPI spec...");
48 // Fetch the OpenAPI spec
49 const openApiSpec = await fetchOpenApiSpec();
50
51 // Extract GET endpoints (Resources)
52 const getEndpoints = extractGetEndpoints(openApiSpec);
53
54 // Extract mutation endpoints (Tools)
55 const mutationEndpoints = extractMutationEndpoints(openApiSpec);
56
57 // Register Resources
127 }
128
129 // Make the request to the Livestorm API
130 const response = await proxyRequest(
131 path,
137 const errorText = await response.text();
138 throw new Error(
139 `Livestorm API error: ${response.status} ${response.statusText} - ${errorText}`,
140 );
141 }
236 }
237
238 // Make the request to the Livestorm API
239 const response = await proxyRequest(
240 path,
247 const errorText = await response.text();
248 throw new Error(
249 `Livestorm API error: ${response.status} ${response.statusText} - ${errorText}`,
250 );
251 }
283
284/**
285 * Creates a tool schema from an OpenAPI operation
286 * Returns an object with input and output schemas using Zod
287 *
314
315 const requestSchema = operation.requestBody
316 ?.content["application/vnd.api+json"]?.schema;
317 const responseSchema = operation.responses["201"]
318 ?.content["application/vnd.api+json"]?.schema?.properties?.data.allOf[1];
319
320 // Iterate through the schema elements and add those to the inputSchema as Zod types

LiveStormMCPlivestorm.ts34 matches

@supagroova•Updated 1 day ago
1import "https://deno.land/std@0.224.0/dotenv/load.ts";
2import { parse as parseYaml } from "https://esm.sh/yaml@2.3.1";
3import { OpenApiSchema, OperationObject } from "./types.ts";
4import { blob } from "https://esm.town/v/std/blob";
5import { ValTownBlobNotFoundError } from "https://esm.town/v/std/ValTownBlobNotFoundError";
6import { ValTownBlobError } from "https://esm.town/v/std/ValTownBlobError";
7
8// URL of the Livestorm API OpenAPI definition
9const LIVESTORM_API_SPEC_URL =
10 "https://api.livestorm.co/api-docs/v1/swagger.yaml";
11const LIVESTORM_API_BASE_URL = "https://api.livestorm.co/v1";
12
13// Cache key for storing the OpenAPI spec in Blob storage
14const OPENAPI_SPEC_CACHE_KEY = "livestorm-openapi-spec";
15
16/**
17 * Fetches the Livestorm API OpenAPI definition
18 */
19export async function fetchOpenApiSpec(): Promise<OpenApiSchema> {
20 try {
21 // Check if the OpenAPI spec is cached in Blob storage
22 let response;
23 try {
24 response = await blob.get(OPENAPI_SPEC_CACHE_KEY);
25 console.log(`Using cached OpenAPI spec from Blob storage`);
26 } catch (e) {
27 if (
28 e instanceof ValTownBlobNotFoundError || e instanceof ValTownBlobError
29 ) {
30 console.log(`Fetching OpenAPI spec from ${LIVESTORM_API_SPEC_URL}...`);
31 response = await fetch(LIVESTORM_API_SPEC_URL);
32 if (!response.ok) {
33 const errorText = await response.text();
34 console.error(
35 `Failed to fetch OpenAPI spec: ${response.status} ${response.statusText}`,
36 );
37 console.error(`Response body: ${errorText}`);
38 throw new Error(
39 `Failed to fetch OpenAPI spec: ${response.status} ${response.statusText}`,
40 );
41 }
46
47 const yamlText = await response.text();
48 let parsedSpec: OpenApiSchema;
49 try {
50 parsedSpec = parseYaml(yamlText);
51 // Validate the parsed spec has the expected structure
52 if (!parsedSpec || !parsedSpec.paths) {
53 throw new Error("Invalid OpenAPI spec: missing paths property");
54 }
55 } catch (parseError) {
56 console.error("Error parsing OpenAPI spec YAML:", parseError);
57 throw new Error(
58 `Failed to parse OpenAPI spec: ${
59 parseError instanceof Error ? parseError.message : String(parseError)
60 }`,
62 }
63
64 // Cache the OpenAPI spec in Blob storage
65 try {
66 await blob.set(OPENAPI_SPEC_CACHE_KEY, yamlText);
67 } catch (e) {
68 console.error("Error caching OpenAPI spec:", e);
69 }
70
71 return parsedSpec;
72 } catch (error) {
73 console.error("Error fetching OpenAPI spec:", error);
74 throw error;
75 }
77
78/**
79 * Extracts GET endpoints from the OpenAPI spec
80 */
81export function extractGetEndpoints(spec: OpenApiSchema) {
82 const getEndpoints: Record<
83 string,
99
100/**
101 * Extracts POST, PUT, DELETE endpoints from the OpenAPI spec
102 */
103export function extractMutationEndpoints(spec: OpenApiSchema) {
104 const mutationEndpoints: Record<
105 string,
148
149/**
150 * Proxies a request to the Livestorm API
151 */
152export async function proxyRequest(
157): Promise<Response> {
158 // Replace path parameters in the URL
159 let url = `${LIVESTORM_API_BASE_URL}${path}`;
160
161 // Extract path parameters and replace them in the URL
193
194 // Forward the Authorization header
195 const authHeader = Deno.env.get("LIVESTORM_API_TOKEN");
196 if (!authHeader) {
197 throw new Error(
198 "Authorization header is required for Livestorm API requests",
199 );
200 }
222
223 try {
224 // Make the request to Livestorm API
225 const response = await fetch(url, requestOptions);
226
230 console.error(`Error proxying request to ${url}:`, error);
231 throw new Error(
232 `Failed to proxy request to Livestorm API: ${
233 error instanceof Error ? error.message : String(error)
234 }`,

Cinetwaindex.ts5 matches

@eddie_walk•Updated 2 days ago
27});
28
29// API endpoint for contact form submissions (example)
30app.post("/api/contact", async c => {
31 try {
32 const formData = await c.req.json();
51});
52
53// API endpoint for get involved form submissions (example)
54app.post("/api/get-involved", async c => {
55 try {
56 const formData = await c.req.json();
71
72// Health check endpoint
73app.get("/api/health", c => {
74 return c.json({ status: "ok", timestamp: new Date().toISOString() });
75});

untitled-3016index.ts3 matches

@Mouhak•Updated 2 days ago
15await runMigrations();
16
17// API routes
18app.route("/api/jobs", jobsRouter);
19app.route("/api/chat", chatRouter);
20
21// Serve static files

untitled-3016ChatRoom.tsx5 matches

@Mouhak•Updated 2 days ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState, useEffect, useRef } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
3import type { ChatMessage, ApiResponse } from "../../shared/types.ts";
4
5export default function ChatRoom() {
19 try {
20 setLoading(true);
21 const response = await fetch('/api/chat/messages');
22 const result: ApiResponse<ChatMessage[]> = await response.json();
23
24 if (result.success && result.data) {
46
47 try {
48 const response = await fetch('/api/chat/messages', {
49 method: 'POST',
50 headers: {
57 });
58
59 const result: ApiResponse<ChatMessage> = await response.json();
60
61 if (result.success && result.data) {

untitled-3016JobForm.tsx3 matches

@Mouhak•Updated 2 days ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
3import type { Job, ApiResponse } from "../../shared/types.ts";
4
5interface JobFormProps {
25
26 try {
27 const response = await fetch('/api/jobs', {
28 method: 'POST',
29 headers: {
33 });
34
35 const result: ApiResponse<Job> = await response.json();
36
37 if (result.success && result.data) {

untitled-3016JobBoard.tsx5 matches

@Mouhak•Updated 2 days ago
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0?deps=react@18.2.0";
3import type { Job, ApiResponse } from "../../shared/types.ts";
4import JobForm from "./JobForm.tsx";
5
13 try {
14 setLoading(true);
15 const response = await fetch('/api/jobs');
16 const result: ApiResponse<Job[]> = await response.json();
17
18 if (result.success && result.data) {
40
41 try {
42 const response = await fetch(`/api/jobs/${jobId}`, {
43 method: 'DELETE'
44 });
45 const result: ApiResponse<boolean> = await response.json();
46
47 if (result.success) {

Apiify11 file matches

@wolf•Updated 8 hours ago

dailyQuoteAPI

@Souky•Updated 2 days ago
Kapil01
apiv1