Skip to main content
Glama
cloudflare-worker.ts1.02 kB
/** * Cloudflare Workers Configuration * Deploy serverless functions at the edge */ // wrangler.toml /* name = "my-worker" main = "src/index.ts" compatibility_date = "2024-01-01" [vars] ENVIRONMENT = "production" [[kv_namespaces]] binding = "KV_STORE" id = "your-kv-namespace-id" [[d1_databases]] binding = "DB" database_name = "my-database" database_id = "your-database-id" [observability] enabled = true */ // Example Worker with Hono import { Hono } from "hono"; type Bindings = { KV_STORE: KVNamespace; DB: D1Database; }; const app = new Hono<{ Bindings: Bindings }>(); app.get("/", (c) => c.text("Hello from Cloudflare Workers!")); app.get("/kv/:key", async (c) => { const key = c.req.param("key"); const value = await c.env.KV_STORE.get(key); return c.json({ key, value }); }); app.post("/kv/:key", async (c) => { const key = c.req.param("key"); const { value } = await c.req.json(); await c.env.KV_STORE.put(key, value); return c.json({ success: true }); }); export default app;

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/millsydotdev/Code-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server