An agent-native CMS that allows AI clients to read and write MDX content, manage schemas, and execute typed functions via MCP.
Also known as AndersonDesign1/graft, @usegraft/compiler, @usegraft/contracts, @usegraft/core, @usegraft/db
- Stars
- 3
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 14, 2026
- License
- MIT
What is Graft MCP?
Graft is an agent-native CMS that allows AI clients to read and write MDX content, manage schemas, and execute typed functions via MCP.
Summary generated from the project's README
About Graft MCP server
Managing content, schemas, and logic through an agent-native interface is what Graft enables for developers building modern websites. Instead of using a traditional dashboard, this system uses a filesystem and Zod-typed schemas to treat content as code. AI clients can interact with your project via MCP using stdio or Streamable HTTP, allowing them to read and write MDX files, manage schemas, and execute typed functions directly.
Users can start with a zero-service setup where content is compiled into a SQLite artifact for deployment on platforms like Vercel or Netlify. For more complex needs involving operational data like orders or comments, the system can transition to a Postgres backend. This transition provides advanced features such as rate limits, audit trails, and copy-on-write preview branches.
Security is a core focus, as all destructive operations require human approval through a specific gate. An agent can trigger a request, but a human must run the approve command to finalize the change. This ensures that while an AI has the same operator surface as a human, it cannot bypass established access rules or approve its own destructive actions.
What you can do with it
- 1Automated content managementAn AI agent can directly edit MDX files and manage content schemas within your repository.
- 2Schema introspection for AIAn AI client can understand your data structures without guessing by using the describe_schema tool.
- 3Human-gated destructive editsDevelopers can allow agents to propose changes while requiring manual intervention for any high-risk operations.
- 4Scaling from static to dynamicYou can move from a simple SQLite-based static site to a full Postgres database when your application requires operational data.
Written from the project's README. Every use case is checked against a quote from it.
How to install Graft MCP
Formats verified 10 Nov 2026Add to CursorAdd to GooseInstall Graft MCP in Claude Code
$ claude mcp add graft -- npx -y @usegraft/compilerInstall Graft MCP in Cursor
~/.cursor/mcp.json
{
"mcpServers": {
"graft": {
"command": "npx",
"args": [
"-y",
"@usegraft/compiler"
]
}
}
}Install Graft MCP in VS Code
.vscode/mcp.json
{
"servers": {
"graft": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@usegraft/compiler"
]
}
}
}Install Graft MCP in VS Code CLI
$ code --add-mcp '{"name":"graft","type":"stdio","command":"npx","args":["-y","@usegraft/compiler"]}'Install Graft MCP in Claude Desktop
claude_desktop_config.json
{
"mcpServers": {
"graft": {
"command": "npx",
"args": [
"-y",
"@usegraft/compiler"
]
}
}
}Install Graft MCP in Codex
$ codex mcp add graft -- npx -y @usegraft/compilerInstall Graft MCP in Codex config.toml
~/.codex/config.toml
[mcp_servers.graft] command = "npx" args = ["-y", "@usegraft/compiler"]
Install Graft MCP in Gemini CLI
$ gemini mcp add -s user graft npx -- -y @usegraft/compilerInstall Graft MCP in Gemini settings.json
~/.gemini/settings.json
{
"mcpServers": {
"graft": {
"command": "npx",
"args": [
"-y",
"@usegraft/compiler"
]
}
}
}Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the code and give the server the narrowest access it needs. How checks work
- Source repository linked and reachableandersondesign1/graft is public and reachablegithub.com/andersondesign1/graft ↗Pass
- Package names this repository as its source@usegraft/compiler, @usegraft/contracts name andersondesign1/graft as sourcenpmjs.com/package/@usegraft/compiler ↗Pass
- Build provenance (Sigstore attestation)Sigstore attestation for @usegraft/compiler, @usegraft/contractsnpmjs.com/package/@usegraft/compiler/v/1.0.0-beta.9#provenan ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-13github.com/andersondesign1/graft ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNo popular package one edit away from @usegraft/compiler, @usegraft/contracts, @usegraft/core, @usegraft/db, @usegraft/mdx-safetyPass
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubMost content systems put a dashboard between you and your content. Graft puts a schema and a filesystem there instead, then gives an agent the same operator surface a human gets.
Authored content is MDX in git. Your schema is a Zod-typed defineCollection
call. The queryable index is derived, so when git and the index disagree, git
wins and the compiler rebuilds. Everything a human can do in the optional
Studio, an agent can do over MCP or the CLI, under the same access rules, the
same audit trail, and the same human gate on anything destructive.
Start with no database
A content project needs no services at all. graft compile writes the index to
a SQLite artifact, and your app reads it embedded.
npx @usegraft/cli@latest init # schema, content/, llms.txt
npx @usegraft/cli@latest compile # writes .graft/index.db
import { openStaticIndex } from "@usegraft/db";
import { createClient } from "@usegraft/sdk-core";
import { collections } from "./graft.config";
const index = await openStaticIndex(".graft/index.db");
const graft = createClient({ index, collections });
const home = await graft.getDocument("pages", "home");
// ^? typed by your pages collection. No codegen step.
The artifact is derived from the files in git, so it is git-ignored and rebuilt
in your build command: graft compile && next build. Preview branches are git
branches, and each checkout compiles its own index. Full-text search comes with
it, because search is a property of the artifact.
That deploys to Vercel, Netlify, or Cloudflare Pages with nothing attached.
Add Postgres when you need it
Postgres buys operational data (orders, submissions, comments), typed functions with auth, audit, rate limits, and approvals, and copy-on-write preview branches.
# set DATABASE_URL, then change one line: export const index = "postgres"
npx @usegraft/cli@latest db migrate
npx @usegraft/cli@latest compile
Graft tells you the moment you need it. Reaching for a Postgres-tier feature in
static mode fails with NEEDS_DATABASE, and that error's fix field is the two
commands above.
Agents operate it
graft mcp serves your project over MCP, on stdio or Streamable HTTP. An agent
reads your real schema through describe_schema instead of guessing at it, and
every error it can hit carries a fix it can act on.
// .mcp.json
{ "mcpServers": { "graft": { "command": "npx", "args": ["-y", "@usegraft/cli@latest", "mcp"] } } }
The agent surface is not a subset of the human one. It reads and writes content, uploads assets, browses and installs registry primitives, runs typed functions, and compiles. What an agent cannot do is decide its own approval.
Destructive operations are human-gated under every policy. The call returns 403
with a pending approval id, a human runs graft approve <id>, and the caller
retries carrying that id. The deciding identity is derived from the verified
caller and never read from the request, so no argument exists that an agent
could set to approve itself. On Postgres, graft harden moves that guarantee
below the application: the runtime role holds no UPDATE on approvals, which
puts pending → approved out of reach even through raw SQL.
Primitives you own
graft add copies a primitive's files into your repository, shadcn-style. You
own the copy and edit it like the rest of your code. No version of it sits in
node_modules to fight with.
graft add commerce
Available today: seo, callout, faq, scoped-access, comments, and
commerce (file-authoritative products, database-authoritative orders, and the
place, list, update, and cancel functions).
Read it from your framework
| Package | Framework |
|---|---|
@usegraft/sdk-next |
Next.js. React.cache-deduped reads, revalidateContent, and MdxBody |
@usegraft/sdk-astro |
Astro. Typed reads, graftRoute endpoint mounts, and MdxContent |
@usegraft/sdk-sveltekit |
SvelteKit. Typed reads, graftRoute for +server.ts, and MdxContent |
@usegraft/sdk-tanstack-start |
TanStack Start. Typed reads, graftRoute for server routes, and MdxContent |
@usegraft/sdk-react-router |
React Router 7 and 8, framework mode. Typed reads, loader/action mounts, and MdxContent |
@usegraft/sdk-nuxt |
Nuxt 4.6+ and 5. A module: page composables, useGraft(), routes |
@usegraft/sdk-nitro |
Nitro 3. Typed reads plus graftHandler for h3 1 and 2 |
@usegraft/sdk-react |
The browser. Reads over HTTP, plus hooks |
@usegraft/sdk-vue |
Vue. Reads over HTTP, composables, and MDX rendering |
@usegraft/sdk-core |
Anything else. The typed client the others wrap |
To start a new site in one of these instead, run
npm create graft@latest my-site -- --framework <name> with next, nuxt,
sveltekit, astro, react-router or tanstack-start.
Every adapter is typed structurally, so none of them depends on the framework it
adapts. The exception is sdk-nuxt, which is a Nuxt module and builds on
@nuxt/kit. sdk-react and sdk-vue are the ones that do not read a database: they read a
@usegraft/content-api endpoint over HTTP, because a
Postgres handle in a browser bundle is a database URL in a browser bundle.
Telemetry
None. Graft collects no analytics, sends no usage pings, and phones home from no command. The only network calls it makes are the ones your project configures: your database, your asset store, and, when you use them, Neon's branching API and your OIDC issuer.
Packages
| Package | Purpose |
|---|---|
@usegraft/core |
Schema (defineCollection), typed functions, access, the function runtime |
@usegraft/compiler |
Validate authored MDX and project it into the index |
@usegraft/db |
Postgres client, migrations, the static SQLite index, copy-on-write branches |
@usegraft/contracts |
Error codes and introspection schemas every package shares |
@usegraft/sdk-core |
Framework-agnostic typed read client and the cache-tag contract |
@usegraft/content-api |
Read-only HTTP transport for the authored-content index |
@usegraft/sdk-next |
Next.js adapter |
@usegraft/sdk-astro |
Astro adapter |
@usegraft/sdk-sveltekit |
SvelteKit adapter |
@usegraft/sdk-tanstack-start |
TanStack Start adapter |
@usegraft/sdk-react-router |
React Router 7 and 8 adapter, framework mode |
@usegraft/sdk-nuxt |
Nuxt module, for Nuxt 4.6+ and Nuxt 5 |
@usegraft/sdk-nitro |
Nitro adapter, for Nitro 3 and Nuxt apps that mount their own routes |
@usegraft/sdk-react |
Browser client and hooks over the content API |
@usegraft/sdk-vue |
Vue client, composables and MDX rendering over the content API |
@usegraft/cli |
The graft command |
@usegraft/mcp |
The agent surface: content, functions, introspection |
@usegraft/studio |
The optional editing UI and approval queue |
@usegraft/registry |
The registry behind graft add |
@usegraft/auth |
OIDC verification, actor resolution, scope checks |
@usegraft/assets |
S3-compatible storage and agent upload primitives |
@usegraft/mdx-safety |
Refuses executable constructs in authored MDX |
@usegraft/content-migrations |
Codemod-style transforms for authored content |
@usegraft/tokens |
The design tokens the Studio and examples share |
Self-host
One image runs the whole backend: Postgres, MinIO, and graft serve.
docker run -p 3903:3903 -v "$PWD:/project" graft
It migrates, compiles, and serves, then logs a generated bearer token. Anonymous
MCP is never exposed. It serves under a hardened role wherever it owns its own
database. Adapters for Railway, Fly, a plain VPS, and Vercel live in
deploy/.
Documentation
- Getting started
- The model, and why content is code
- The agent surface
- Architecture decisions, each stating the premise it rests on
- Design notes from the de-risking spikes
Status
Pre-1.0. Packages are published under @usegraft/*, and the API can still change
between minors when the change buys a better design. Every break is described in
the changelog and in the pull request that makes it.
Contributing
Start with CONTRIBUTING.md. Engineering conventions live in
CONVENTIONS.md.
Report a vulnerability through SECURITY.md, never a public
issue. This project follows the Contributor Covenant.
License
MIT. See LICENSE.
Graft MCP questions
How do I add Graft MCP to Claude Code?
Run claude mcp add graft -- npx -y @usegraft/compiler in your terminal. Add --scope user to make it available in every project.
How do I add Graft MCP to Cursor?
Open ~/.cursor/mcp.json and add the server under mcpServers, using the Cursor config shown in the install section above.
How can an agent interact with Graft?
An agent can use the MCP server to read and write content, upload assets, browse registry primitives, run typed functions, and compile the project.
Does Graft require a database to start?
No, you can start with no database by compiling your content into a SQLite artifact that your app reads embedded.
How are destructive operations handled for agents?
Destructive operations are human-gated; the agent receives a 403 error with a pending approval ID that a human must authorize using the CLI.