File tree Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Expand file tree Collapse file tree 2 files changed +25
-11
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,15 @@ The world's first AI-native API testing platform powered by the Model Context Pr
6969 Business API: ` http://localhost:8000 `
7070 Admin UI: ` http://localhost:8001 `
7171
72+ ## Add to Claude Code
73+ ** Simply run**
74+ ` claude mcp add mockloop-mcp mockloop-mcp --stdio `
75+
76+ Or if using virtual environment:
77+
78+ ` claude mcp add mockloop-mcp /path/to/venv/bin/mockloop_mcp --stdio `
79+
80+
7281## Documentation
7382
7483- ** [ Getting Started] ( getting-started/installation.md ) ** : Installation and basic setup
Original file line number Diff line number Diff line change @@ -1810,19 +1810,24 @@ def main_cli():
18101810# Use `mcp dev src/mockloop_mcp/main.py` or `mcp run src/mockloop_mcp/main.py`
18111811# Or, if this file is intended to be run directly as `python src/mockloop_mcp/main.py`:
18121812if __name__ == "__main__" :
1813- # Check if --cli flag is passed, otherwise assume MCP server run
1814- if "--cli" in sys .argv :
1813+ # Check for --stdio flag for Claude Code integration
1814+ if "--stdio" in sys .argv :
1815+ # Remove --stdio from sys.argv so it doesn't interfere
1816+ sys .argv .remove ("--stdio" )
1817+
1818+ # Run in stdio mode for Claude Code
1819+ import asyncio
1820+ from mcp .server .stdio import stdio_server
1821+
1822+ async def main ():
1823+ async with stdio_server () as (read_stream , write_stream ):
1824+ await server .run (read_stream , write_stream )
1825+
1826+ asyncio .run (main ())
1827+ elif "--cli" in sys .argv :
18151828 # Remove --cli from sys.argv so argparse doesn't see it
18161829 sys .argv .remove ("--cli" )
18171830 main_cli ()
18181831 else :
1819- # Start the MCP server
1832+ # Start the MCP server in SSE mode (existing behavior)
18201833 server .run ()
1821-
1822-
1823- # To make `python src/mockloop_mcp/main.py` start the server as per SDK docs:
1824- # (Comment out the main_cli() call above if you uncomment this)
1825- #
1826- # if __name__ == "__main__":
1827- # print("Starting MockLoop MCP Server...")
1828- # mcp_server.run()
You can’t perform that action at this time.
0 commit comments