sqliteExplorerApp1README.md1 match
13## Authentication
1415Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
1617## Todos / Plans
sqliteExplorerApp1main.tsx2 matches
27<head>
28<title>SQLite Explorer</title>
29<link rel="preconnect" href="https://fonts.googleapis.com" />
3031<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32<link
33href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34rel="stylesheet"
35/>
81</time>
82<open-heart
83href={`https://api.oh.dddddddddzzzz.org/github.com/dddddddddzzzz/${question.id}`}
84emoji="❤️"
85>
securityknowledge.md10 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248});
249```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252```ts
285- For files in the project, use `readFile` helpers
2862875. **API Design:**
288- `fetch` handler is the entry point for HTTP vals
289- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
security.cursorrules10 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248});
249```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252```ts
285- For files in the project, use `readFile` helpers
2862875. **API Design:**
288- `fetch` handler is the entry point for HTTP vals
289- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
mcp-starterREADME.md1 match
30## What is the adapter for?
3132The MCP TypeScript SDK uses Node-specific APIs that don't play nicely with Deno
33or edge functions:
34
invest-trackercrypto_news_cron.tsx2 matches
2import { blob } from "https://esm.town/v/std/blob";
34const KEY = Deno.env.get("NEWSDATA")!; // API key
5const KEEP = 20; // store up to 20
6const WINDOW_MIN = 1440; // last 24 h
9/* 1 ─ build query (size 10, English) */
10const q = encodeURIComponent("bitcoin OR btc OR ethereum OR eth OR solana OR sol");
11const url = `https://newsdata.io/api/1/latest?apikey=${KEY}&q=${q}&language=en&size=10`;
1213/* 2 ─ fetch & peek */
ChatHTMLRenderer.tsx23 matches
9}
1011interface MCPContextAPI {
12// Tool operations
13listTools: () => Promise<any[]>;
37* - Renders HTML in a secure iframe
38* - Provides fullscreen enter/exit affordances
39* - Exposes MCP context API to iframe content
40* - Handles iframe communication via postMessage
41*/
47console.log("[MCP/Browser Renderer] HTMLRenderer: Rendering HTML:", { mcpClients });
4849// Create MCP context API that will be exposed to iframe
50const createMCPContext = useCallback((): MCPContextAPI => {
51const findClientByName = (serverName: string) => {
52console.log("[MCP/Browser Renderer] Finding client by name:", serverName, mcpClients);
177const { type, id, method, args } = event.data;
178179if (type !== "mcp-api-call") {
180return;
181}
186187if (typeof methodFunc !== "function") {
188throw new Error(`Unknown MCP API method: ${method}`);
189}
190192193iframe.contentWindow?.postMessage({
194type: "mcp-api-response",
195id,
196success: true,
199} catch (error) {
200iframe.contentWindow?.postMessage({
201type: "mcp-api-response",
202id,
203success: false,
222</script>
223<script>
224// MCP Context API for iframe content
225window.mcpContext = {
226// Async wrapper for postMessage communication
227async callAPI(method, ...args) {
228return new Promise((resolve, reject) => {
229const id = Math.random().toString(36).substr(2, 9);
230
231const handleResponse = (event) => {
232if (event.data.type === 'mcp-api-response' && event.data.id === id) {
233window.removeEventListener('message', handleResponse);
234if (event.data.success) {
243
244window.parent.postMessage({
245type: 'mcp-api-call',
246id,
247method,
252setTimeout(() => {
253window.removeEventListener('message', handleResponse);
254reject(new Error('MCP API call timeout'));
255}, 30000);
256});
258
259// Convenience methods
260async listTools() { return this.callAPI('listTools'); },
261async callTool(serverName, toolName, args) { return this.callAPI('callTool', serverName, toolName, args); },
262async listPrompts() { return this.callAPI('listPrompts'); },
263async getPrompt(serverName, promptName, args) { return this.callAPI('getPrompt', serverName, promptName, args); },
264async listResources() { return this.callAPI('listResources'); },
265async readResource(serverName, uri) { return this.callAPI('readResource', serverName, uri); },
266log(level, message, data) { this.callAPI('log', level, message, data); },
267requestFullscreen() { this.callAPI('requestFullscreen'); },
268exitFullscreen() { this.callAPI('exitFullscreen'); },
269async isFullscreen() { return this.callAPI('isFullscreen'); }
270};
271
1import { getArticle, getAuthor } from "./_api.ts";
2import { createServer } from "./_server.ts";
3
1import { getArticle } from "./_api.ts";
2import { createServer } from "./_server.ts";
3