Skip to content

feat(core): add byline management MCP tools#1564

Open
ascorbic wants to merge 1 commit into
mainfrom
feat/mcp-byline-tools
Open

feat(core): add byline management MCP tools#1564
ascorbic wants to merge 1 commit into
mainfrom
feat/mcp-byline-tools

Conversation

@ascorbic

@ascorbic ascorbic commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds byline (author/contributor credit) management to the MCP server, and lets content_create attach bylines at creation time.

New tools (mirroring the taxonomy tool pattern and the REST /api/admin/bylines routes):

  • byline_list — paginated, filter by search / isGuest / userId / locale
  • byline_get — fetch one by id
  • byline_create / byline_update / byline_delete
  • byline_translations — locale variants via the shared translation group

content_create now accepts bylines — previously only content_update did, so creating a credited item over MCP took two calls. The handler already supported it; the tool just wasn't forwarding it (and the EmDashHandlers create type was missing the field).

Authorization: reads gate on content:read (consistent with content_list/taxonomy_list); writes on content:write + requireRole(EDITOR), which matches the bylines:manage permission floor and the established menus/taxonomies scope-grant pattern (there is no dedicated byline token scope). Write tools call invalidateBylineCache() on success, mirroring the REST routes — without it, MCP byline edits would serve stale credits.

Input validation reuses the REST zod schemas (bylineCreateBody/bylineUpdateBody), preserving the httpUrl guard on websiteUrl (rejects javascript:/data: URLs).

Builds on #1563 (merged). Rebased onto main; the diff here is byline-only.

Closes #

Type of change

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 4.8 (Claude Code)

Screenshots / test output

Test Files  20 passed (20)
     Tests  341 passed (341)

New bylines.test.ts covers CRUD round-trips, httpUrl rejection, AUTHOR-denied (INSUFFICIENT_PERMISSIONS), byline_translations, and content_create byline attach on both the draft and publish paths.


Try this PR

Open a fresh playground →

A full working EmDash site, deployed from this branch. Each visit gets its own session-scoped sandbox: no login needed and no shared state. Try the admin, edit content, hit the public site.

Tracks feat/mcp-byline-tools. Updated automatically when the playground redeploys.

@changeset-bot

changeset-bot Bot commented Jun 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bc7c63d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
emdash Minor
@emdash-cms/cloudflare Minor
@emdash-cms/sandbox-workerd Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/do-demo-site Patch
@emdash-cms/do-solo-demo-site Patch
@emdash-cms/admin Minor
@emdash-cms/auth Minor
@emdash-cms/blocks Minor
@emdash-cms/gutenberg-to-portable-text Minor
@emdash-cms/x402 Minor
create-emdash Minor
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
docs bc7c63d Jun 21 2026, 07:23 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-playground bc7c63d Jun 21 2026, 07:23 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 21, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
emdash-demo-cache bc7c63d Jun 21 2026, 07:24 AM

Base automatically changed from fix/mcp-markdown-portable-text to main June 21, 2026 07:18
Add byline_list, byline_get, byline_create, byline_update, byline_delete,
and byline_translations tools to the MCP server, and a `bylines` argument
on content_create so credits can be attached at creation (previously only
content_update accepted them).

Reads gate on content:read; writes on content:write + EDITOR role,
matching the bylines:manage permission floor. Write tools invalidate the
byline cache on success, mirroring the REST routes.
@ascorbic ascorbic force-pushed the feat/mcp-byline-tools branch from e34ca5d to bc7c63d Compare June 21, 2026 07:20
@pkg-pr-new

pkg-pr-new Bot commented Jun 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@1564

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@1564

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@1564

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@1564

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@1564

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@1564

emdash

npm i https://pkg.pr.new/emdash@1564

create-emdash

npm i https://pkg.pr.new/create-emdash@1564

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@1564

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@1564

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@1564

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@1564

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@1564

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@1564

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@1564

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@1564

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@1564

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@1564

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@1564

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@1564

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@1564

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@1564

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@1564

commit: bc7c63d

@ascorbic ascorbic added the bot:review Trigger an emdashbot code review on this PR label Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core bot:review Trigger an emdashbot code review on this PR cla: signed review/needs-review No maintainer or bot review yet size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant