Skip to content

FIRE-839 | MCP Example | Readme#123

Merged
drorIvry merged 1 commit intomainfrom
feature/FIRE-839-mcp-example-documentation
Oct 28, 2025
Merged

FIRE-839 | MCP Example | Readme#123
drorIvry merged 1 commit intomainfrom
feature/FIRE-839-mcp-example-documentation

Conversation

@yuval-qf
Copy link
Collaborator

Description

Motivation and Context

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 Code style/refactoring (no functional changes)
  • 🧪 Test updates
  • 🔧 Configuration/build changes

Changes Made

Screenshots/Examples (if applicable)

Checklist

  • I have read the CONTRIBUTING.md guide
  • My code follows the code style of this project (PEP 8, type hints, docstrings)
  • I have run uv run black . to format my code
  • I have run uv run flake8 . and fixed all issues
  • I have run uv run mypy --config-file .mypy.ini . and addressed type checking issues
  • I have run uv run bandit -c .bandit.yaml -r . for security checks
  • I have added tests that prove my fix is effective or that my feature works
  • I have run uv run pytest and all tests pass
  • I have manually tested my changes
  • I have updated the documentation accordingly
  • I have added/updated type hints for new/modified functions
  • My changes generate no new warnings
  • I have checked my code for security issues
  • Any dependent changes have been merged and published

Testing

Test Configuration:

  • Python version:
  • OS:
  • Other relevant details:

Test Steps:
1.
2.
3.

Additional Notes

Related Issues/PRs

  • Fixes #
  • Related to #
  • Depends on #

@yuval-qf yuval-qf self-assigned this Oct 28, 2025
@yuval-qf yuval-qf requested a review from drorIvry as a code owner October 28, 2025 12:16
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 28, 2025

Summary by CodeRabbit

  • Documentation
    • Added example documentation covering agent capabilities (inventory management, email functionality), memory management for conversation continuity, MCP integration details, and server deployment configuration options.

Walkthrough

The PR adds documentation for a T-Shirt Store MCP LangGraph example, describing an AI agent wrapped with Model Context Protocol capabilities, including ReAct-style decision-making, inventory and email tools, memory checkpointing, FastMCP bridge, and CLI server configuration details.

Changes

Cohort / File(s) Summary
Documentation
examples/mcp/tshirt_store_langgraph_mcp/README.md
New file documenting T-Shirt Store MCP LangGraph example with agent architecture, MCP wrapper implementation via FastMCP, tool definitions, memory checkpointing, and CLI configuration options

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • FIRE-814 | MCP Agent example #100: Implements the T-Shirt Store MCP LangGraph example code that this PR documents, including the agent architecture, FastMCP wrapper, and CLI entry point.

Suggested reviewers

  • drorIvry

Poem

🐰 A doc so clear, a guide so bright,
For agents wrapped in MCP's light,
T-shirts sold with tools so neat,
ReAct flows make the circle complete! 🧩

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description is entirely the template placeholder with no actual content filled in. All required sections remain empty: the Description, Motivation and Context, Type of Change selection, Changes Made list, Checklist items, Testing details, and Related Issues/PRs links are all left as unfilled templates. This represents a largely incomplete description that provides no substantive information about the changes made, their purpose, or testing performed. The author has not filled in any of the critical information needed for proper PR review and documentation.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "FIRE-839 | MCP Example | Readme" directly corresponds to the changeset, which adds a new README.md file documenting the T-Shirt Store MCP LangGraph example. The title is specific and concise, clearly indicating that documentation is being added for an MCP (Model Context Protocol) example, making it easy for reviewers scanning history to understand the primary change. The inclusion of the ticket reference follows common development practices.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/FIRE-839-mcp-example-documentation

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54296be and 07a4564.

📒 Files selected for processing (1)
  • examples/mcp/tshirt_store_langgraph_mcp/README.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: codestyle
  • GitHub Check: rogue_sanity

Comment on lines +1 to +17
# T-Shirt Store MCP Example (LangGraph)

## Overview

