feat(cli): built-in MCP server#2661
Merged
Merged
Conversation
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.
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
http://localhost:<port>/__mcp. Because the server is live, it also exposes aslidev-goto-slidetool that drives the presentation in all connected browsers, and edits hot-reload instantly.slidev mcp [entry]command that operates on the markdown files directly, no dev server required.Enabled by default in dev; disable with
mcp: falsein the headmatter.Tools
All tools are prefixed with
slidev-.slidev-get-infoslidev-list-slidesslidev-get-slideslidev-update-slideslidev-insert-slideslidev-remove-slideslidev-move-slideslidev-goto-slideSlides 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 viasrc: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.