Skip to content

feat(cli): built-in MCP server#2661

Merged
antfu merged 2 commits into
mainfrom
feat/mcp-server
Jul 10, 2026
Merged

feat(cli): built-in MCP server#2661
antfu merged 2 commits into
mainfrom
feat/mcp-server

Conversation

@antfubot

@antfubot antfubot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Docs: https://sli.dev/features/mcp

Summary

Adds a built-in MCP (Model Context Protocol) server so AI agents can inspect, edit, reorder, and navigate a Slidev deck through structured tools instead of raw text edits.

This follows up on the discussion in #2640: rather than a standalone Python slide-reorder script, this keeps everything in the JS ecosystem and reuses the existing @slidev/parser, and — as suggested there — brings tool support to the CLI and the web server.

The same tool set is served two ways:

  • Dev server — streamable HTTP at http://localhost:<port>/__mcp. Because the server is live, it also exposes a slidev-goto-slide tool that drives the presentation in all connected browsers, and edits hot-reload instantly.
  • Stdio — a standalone slidev mcp [entry] command that operates on the markdown files directly, no dev server required.

Enabled by default in dev; disable with mcp: false in the headmatter.

Tools

All tools are prefixed with slidev-.

Tool Description
slidev-get-info Deck overview: entry, title, slide count, markdown files, server URL, current position
slidev-list-slides All slides with number, title, layout, source file
slidev-get-slide Full source of one slide: frontmatter, content, note
slidev-update-slide Update content, note, and/or frontmatter of a slide
slidev-insert-slide Insert a new slide after an existing one
slidev-remove-slide Remove a slide
slidev-move-slide Move a slide before/after another to reorder the deck
slidev-goto-slide Navigate the live presentation to a slide (dev server only)

Slides are addressed by their rendered 1-based number. Structural ops are built on the parser so Slidev's compound separators (---\nlayout: x\n---) are handled correctly, and they respect file boundaries (slides imported via src: are edited in their own file; the entry's first slide — the deck headmatter — is protected from removal/moves).

This PR was created with the help of an AI agent.

Expose Slidev's parser and slide operations to AI agents through a Model
Context Protocol server, so any MCP-capable agent can inspect, edit,
reorder, and navigate a deck through structured tools instead of raw
text edits.

The same tool set is served two ways:

- over the dev server at `/__mcp` (streamable HTTP), which also enables
  a `goto-slide` tool that drives the live presentation and hot-reloads
  edits into connected browsers
- as a standalone `slidev mcp [entry]` stdio command that operates on
  the markdown files directly, without a running dev server

Tools cover reading (deck info, slide list, slide source), editing
(content/note/frontmatter), and structural operations (insert, remove,
move) built on `@slidev/parser` so Slidev's compound separators are
handled correctly. Can be disabled with `mcp: false` in the headmatter.

This supersedes the Python slide-reorder script from #2640, keeping
everything in the JS ecosystem and reusing the existing parser.
@netlify

netlify Bot commented Jul 10, 2026

Copy link
Copy Markdown

Deploy Preview for slidev ready!

Name Link
🔨 Latest commit dbb3a44
🔍 Latest deploy log https://app.netlify.com/projects/slidev/deploys/6a50437ab4514b0008804882
😎 Deploy Preview https://deploy-preview-2661--slidev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@slidev/client

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/client@2661

create-slidev

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev@2661

create-slidev-theme

npm i https://pkg.pr.new/slidevjs/slidev/create-slidev-theme@2661

@slidev/parser

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/parser@2661

@slidev/cli

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/cli@2661

@slidev/types

npm i https://pkg.pr.new/slidevjs/slidev/@slidev/types@2661

commit: dbb3a44

@antfu antfu changed the title feat(cli): built-in MCP server for AI agents feat(cli): built-in MCP server Jul 10, 2026
@antfu
antfu merged commit 04a9eff into main Jul 10, 2026
21 checks passed
@antfu
antfu deleted the feat/mcp-server branch July 10, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants