Skip to content

Add STDIO MCP documentation and update navigation menu#472

Merged
MervinPraison merged 1 commit intomainfrom
develop
May 13, 2025
Merged

Add STDIO MCP documentation and update navigation menu#472
MervinPraison merged 1 commit intomainfrom
develop

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

@MervinPraison MervinPraison commented May 13, 2025

PR Type

Documentation


Description

  • Add comprehensive documentation for MCP STDIO integration.

  • Provide step-by-step quick start and code examples.

  • Update navigation menu to include new STDIO documentation.


Changes walkthrough πŸ“

Relevant files
Documentation
stdio.mdx
Add detailed MCP STDIO integration documentationΒ  Β  Β  Β  Β  Β  Β  Β  Β 

docs/mcp/stdio.mdx

  • Introduce a new guide for integrating STDIO with MCP and PraisonAI
    agents.
  • Include quick start steps, code samples, and requirements.
  • Demonstrate integration with multiple LLMs and Gradio UI.
  • Highlight features and usage scenarios.
  • +221/-0Β 
    mint.json
    Update navigation to include MCP STDIO docsΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β 

    docs/mint.json

    • Add mcp/stdio to the MCP documentation navigation group.
    +1/-0Β  Β  Β 

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Summary by CodeRabbit

    • Documentation
      • Added a comprehensive guide on integrating Standard Input/Output (STDIO) with PraisonAI agents using the MCP framework, including setup instructions, code examples, and UI integration.
      • Updated the documentation navigation to include the new STDIO integration guide under the MCP section.

    @MervinPraison MervinPraison merged commit 9d3501f into main May 13, 2025
    3 of 5 checks passed
    @coderabbitai
    Copy link
    Copy Markdown
    Contributor

    coderabbitai bot commented May 13, 2025

    Caution

    Review failed

    The pull request is closed.

    Walkthrough

    A new documentation page describing the integration of STDIO with PraisonAI agents via the MCP framework has been introduced. The documentation includes setup guides, code examples, usage with multiple LLMs, and UI integration. The navigation configuration was updated to include this new page within the MCP documentation section.

    Changes

    File(s) Change Summary
    docs/mcp/stdio.mdx Added a comprehensive guide for integrating STDIO with PraisonAI agents using MCP, including setup, code examples, and UI integration.
    docs/mint.json Updated navigation to include the new "mcp/stdio" documentation page in the MCP group.

    Sequence Diagram(s)

    sequenceDiagram
        participant User
        participant ClientScript
        participant MCPServer
        participant AI_Agent
    
        User->>ClientScript: Provide input/query
        ClientScript->>MCPServer: Send request via STDIO MCP tool
        MCPServer->>AI_Agent: Process request (e.g., calculator operation)
        AI_Agent-->>MCPServer: Return result
        MCPServer-->>ClientScript: Send result via STDIO
        ClientScript-->>User: Display output
    
    Loading

    Poem

    In docs, a new path appears so bright,
    STDIO and MCP now in the light.
    With code and charts, the guide is clear,
    Calculator agents drawing near.
    Navigation grows, one hop aheadβ€”
    A rabbit’s joy for docs well-spread!
    πŸ‡βœ¨

    Tip

    ⚑️ Faster reviews with caching
    • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

    Enjoy the performance boostβ€”your workflow just got faster.


    πŸ“œ Recent review details

    Configuration used: CodeRabbit UI
    Review profile: CHILL
    Plan: Pro

    πŸ“₯ Commits

    Reviewing files that changed from the base of the PR and between 9138049 and ab7f3ec.

    πŸ“’ Files selected for processing (2)
    • docs/mcp/stdio.mdx (1 hunks)
    • docs/mint.json (1 hunks)

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    ❀️ Share
    πŸͺ§ Tips

    Chat

    There are 3 ways to chat with CodeRabbit:

    • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
      • I pushed a fix in commit <commit_id>, please review it.
      • Explain this complex logic.
      • Open a follow-up GitHub issue for this discussion.
    • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
      • @coderabbitai explain this code block.
      • @coderabbitai modularize this function.
    • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
      • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
      • @coderabbitai read src/utils.ts and explain its main purpose.
      • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
      • @coderabbitai help me debug CodeRabbit configuration file.

    Support

    Need help? Create a ticket on our support page for assistance with any issues or questions.

    Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

    CodeRabbit Commands (Invoked using PR comments)

    • @coderabbitai pause to pause the reviews on a PR.
    • @coderabbitai resume to resume the paused reviews.
    • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
    • @coderabbitai full review to do a full review from scratch and review all the files again.
    • @coderabbitai summary to regenerate the summary of the PR.
    • @coderabbitai generate docstrings to generate docstrings for this PR.
    • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
    • @coderabbitai resolve resolve all the CodeRabbit review comments.
    • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
    • @coderabbitai help to get help.

    Other keywords and placeholders

    • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
    • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
    • Add @coderabbitai anywhere in the PR title to generate the title automatically.

    CodeRabbit Configuration File (.coderabbit.yaml)

    • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
    • Please see the configuration documentation for more information.
    • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

    Documentation and Community

    • Visit our Documentation for detailed information on how to use CodeRabbit.
    • Join our Discord Community to get help, request features, and share feedback.
    • Follow us on X/Twitter for updates and announcements.

    Copy link
    Copy Markdown
    Contributor

    @gemini-code-assist gemini-code-assist bot left a comment

    Choose a reason for hiding this comment

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

    Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

    Summary of Changes

    This pull request adds documentation for integrating Standard Input/Output (STDIO) with PraisonAI agents using MCP (Message Communication Protocol). It includes a guide with code examples for setting up a calculator agent that uses STDIO MCP for communication. The documentation also covers alternative LLM integrations (Groq, Ollama) and a Gradio UI integration. Additionally, the pull request updates the navigation menu to include the new STDIO MCP documentation.

    Highlights

    • Documentation: Adds a new documentation page for MCP STDIO integration, providing a guide and code examples.
    • Quick Start Guide: Includes a quick start guide with steps to create a client file, set up an STDIO MCP server, install dependencies, and run the agent.
    • LLM Integrations: Demonstrates alternative LLM integrations with Groq and Ollama using STDIO.
    • Gradio UI: Provides an example of integrating STDIO MCP with a Gradio UI for a calculator service.
    • Navigation Update: Updates the mint.json file to include the new STDIO MCP documentation in the navigation menu.

    Changelog

    • docs/mcp/stdio.mdx
      • Added a new documentation file for STDIO MCP integration.
      • Included a quick start guide with code examples for a calculator agent.
      • Demonstrated alternative LLM integrations with Groq and Ollama.
      • Provided an example of integrating STDIO MCP with a Gradio UI.
      • Added a features section highlighting the benefits of STDIO MCP integration.
    • docs/mint.json
      • Updated the navigation menu to include the new STDIO MCP documentation.
    Using Gemini Code Assist

    The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

    Invoking Gemini

    You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

    Feature Command Description
    Code Review /gemini review Performs a code review for the current pull request in its current state.
    Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
    Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
    Help /gemini help Displays a list of available commands.

    Customization

    To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

    Limitations & Feedback

    Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with πŸ‘ and πŸ‘Ž on @gemini-code-assist comments to provide feedback.

    You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


    Through pipes and streams, data does flow,
    From agent's mind to tools below.
    With STDIO's grace,
    A simple interface,
    AI's power starts to grow.

    Footnotes

    1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

    @qodo-code-review
    Copy link
    Copy Markdown

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Reviewer Guide πŸ”

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 πŸ”΅πŸ”΅βšͺβšͺβšͺ
    πŸ§ͺΒ No relevant tests
    πŸ”’Β Security concerns

    Sensitive information exposure:
    The documentation on line 128 shows an example of exporting an API key as an environment variable in plaintext. While this is common practice for examples, it could lead users to handle API keys insecurely. Consider adding a note about secure API key management practices or using a more secure method like environment files (.env) with proper gitignore settings.

    ⚑ Recommended focus areas for review

    API Key Exposure

    The documentation includes a step to export an API key in plaintext. Consider recommending more secure methods for API key management.

    <Step title="Export API Key">
        ```bash
        export OPENAI_API_KEY="your_api_key"
        ```
    </Step>
    Error Handling

    The calculator client example lacks error handling for potential issues with the subprocess or MCP communication.

    calculator_agent = Agent(
        instructions="""You are a calculator agent that can perform basic arithmetic operations.""",
        llm="gpt-4o-mini",
        tools=MCP("python calculator_server.py")
    )
    
    calculator_agent.start("What is 25 * 16?")
    
    </details>
    
    </td></tr>
    </table>
    

    @qodo-code-review
    Copy link
    Copy Markdown

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestionΒ  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Β  Impact
    Possible issue
    Improve error handling

    The error handling for division by zero raises a ValueError, but this exception
    isn't properly handled in the MCP context. Use MCP's error handling mechanism to
    ensure the error is properly communicated back to the agent.

    docs/mcp/stdio.mdx [98-112]

     @mcp.tool()
     def divide(a: float, b: float) -> float:
         """Divide a by b.
     
         Args:
             a: First number (numerator)
             b: Second number (denominator)
         
         Returns:
             The result of a / b
         """
         if b == 0:
    -        raise ValueError("Cannot divide by zero")
    +        logger.error("Division by zero attempted")
    +        return mcp.error("Cannot divide by zero")
         logger.info(f"Dividing {a} / {b}")
         return a / b
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: Using mcp.error() (if available) to handle division by zero provides clearer feedback to the agent and better integrates with the MCP error reporting mechanism, improving reliability. The suggestion is contextually relevant but not critical, as the original code already prevents a crash.

    Medium
    General
    Specify transport type explicitly

    The mcp.run() call doesn't specify the STDIO transport explicitly. For clarity
    and to ensure the correct transport is used, specify the STDIO transport when
    running the MCP server.

    docs/mcp/stdio.mdx [114-116]

     if __name__ == "__main__":
         # Run the MCP server using STDIO transport
    -    mcp.run()
    +    mcp.run(transport="stdio")
    • Apply / Chat
    Suggestion importance[1-10]: 6

    __

    Why: Explicitly specifying the transport as "stdio" in mcp.run() improves clarity and robustness, especially if the default transport could change or if the example is copied to a different context. However, if "stdio" is already the default, the impact is moderate rather than critical.

    Low
    • More

    Copy link
    Copy Markdown
    Contributor

    @gemini-code-assist gemini-code-assist bot left a comment

    Choose a reason for hiding this comment

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

    Code Review

    This pull request introduces comprehensive documentation for integrating PraisonAI agents with MCP using the STDIO transport. The documentation is well-structured, providing a clear quick start guide, alternative LLM examples, and a Gradio UI integration example. The addition to the navigation menu is also correctly implemented.

    The quick start steps and the explanation of the server setup are clear and easy to follow. The inclusion of examples for different LLMs is helpful.

    I've reviewed the changes focusing on correctness, efficiency, and maintainability, adhering to common Python and Markdown/JSON practices as no specific style guide was provided. Overall, this is a valuable addition to the documentation.

    Summary of Findings

    • Inefficient Agent/MCP initialization in Gradio example: The Agent and MCP instances are created inside the Gradio calculate function, leading to a new process being spawned for every user query. This is inefficient and should be moved outside the function for single initialization.
    • Logging in server example: The calculator_server.py example logs to a file (calculator_server.log). For a quick start example running via STDIO, logging to standard error might be more immediately visible and useful for debugging.
    • API Key Management: The documentation suggests exporting the API key as an environment variable. While simple for a quick start, mentioning more secure methods like .env files or secrets management for real applications could be beneficial.
    • Ollama prompt explicitness: The Ollama example prompt explicitly tells the agent to 'Use the add tool with parameters a and b.' While this demonstrates guiding the LLM, it might not be necessary depending on the LLM's tool-calling capabilities and could potentially be simplified.

    Merge Readiness

    The documentation is a great addition and the navigation update is correct. However, the Gradio example contains a significant inefficiency issue that should be corrected before merging to prevent users from adopting a poor pattern. Once the high-severity issue is addressed, the pull request should be ready to merge. I am unable to approve this pull request directly; please have another reviewer approve it after the necessary changes are made.

    Comment on lines +184 to +189
    def calculate(query):
    calculator_agent = Agent(
    instructions="""You are a calculator agent that can perform basic arithmetic operations.""",
    llm="gpt-4o-mini",
    tools=MCP("python calculator_server.py")
    )
    Copy link
    Copy Markdown
    Contributor

    Choose a reason for hiding this comment

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

    high

    In this Gradio example, the Agent and MCP instances are created inside the calculate function. This means a new Agent and a new MCP server process will be started for every request to the Gradio interface. This is highly inefficient and will lead to significant overhead and resource consumption.

    Could you move the Agent and MCP initialization outside the calculate function so they are created only once when the Gradio app starts?

    def calculate(query):
        # Use the pre-initialized agent
        result = calculator_agent.start(query)
        return f"## Calculation Result\n\n{result}"
    
    # Initialize Agent and MCP server once outside the function
    calculator_agent = Agent(
        instructions="""You are a calculator agent that can perform basic arithmetic operations.""",
        llm="gpt-4o-mini",
        tools=MCP("python calculator_server.py")
    )
    

    @netlify
    Copy link
    Copy Markdown

    netlify bot commented May 13, 2025

    βœ… Deploy Preview for praisonai ready!

    Name Link
    πŸ”¨ Latest commit ab7f3ec
    πŸ” Latest deploy log https://app.netlify.com/sites/praisonai/deploys/682367f12056580008c7b744
    😎 Deploy Preview https://deploy-preview-472--praisonai.netlify.app
    πŸ“± Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

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

    shaneholloman pushed a commit to shaneholloman/praisonai that referenced this pull request Feb 4, 2026
    Add STDIO MCP documentation and update navigation menu
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    1 participant