Skip to main content
Glama

contentful-mcp

space-handlers.ts1.94 kB
import { getContentfulClient } from "../config/client.js" export const spaceHandlers = { listSpaces: async () => { const contentfulClient = await getContentfulClient() const spaces = await contentfulClient.space.getMany({}) return { content: [{ type: "text", text: JSON.stringify(spaces, null, 2) }], } }, getSpace: async (args: { spaceId: string }) => { const spaceId = args.spaceId if (!spaceId) { throw new Error("spaceId is required.") } const contentfulClient = await getContentfulClient() const space = await contentfulClient.space.get({ spaceId }) return { content: [{ type: "text", text: JSON.stringify(space, null, 2) }], } }, listEnvironments: async (args: { spaceId: string }) => { const contentfulClient = await getContentfulClient() const environments = await contentfulClient.environment.getMany({ spaceId: args.spaceId, }) return { content: [{ type: "text", text: JSON.stringify(environments, null, 2) }], } }, createEnvironment: async (args: { spaceId: string; environmentId: string; name: string }) => { const contentfulClient = await getContentfulClient() const environment = await contentfulClient.environment.create( { spaceId: args.spaceId, environmentId: args.environmentId, }, { name: args.name, }, ) return { content: [{ type: "text", text: JSON.stringify(environment, null, 2) }], } }, deleteEnvironment: async (args: { spaceId: string; environmentId: string }) => { const contentfulClient = await getContentfulClient() await contentfulClient.environment.delete({ spaceId: args.spaceId, environmentId: args.environmentId, }) return { content: [ { type: "text", text: `Environment ${args.environmentId} deleted successfully`, }, ], } }, }

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/ivo-toby/contentful-mcp'

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