@usegraft/mcp
v1.0.0-beta.9
Published
An MCP server over your content, schema and typed functions, with errors an agent can act on.
Maintainers
Readme
@usegraft/mcp
An MCP server over your content, schema, and typed functions, with errors an agent can act on.
Part of Graft, a CMS built so an AI agent is the primary operator.
Install
npm i @usegraft/mcpServe on stdio
For .mcp.json and local agents. graft mcp does this for you.
import { createGraftMcp, serveStdio } from "@usegraft/mcp";
const server = createGraftMcp({ contentDir, collections, functions, db });
await serveStdio(server);Serve over HTTP
import { createGraftMcpHandler } from "@usegraft/mcp";
export const POST = createGraftMcpHandler({
contentDir,
collections,
db,
actor: resolveActor,
connectionActor: resolveConnectionActor,
});connectionActor is not optional in practice. Without it every write-tool scope check is silently disabled, so pass it whenever a tool can write.
Tools
Content: list_content, read_content, write_content, delete_content, search_content. Introspection: describe_schema, list_functions, describe_function. Execution: run_function. Registry: list_registry, describe_item. Approvals: list_approvals, decide_approval.
Defaults that fail closed
- Anonymous callers are refused unless explicitly allowed.
write_contentrequires thecontent:writescope, and being authenticated earns nothing on its own.delete_contentis destructive and always human-gated: the first call files an approval and fails with its id.- Authored MDX is refused if it contains
{…}expressions,import,exportor spread attributes, because rendering evaluates MDX as JavaScript on the server.
MIT. Repository · Changelog · Security policy
