Skip to main content
Glama

MCP Svelte Docs Server

# +server.ts Definition **Definition:** Route module that exports HTTP method handlers for endpoints. Runs only on the server. **Syntax:** `src/routes/(...)/+server.ts` (or `.js`) **Parameters:** - `export const GET/POST/PATCH/PUT/DELETE/OPTIONS` — request handlers - `export const fallback` — optional handler for all other methods - `RequestHandler` — type for handlers, with `locals`, `cookies`, etc. **Returns:** Sends a `Response` using Web Fetch APIs or helper `json`. ## Example ```ts import type { RequestHandler } from './$types'; import { json, error } from '@sveltejs/kit'; export const GET: RequestHandler = async ({ url, locals }) => { const id = url.searchParams.get('id'); if (!id) throw error(400, 'id required'); const item = await locals.db.get(id); return json(item); }; ``` ## Related - `json` — helper for JSON responses - `cookies`, `locals` — request utilities - Note: `+layout` options don’t affect `+server` routes - Notes: `HEAD` responses mirror `GET` body length; content negotiation prefers page for Accept: text/html

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/spences10/mcp-svelte-docs'

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