Skip to content

Add Protocol Builder tab for session type protocol design#1224

Open
chrisbartoloburlo wants to merge 2 commits intomodelcontextprotocol:mainfrom
chrisbartoloburlo:feature/protocol-builder
Open

Add Protocol Builder tab for session type protocol design#1224
chrisbartoloburlo wants to merge 2 commits intomodelcontextprotocol:mainfrom
chrisbartoloburlo:feature/protocol-builder

Conversation

@chrisbartoloburlo
Copy link
Copy Markdown

@chrisbartoloburlo chrisbartoloburlo commented Apr 23, 2026

Summary

  • Adds a new Protocol Builder tab to the MCP Inspector that lets users visually compose session type protocols from discovered MCP tools
  • Users can drag-and-drop MCP tools and protocol constructs (send, receive, internal/external choice, recursion) to build interaction protocols
  • Generates protocol DSL strings, state machine previews, and ready-to-use Python integration code using llmcontract

Features

  • Tool palette: Lists discovered MCP tools alongside protocol constructs (send, receive, choices, recursion)
  • Visual sequence builder: Compose protocols step-by-step with editable labels, choice branches, and recursion points
  • Live DSL output: Syntax-highlighted protocol string updates in real-time as the user builds
  • State machine preview: Visual FSM representation of the composed protocol
  • Python code generation: One-click generation of llmcontract monitor + middleware integration code
  • Export: Download generated protocol files

Test plan

  • Verify the Protocol Builder tab appears after the Metadata tab
  • Connect to an MCP server and confirm discovered tools appear in the tool palette
  • Build a protocol using send/receive steps and verify DSL output
  • Add internal/external choice constructs and verify branch handling
  • Add recursion and verify the DSL includes rec X. ...X... syntax
  • Verify the state machine preview renders correctly
  • Verify the Python code snippet is syntactically valid
  • Test the download/export functionality
  • Verify no TypeScript build errors (npm run build-client)

🤖 Generated with Claude Code

chrisbartoloburlo and others added 2 commits April 23, 2026 12:31
Adds a new "Protocol Builder" tab to the MCP Inspector that lets users
visually compose interaction protocols from discovered MCP tools using
session type theory. Features:

- Discovers tools via tools/list and presents them as clickable blocks
- Supports send (!), receive (?), internal/external choice, and recursion
- Live DSL output with syntax highlighting
- State machine visualization
- Generates Python integration code using llmcontract
- Export/download protocol as Python file

This enables runtime protocol monitoring for LLM agent interactions,
ensuring tools are called in the correct order per a defined contract.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…M preview

- Add convert-to-choice buttons on PairCard: convert ! to !{} or ? to ?{}
  inline, keeping the partner as a standalone step
- ? to ?{} auto-populates branches with {sendLabel}Result and {sendLabel}Error
- ! to !{} populates branches with available MCP tool names
- Rewrite parseToFSM to correctly model choices as branching from same state
- Update StateMachinePreview to show branching visually with grouped transitions
- Fix recursion (rec X.) not being terminal — only loop-back refs terminate
- Support hyphens in DSL identifiers for MCP tool name compatibility
- Fix nested convert-to-choice crash (wrong variable name in recursive call)
- Fix package name: llmcontract -> llmsessioncontract
- Add example agent using MCP server-everything tools (echo, get-sum)
- Register protocol-builder tab in all validTabs arrays

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chrisbartoloburlo
Copy link
Copy Markdown
Author

@claude review

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.

1 participant