Skip to main content
Glama

Model Control Protocol Server (MCP)

by zueai
index.ts728 B
import { WorkerEntrypoint } from "cloudflare:workers" import { ProxyToSelf } from "workers-mcp" export default class MyWorker extends WorkerEntrypoint<Env> { /** * Gets n random programming jokes using the JokeAPI. * @param n {number} the number of jokes to get. * @return {Promise<any>} the response from the JokeAPI. */ async getJokes(n: number) { const response = await fetch( `https://v2.jokeapi.dev/joke/Programming?amount=${n}` ) const data = await response.json() return { content: [ { type: "text", text: JSON.stringify(data, null, 2) } ] } } /** * @ignore **/ async fetch(request: Request): Promise<Response> { return new ProxyToSelf(this).fetch(request) } }

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/zueai/create-mcp'

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