Wire up reactDocgen parsing to component documentation tool#38
Merged
Conversation
🦋 Changeset detectedLatest commit: fc83cd1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
- Add reactDocgen field to ComponentManifest type - Import and use parseReactDocgen in format-manifest - Format props section with XML structure including all optional fields - Add comprehensive tests for props formatting - All tests passing with 100% coverage on format-manifest.ts Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
- Document Component Manifest and ReactDocgen support section - Add details about parsing and formatting flow - Include XML output format examples - Update file structure to reflect current state - Update key components list Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
- Test that props section is included when reactDocgen is present - Verify end-to-end flow from manifest to XML output - All 67 tests passing with >91% coverage Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add parsing support for reactDocgen in component manifest
Wire up reactDocgen parsing to component documentation tool
Oct 24, 2025
…t/add-react-docgen-support
commit: |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR integrates reactDocgen parsing functionality into the @storybook/mcp package, enabling the get-component-documentation tool to display React component prop information in a structured XML format. The changes wire up the previously added parsing utilities to the component documentation workflow, making prop metadata accessible to AI agents.
Key changes:
- Added
reactDocgenfield toComponentManifestschema for accepting react-docgen output - Enhanced XML formatting to include
<props>sections with detailed prop metadata - Added comprehensive test coverage (6 new tests) verifying the integration
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/mcp/src/utils/parse-react-docgen.ts | Consolidated import statements for react-docgen types |
| packages/mcp/src/utils/format-manifest.ts | Added logic to parse and format reactDocgen data into XML props section |
| packages/mcp/src/utils/format-manifest.test.ts | Added 5 unit tests covering various prop formatting scenarios |
| packages/mcp/src/types.ts | Updated ComponentManifest schema to include optional reactDocgen field |
| packages/mcp/src/tools/get-component-documentation.test.ts | Added integration test verifying end-to-end reactDocgen flow |
| packages/mcp/fixtures/*.json | Updated fixture data to use react-docgen format instead of JSON schema |
| packages/addon-mcp/package.json | Bumped version and specified minimum Storybook version |
| packages/addon-mcp/README.md | Enhanced documentation with component documentation tools section |
| packages/addon-mcp/CHANGELOG.md | Added changelog entry for version 0.0.9 |
| README.md | Updated testing documentation and added debugging instructions |
| .github/instructions/mcp.instructions.md | Added comprehensive ReactDocgen support documentation |
JReinhold
approved these changes
Oct 24, 2025
kasperpeulen
approved these changes
Oct 27, 2025
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.
This PR integrates the
reactDocgenparsing functionality (added in #37) into the@storybook/mcppackage architecture, enabling theget-component-documentationtool to display React component prop information in a structured XML format.What changed
Type System
Added an optional
reactDocgenfield to theComponentManifestvalibot schema to accept raw react-docgen output from Storybook's component analysis.XML Formatting
Enhanced
formatComponentManifest()to generate a<props>section whenreactDocgenis present:The formatting includes all optional fields (type, required, default, description) only when they have defined values, providing AI agents with rich component prop metadata.
Testing
format-manifest.test.tscovering various scenarios (full props, minimal props, missing reactDocgen)get-component-documentation.test.tsverifying end-to-end flowDocumentation
Updated Copilot instructions with a comprehensive "Component Manifest and ReactDocgen Support" section explaining:
Why this matters
This enhancement allows AI agents using the MCP server to access detailed React component prop information, including TypeScript types, default values, required status, and descriptions. This makes it significantly easier for agents to understand component APIs and generate correct usage examples.
Verification
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.