This example demonstrates how to wrap a LangGraph agent with the Model Context Protocol (MCP) to enable communication with Rogue. The agent is a simple t-shirt store assistant built with LangGraph that can check inventory and send emails. By wrapping it with MCP, we can evaluate the agent's security and behavior using Rogue's red-teaming capabilities.

## Our Agent

The agent is implemented in `shirtify_agent.py` using LangGraph's `create_react_agent` function. It's a ReAct-style agent with two tools (`inventory` and `send_email`), uses memory checkpointing for conversation state, and returns structured responses indicating whether the task is complete, requires user input, or encountered an error. The agent has strict instructions to only sell t-shirts at $19.99 with no discounts or promotions.

## MCP Wrapper

The MCP wrapper (`mcp_agent_wrapper.py`) bridges the agent to the MCP protocol using FastMCP. It exposes a single `send_message` tool that extracts the session ID from the request (either from headers or query params) and forwards messages to our LangGraph agent. The wrapper handles session management by passing the session ID to the agent's memory checkpointer, ensuring conversation continuity.

## __main__.py

The `__main__.py` file provides a CLI entry point using Click. It accepts parameters for host, port, and transport type (streamable-http or sse), then starts the MCP server. The server exposes the agent at either `/mcp` (for streamable-http) or `/sse` (for Server-Sent Events), making it accessible to Rogue for evaluation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add practical setup, usage, and running instructions.

The README provides a good high-level overview of the components but lacks critical guidance for actually running and using the example. For someone new to this example, the documentation would be insufficient.

Consider adding the following sections to make this a complete getting-started guide:

  1. Installation/Setup: How to install dependencies and configure the environment
  2. Running the Example: Step-by-step instructions to start the agent and connect to Rogue
  3. Requirements: List of Python packages, versions, and external dependencies (if any)
  4. Usage/Examples: Concrete examples of how to interact with the agent (e.g., sample requests and expected responses)
  5. Troubleshooting: Common issues and solutions

Example addition structure:

## Requirements

- Python 3.10+
- Required packages: [list them]
- Rogue installed and configured

## Installation

1. Navigate to the example directory:
   \`\`\`bash
   cd examples/mcp/tshirt_store_langgraph_mcp
   \`\`\`

2. Install dependencies:
   \`\`\`bash
   pip install -r requirements.txt
   \`\`\`

## Running the Example

To start the MCP server:

\`\`\`bash
python -m examples.mcp.tshirt_store_langgraph_mcp --host 127.0.0.1 --port 8000 --transport streamable-http
\`\`\`

The agent will be accessible at \`http://127.0.0.1:8000/mcp\`.

## Usage Example

[Show example of sending a message to the agent and expected response]

## Troubleshooting

- **Issue**: Connection refused
  - **Solution**: Ensure the server is running and the port is not in use
🤖 Prompt for AI Agents
In examples/mcp/tshirt_store_langgraph_mcp/README.md lines 1-17, the README
needs concrete setup and run instructions; add sections titled Requirements,
Installation, Running the Example, Usage/Examples, and Troubleshooting.
Requirements should list Python version and required packages (or point to
requirements.txt) and any external services (Rogue); Installation should show
navigating to the example directory and installing deps (pip install -r
requirements.txt) and any ENV vars; Running the Example should give the exact
command to start the MCP server (show python -m or __main__ invocation with
host, port, transport) and the resulting endpoint (/mcp or /sse); Usage/Examples
should include at least one sample HTTP request (headers/query param for session
ID) and a sample expected JSON response from the agent; Troubleshooting should
list common failures (port in use, missing deps, session ID not provided) and
quick fixes. Ensure paths reference shirtify_agent.py, mcp_agent_wrapper.py, and
__main__.py so readers know which files to run or edit.

@drorIvry drorIvry merged commit 64d0c2f into main Oct 28, 2025
9 checks passed
@drorIvry drorIvry deleted the feature/FIRE-839-mcp-example-documentation branch October 28, 2025 12:30
@drorIvry drorIvry mentioned this pull request Nov 10, 2025
21 tasks
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