### Development Setup and Installation Source: https://github.com/camel-ai/mcpify/blob/main/README.md Clone the repository, install the project in editable mode with development dependencies, and install optional AI detection libraries. ```bash git clone https://github.com/your-username/mcpify.git cd mcpify pip install -e ".[dev]" # Install optional dependencies for full functionality pip install openai camel-ai python -m pytest tests/ -v ``` -------------------------------- ### Configuration Examples Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Examples of different configuration setups for MCPify. ```APIDOC ## Configuration Examples ### Description Illustrates various ways to configure MCPify, from minimal to complete setups. ### Types of Configurations 1. **HTTP REST API**: Complete configuration including auth headers. 2. **Command-line tool**: Configuration for data processing via CLI. 3. **Interactive server**: Configuration for the Python REPL server. 4. **Minimal configuration**: The smallest valid configuration file. ### Tool-Specific Examples - HTTP GET with query parameters. - HTTP POST with JSON body. - CLI with multiple arguments. - Server interactive commands. ``` -------------------------------- ### Install UI Dependencies and Start MCPify UI Source: https://github.com/camel-ai/mcpify/blob/main/README.md Install the necessary dependencies for the MCPify UI and then start the interactive web interface. You can also use a convenience function to launch the UI. ```bash pip install 'mcpify[ui]' python -m mcpify.ui # Or use the convenience function python -c "from mcpify.ui import start_ui; start_ui()" ``` -------------------------------- ### MCPify Examples - View Configurations Source: https://github.com/camel-ai/mcpify/blob/main/README.md Commands to view example configuration files. ```bash # View example configurations mcpify view examples/python-server-project/server.json mcpify view examples/python-cmd-tool/cmd-tool.json ``` -------------------------------- ### Server Backend Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md An example of a server backend configuration with custom startup timeout and ready signal. ```json { "type": "server", "config": { "command": "python3", "args": ["repl.py"], "cwd": "/app", "startup_timeout": 10, "ready_signal": ">>> " } } ``` -------------------------------- ### Interactive Analysis with UI Setup Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/cli-interface.md Instructions for setting up and launching the interactive MCP UI. It involves installing dependencies and then running the UI command. ```bash # Install UI dependencies pip install 'mcpify[ui]' # Launch interactive interface mcpify ui # Open http://localhost:8501 in browser # Analyze repositories, configure tools interactively ``` -------------------------------- ### CLI: UI Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Example of using the 'ui' command to launch the web interface. ```bash mcpify ui --port 8000 ``` -------------------------------- ### MCPify Server Configuration - Real Examples Source: https://github.com/camel-ai/mcpify/blob/main/README.md Real-world examples of serving configuration files with specified modes and ports. ```bash # Real examples with provided configurations mcpify serve examples/python-server-project/server.json mcpify serve examples/python-server-project/server.json --mode streamable-http --port 8888 mcpify serve examples/python-cmd-tool/cmd-tool.json --mode stdio ``` -------------------------------- ### CLI: View Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Example of using the 'view' command to display the project's configuration. ```bash mcpify view --config-path ./mcpify.yaml ``` -------------------------------- ### CLI: Serve Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Example of using the 'serve' command to run the MCP server. ```bash mcpify serve --config-path ./mcpify.yaml --port 8080 ``` -------------------------------- ### Docker Deployment Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md A Dockerfile to containerize the MCPify server for deployment. It installs dependencies, copies configuration, and sets the CMD. ```dockerfile FROM python:3.10-slim WORKDIR /app COPY config.json . RUN pip install mcpify CMD ["mcpify", "serve", "config.json", \ "--mode", "streamable-http", \ "--host", "0.0.0.0", "--port", "8080"] ``` -------------------------------- ### MCPify Examples - Detection Strategies Source: https://github.com/camel-ai/mcpify/blob/main/README.md Commands to run different detection strategies on example projects. ```bash # Try different detection strategies on examples mcpify detect examples/python-server-project --output server-auto.json mcpify openai-detect examples/python-cmd-tool --output cmd-openai.json mcpify ast-detect examples/python-server-project --output server-ast.json ``` -------------------------------- ### Execute HTTP Tool Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Demonstrates how to execute HTTP requests (GET and POST) using the HttpAdapter. It shows how to initialize the adapter and call the execute_tool method with different tool configurations and parameters. ```python config = {"base_url": "http://api.example.com", "timeout": 30} adapter = HttpAdapter(config) # GET request tool_config = {"endpoint": "/users/{id}", "method": "GET"} result = await adapter.execute_tool(tool_config, {"id": "123"}) # Requests: GET http://api.example.com/users/123?id=123 # POST request tool_config = { "endpoint": "/users", "method": "POST" } result = await adapter.execute_tool(tool_config, {"name": "John", "email": "john@example.com"}) # Posts JSON body with name and email ``` -------------------------------- ### Hello Command Example Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md Demonstrates the input and output for the 'hello' command, which elicits a standard greeting from the server. ```text Input: hello Output: Hello there! Server received your message. ``` -------------------------------- ### Execute Server Tool Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Example of using ServerAdapter to interact with a server process. It starts the server if needed, sends a command with substituted parameters, and reads the response. ```python config = { "command": "python3", "args": ["repl.py"], "ready_signal": ">>> ", "startup_timeout": 10 } adapter = ServerAdapter(config) tool_config = { "name": "eval", "command": "eval {expression}" } result = await adapter.execute_tool(tool_config, {"expression": "2+2"}) ``` -------------------------------- ### Parameter Types Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md A guide to common parameter types used in MCPify configurations, including their examples and use cases. ```markdown | Type | Example | Use For | |------|---------|---------| | "string" | "hello" | Text, paths, identifiers | | "integer" | 42 | Counts, IDs | | "number" | 3.14 | Floats, decimals | | "boolean" | true | Flags, toggles | | "array" | ["a", "b"] | Lists, collections | | "object" | {key: value} | Structured data | ``` -------------------------------- ### Adapter Factory Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/architecture.md An example showing how to use the adapter factory to instantiate the correct backend adapter based on configuration. ```python adapter = create_adapter(backend_config) # Creates appropriate adapter ``` -------------------------------- ### Example Configuration for Commandline Backend Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Demonstrates the configuration for a Commandline backend, specifying the command, arguments, and current working directory. ```json { "name": "My Project", "description": "A sample project", "version": "0.1.0", "backend": { "type": "cli", "command": "python", "args": ["my_processor.py", "--input", "{input_file}", "--output", "{output_file}"], "cwd": "/path/to/processor" }, "tools": [], "metadata": {} } ``` -------------------------------- ### MCPify Examples - Test with STDIO Mode Source: https://github.com/camel-ai/mcpify/blob/main/README.md Commands to test example configurations using the default STDIO server mode. ```bash # Test with examples - STDIO mode (default) mcpify serve examples/python-server-project/server.json mcpify serve examples/python-cmd-tool/cmd-tool.json ``` -------------------------------- ### Create Backend Adapter Examples Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Shows how to create different types of backend adapters (command-line and HTTP) using the create_adapter factory function. Each example specifies the 'type' and 'config' for the desired adapter. ```python from mcpify.backend import create_adapter # Command-line backend config = { "type": "commandline", "config": {"command": "python3", "args": ["script.py"]} } adapter = create_adapter(config) # HTTP backend config = { "type": "http", "config": {"base_url": "http://localhost:8000"} } adapter = create_adapter(config) ``` -------------------------------- ### Server Tool Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Example of a command template for server tools, which can include placeholders for parameters. ```json "command": "eval {expression}" ``` ```json "command": "process --input {file} --mode {mode}" ``` -------------------------------- ### Serve Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Start a server using the specified configuration file. Errors will be shown during serving. ```bash mcpify serve config.json ``` -------------------------------- ### Start MCPify UI Source: https://github.com/camel-ai/mcpify/blob/main/README.md Launches the MCPify User Interface. Navigate to the provided URL in your browser to start analyzing repositories. ```bash python -m mcpify.ui ``` -------------------------------- ### Start Backend Asynchronously Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Asynchronously start the backend service. This method is a no-op if no backend adapter is configured. ```python import asyncio wrapper = MCPWrapper("config.json") await wrapper.start_backend() ``` -------------------------------- ### Install MCPify Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Install MCPify with basic, development, Camel-AI, UI, or all dependencies. ```bash pip install mcpify ``` ```bash pip install mcpify[dev] ``` ```bash pip install mcpify camel-ai ``` ```bash pip install 'mcpify[ui]' ``` ```bash pip install 'mcpify[all]' ``` -------------------------------- ### MCPWrapper.start_backend Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Asynchronously starts the backend service. If a backend adapter is configured, its start method is called. ```APIDOC ## `start_backend` ### Description Start the backend service asynchronously. ### Method start_backend ### Behavior - Calls `adapter.start()` if adapter exists - No-op if no backend adapter configured ### Example ```python import asyncio wrapper = MCPWrapper("config.json") await wrapper.start_backend() ``` ``` -------------------------------- ### Full Example Interaction Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md A complete walkthrough of a typical server session, showcasing multiple commands and their corresponding outputs. ```bash $ python server.py Server started. Waiting for input... hello Hello there! Server received your message. echo Test message Echo: Test message time Current time: 2025-05-28 16:23:45 invalid Server received: 'invalid' - Unknown command quit Server shutting down... ``` -------------------------------- ### Start Standalone MCP Server Source: https://github.com/camel-ai/mcpify/blob/main/examples/README.md Use the 'mcp-serve' command to start a standalone MCP server with the specified configuration. ```bash mcp-serve examples/fastapi-example.json ``` -------------------------------- ### Launch Interactive Streamlit Web Interface Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/cli-interface.md Starts the interactive Streamlit UI for MCP configuration. Requires Streamlit installation. Development mode enables auto-reloading. ```bash mcpify ui [--host ] [--port ] [--dev] ``` ```bash # Basic UI (http://localhost:8501) mcpify ui ``` ```bash # Custom port mcpify ui --port 8502 ``` ```bash # Custom host and port mcpify ui --host 0.0.0.0 --port 8080 ``` ```bash # Development mode with auto-reload mcpify ui --dev ``` ```bash # Using environment variables export STREAMLIT_SERVER_PORT=9999 mcpify ui ``` -------------------------------- ### Example Configuration for Server Backend Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Shows the configuration for a Server backend, including startup timeout and a ready signal for server readiness checks. ```json { "name": "My Project", "description": "A sample project", "version": "0.1.0", "backend": { "type": "server", "startup_timeout": 60, "ready_signal": "Server ready" }, "tools": [], "metadata": {} } ``` -------------------------------- ### Example Description Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Shows example string values for the 'description' field, which provides a human-readable explanation of the server's purpose. Descriptions should be informative and meet length recommendations. ```json "description": "REST API for user management" ``` ```json "description": "Data processing and analysis tool" ``` -------------------------------- ### Example Version Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Demonstrates the optional 'version' field, recommended to follow semantic versioning. This field allows tracking configuration versions. ```json "version": "1.0.0" ``` -------------------------------- ### MCPify JSON Configuration File Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/cli-interface.md An example of a standard JSON configuration file for MCPify, detailing service name, description, backend configuration, and tools. ```json { "name": "my-api", "description": "My API service", "backend": { "type": "http", "config": { "base_url": "http://localhost:8000", "timeout": 30 } }, "tools": [ { "name": "get_data", "description": "Get data", "endpoint": "/data", "method": "GET", "parameters": [ { "name": "id", "type": "string", "description": "Data ID", "required": true } ] } ] } ``` -------------------------------- ### Quit Command Example Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md Demonstrates the input and output for the 'quit' command, used to initiate a graceful shutdown of the server. ```text Input: quit Output: Server shutting down... ``` -------------------------------- ### CLI Tool Arguments Examples Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Examples of command-line argument templates for CLI tools, using placeholders for parameters. ```json "args": ["--process", "{input_file}"] ``` ```json "args": ["--input", "{file}", "--output", "{output_file}", "--format", "{format}"] ``` ```json "args": ["deploy", "{environment}"] ``` -------------------------------- ### MCPify Examples - Test with HTTP Mode Source: https://github.com/camel-ai/mcpify/blob/main/README.md Commands to test example configurations using the streamable-http server mode with specified ports. ```bash # Test with examples - HTTP mode mcpify serve examples/python-server-project/server.json --mode streamable-http --port 8888 mcpify serve examples/python-cmd-tool/cmd-tool.json --mode streamable-http --port 9999 ``` -------------------------------- ### CLI: Detect Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Example of using the 'detect' command to automatically detect the best strategy for project analysis. ```bash mcpify detect --project-path . --output-path ./results ``` -------------------------------- ### CLI: Validate Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Example of using the 'validate' command to validate a configuration file. ```bash mcpify validate --config-path ./mcpify.yaml ``` -------------------------------- ### Tool Name Examples Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Examples of valid tool names, which serve as unique identifiers for tools. ```json "name": "get_user" ``` ```json "name": "create_todo" ``` ```json "name": "list_products" ``` -------------------------------- ### ProjectInfo Example Instantiation Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/types.md Demonstrates how to create an instance of the ProjectInfo dataclass with sample project data. This is useful for testing or providing mock data. ```python project_info = ProjectInfo( name="my-api", description="REST API service for data processing", main_files=["main.py", "routes.py", "models.py"], readme_content="# My API\n\nA REST API service...", project_type="web", dependencies=["fastapi", "sqlalchemy", "pydantic"] ) ``` -------------------------------- ### CLI Tool Examples Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-cmd-tool/README.md Demonstrates the usage of various commands of the Python CLI tool. ```bash $ python cli_tool.py --hello Hello there! CLI tool received your message. $ python cli_tool.py --echo "Test message" Echo: Test message $ python cli_tool.py --time Current time: 2025-05-28 16:12:34 $ python cli_tool.py --add 10 20 Result: 10 + 20 = 30 ``` -------------------------------- ### Example Parameters Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Illustrates how to define parameters for a tool, including string, integer, and boolean types with optional default values. ```json "parameters": [ { "name": "user_id", "type": "string", "description": "The unique user identifier", "required": true }, { "name": "limit", "type": "integer", "description": "Maximum number of results", "required": false, "default": 10 }, { "name": "active_only", "type": "boolean", "description": "Filter only active users", "required": false, "default": true } ] ``` -------------------------------- ### ToolSpec Example Instantiation Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/types.md Provides an example of creating a ToolSpec instance for a 'get_user_by_id' tool. Shows how to define arguments and parameters, including optional ones with defaults. ```python tool_spec = ToolSpec( name="get_user_by_id", description="Retrieve user information by user ID", args=[ "GET", "/users/{user_id}", "--format", "{output_format}" ], parameters=[ { "name": "user_id", "type": "string", "description": "The unique user identifier", "required": True }, { "name": "output_format", "type": "string", "description": "Output format: json or xml", "required": False, "default": "json" } ] ) ``` -------------------------------- ### Command-Line Backend Tool Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Example tool configuration for the command-line backend, defining arguments for input and output. ```json { "args": ["--input", "{file}", "--output", "{output}"] } ``` -------------------------------- ### Serve MCPify Configuration Source: https://github.com/camel-ai/mcpify/blob/main/examples/README.md Use the 'mcpify serve' command to start a server with the specified configuration. Ensure the backend is running first. ```bash mcpify serve examples/fastapi-example.json ``` -------------------------------- ### CLI: Camel Detect Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Example of using the 'camel-detect' command for detection using Camel-AI. ```bash mcpify camel-detect --project-path . --output-path ./results ``` -------------------------------- ### Detector Factory Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/architecture.md Examples demonstrating how to use the detector factory to create detector instances. You can auto-select the best detector or specify a particular one. ```python detector = create_detector("auto") # Auto-selects best detector = create_detector("openai") # Specific detector ``` -------------------------------- ### Echo Command Example Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md Shows how to use the 'echo' command to have the server repeat a given message back to the user. ```text Input: echo Hello, World! Output: Echo: Hello, World! ``` -------------------------------- ### Install MCPify from Source Source: https://github.com/camel-ai/mcpify/blob/main/README.md Installs MCPify in editable mode from a local clone of the repository. This is useful for development and testing changes. ```bash git clone https://github.com/your-username/mcpify.git cd mcpify pip install -e . ``` -------------------------------- ### Commandline Backend Tool Arguments Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Demonstrates how to configure a tool to use the commandline backend, including passing tool-specific arguments with placeholders. Placeholders like {param_name} are replaced with actual parameter values during execution. ```json { "backend": { "type": "commandline", "config": { "command": "python3", "args": ["cli_tool.py"], "cwd": "/app" } }, "tools": [ { "name": "analyze", "args": ["--input", "{input_file}", "--output", "{output_file}"], "parameters": [ {"name": "input_file", "type": "string", "description": "Input file path"}, {"name": "output_file", "type": "string", "description": "Output file path"} ] } ] } ``` -------------------------------- ### Example Configuration for HTTP Backend Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Illustrates the configuration structure for using an HTTP backend, including base URL, timeout, and headers for authentication. ```json { "name": "My Project", "description": "A sample project", "version": "0.1.0", "backend": { "type": "http", "base_url": "http://localhost:8080/api", "timeout": 30, "headers": { "Authorization": "Bearer YOUR_API_KEY" } }, "tools": [], "metadata": {} } ``` -------------------------------- ### Production HTTP Server Start Source: https://github.com/camel-ai/mcpify/blob/main/README.md Start the MCPify HTTP server for production use. Allows configuration of mode, host, and port for custom deployments. ```bash # Start HTTP server for production mcpify serve config.json --mode streamable-http --host 0.0.0.0 --port 8080 # With custom configuration mcpify serve config.json --mode streamable-http --host 127.0.0.1 --port 9999 ``` -------------------------------- ### HTTP Tool Endpoint Examples Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Examples of API endpoint paths for HTTP tools, including path parameters. ```json "endpoint": "/users" ``` ```json "endpoint": "/users/{user_id}" ``` ```json "endpoint": "/api/v1/products/{product_id}/reviews" ``` -------------------------------- ### CLI: OpenAI Detect Command Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md Example of using the 'openai-detect' command for detection using OpenAI GPT-4. ```bash mcpify openai-detect --project-path . --output-path ./results --model gpt-4 ``` -------------------------------- ### Bash Wrapper Script Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/MANIFEST.md A sample bash script demonstrating a common workflow for project analysis using MCPify CLI commands. ```bash #!/bin/bash PROJECT_DIR="./my_project" OUTPUT_DIR="./analysis_results" CONFIG_FILE="./mcpify.yaml" # Validate configuration mcpify validate --config-path $CONFIG_FILE # Detect and analyze mcpify detect --project-path $PROJECT_DIR --output-path $OUTPUT_DIR --config-path $CONFIG_FILE # View results mcpify view --output-path $OUTPUT_DIR ``` -------------------------------- ### Install MCPify using pip Source: https://github.com/camel-ai/mcpify/blob/main/README.md Installs the MCPify package from the Python Package Index (PyPI). This is the recommended method for most users. ```bash pip install mcpify ``` -------------------------------- ### Time Command Example Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md Illustrates the 'time' command, which prompts the server to display the current date and time in a specific format. ```text Input: time Example Output: Current time: 2025-05-28 16:23:45 ``` -------------------------------- ### Start MCP Server from Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/cli-interface.md Initiates an MCP server using a specified configuration file. Supports 'stdio' mode for local development and 'streamable-http' for web integration, which requires host and port configuration. ```bash mcpify serve [--mode ] [--host ] [--port ] ``` ```bash # STDIO mode (default, standard MCP protocol) mcpify serve config.json ``` ```bash # HTTP mode on localhost mcpify serve config.json --mode streamable-http --port 8080 ``` ```bash # HTTP mode on all interfaces (production) mcpify serve config.json --mode streamable-http --host 0.0.0.0 --port 8080 ``` ```bash # Custom configuration mcpify serve config.json --mode streamable-http --host 127.0.0.1 --port 9999 ``` -------------------------------- ### Initialize MCPWrapper Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Instantiate MCPWrapper with a configuration file path and start the server. Ensure the configuration file exists and is valid JSON. ```python from mcpify.wrapper import MCPWrapper wrapper = MCPWrapper("config.json") wrapper.run() ``` -------------------------------- ### Server Backend Tool Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Example tool configuration for the server backend, specifying the command for evaluating expressions. ```json { "command": "eval {expression}" } ``` -------------------------------- ### Run MCP Server Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Start the MCP server with different modes and configurations. Ensure the configuration file is valid. ```bash # STDIO mode (standard MCP) mcpify serve config.json ``` ```bash # HTTP mode mcpify serve config.json --mode streamable-http --port 8080 ``` ```bash # All interfaces (production) mcpify serve config.json --mode streamable-http --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Execute Command-Line Tool Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Example of using CommandLineAdapter to execute a tool. It substitutes parameters into the tool's arguments and runs the command. Ensure the command and arguments are correctly formatted. ```python config = {"command": "python3", "args": ["analyze.py"], "cwd": "/app"} adapter = CommandLineAdapter(config) tool_config = { "name": "process", "args": ["--file", "{input_file}", "--mode", "{mode}"] } result = await adapter.execute_tool(tool_config, {"input_file": "data.txt", "mode": "fast"}) # Executes: python3 analyze.py --file data.txt --mode fast ``` -------------------------------- ### Example Server Name Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Illustrates valid string formats for the 'name' field, used as a server identifier. Names should be non-empty and adhere to character constraints. ```json "name": "my-api" ``` ```json "name": "todo-service" ``` ```json "name": "data_processor" ``` -------------------------------- ### Run the Python Server Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md Execute the Python server script from the command line. This starts the server listening for input. ```bash python server.py ``` -------------------------------- ### MCPify CLI Server Commands Source: https://github.com/camel-ai/mcpify/blob/main/README.md Commands to start the MCPify server with specified configuration, mode, host, and port. ```bash mcpify serve [--mode ] [--host ] [--port ] ``` -------------------------------- ### HTTP Backend with Authentication Headers Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Example of an HTTP backend configuration with specific authentication and content type headers. ```json { "type": "http", "config": { "base_url": "https://api.example.com/v1", "timeout": 30, "headers": { "Authorization": "Bearer sk_live_...", "Content-Type": "application/json", "Accept": "application/json" } } } ``` -------------------------------- ### Start FastAPI Todo Server Source: https://github.com/camel-ai/mcpify/blob/main/examples/fastapi-todo-server/README.md Use uvicorn to run the FastAPI application. The --reload flag is useful for development. ```bash uvicorn main:app --reload --host 0.0.0.0 --port 8000 ``` -------------------------------- ### HTTP GET Tool Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Configuration for an HTTP GET tool that accepts query parameters. Includes a required 'q' parameter and an optional 'limit' with a default value. ```json { "name": "search", "endpoint": "/search", "method": "GET", "parameters": [ {"name": "q", "type": "string", "required": true}, {"name": "limit", "type": "integer", "required": false, "default": 10} ] } ``` -------------------------------- ### Server Start Message Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md The initial message displayed by the server upon successful startup, indicating it is ready to receive input. ```text Server started. Waiting for input... ``` -------------------------------- ### HTTP Backend Tool Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Example tool configuration for the HTTP backend, specifying the endpoint and HTTP method. ```json { "endpoint": "/api/resource/{id}", "method": "GET" } ``` -------------------------------- ### Example Metadata Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/configuration.md Illustrates the optional 'metadata' object for storing custom information like author or tags. This field provides flexibility for additional data. ```json "metadata": { "author": "John Doe", "tags": ["api", "rest"], "maintainer": "team@example.com" } ``` -------------------------------- ### Unknown Command Example Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-server-project/README.md Shows the server's response when an unrecognized command is entered, indicating the input was not processed. ```text Input: invalid Output: Server received: 'invalid' - Unknown command ``` -------------------------------- ### Full MCPify Configuration Example Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md A comprehensive JSON configuration for MCPify, defining API metadata, backend settings (HTTP with base URL, timeout, headers), and a list of tools with their endpoints, methods, and parameters. ```json { "name": "my-api", "description": "My API server", "backend": { "type": "http", "config": { "base_url": "http://localhost:8000", "timeout": 30, "headers": { "Authorization": "Bearer token" } } }, "tools": [ { "name": "get_user", "description": "Get user information", "endpoint": "/users/{user_id}", "method": "GET", "parameters": [ { "name": "user_id", "type": "string", "description": "User ID", "required": true } ] }, { "name": "create_user", "description": "Create a new user", "endpoint": "/users", "method": "POST", "parameters": [ { "name": "name", "type": "string", "description": "User name", "required": true }, { "name": "email", "type": "string", "description": "User email", "required": true } ] } ] } ``` -------------------------------- ### Run MCPify UI in Development Mode Source: https://github.com/camel-ai/mcpify/blob/main/README.md Starts the MCPify UI using Streamlit, enabling live reloading on save for a faster development feedback loop. ```bash # Run the UI in development mode streamlit run mcpify/ui/app.py --server.runOnSave true ``` -------------------------------- ### Start MCP Server with mcpify CLI Source: https://github.com/camel-ai/mcpify/blob/main/README.md Launch the MCP server using the mcpify CLI or direct module invocation. Supports different modes and ports for web integration. ```bash # Method 1: Using mcpify CLI (recommended) mcpify serve config.json # Method 2: Direct module invocation python -m mcpify serve config.json # HTTP mode for web integration mcpify serve config.json --mode streamable-http --port 8080 ``` -------------------------------- ### Common Pattern: Get Project APIs Automatically Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md A four-step workflow to automatically detect, review, validate, and deploy project APIs using MCPify commands. ```bash # 1. Detect mcpify detect ./project --output config.json # 2. Review mcpify view config.json # 3. Validate mcpify validate config.json # 4. Deploy mcpify serve config.json ``` -------------------------------- ### Get All Todo Items Source: https://github.com/camel-ai/mcpify/blob/main/examples/fastapi-todo-server/README.md Send a GET request to the /todos endpoint to retrieve a list of all todo items. ```bash curl http://localhost:8000/todos ``` -------------------------------- ### Install OpenAI Dependencies for MCPify Source: https://github.com/camel-ai/mcpify/blob/main/README.md Installs the 'openai' library, which is an optional dependency for enhanced detection capabilities within MCPify. ```bash # For OpenAI-powered detection pip install openai export OPENAI_API_KEY="your-api-key" ``` -------------------------------- ### Get a Specific Todo Item Source: https://github.com/camel-ai/mcpify/blob/main/examples/fastapi-todo-server/README.md Send a GET request to /todos/{todo_id} to retrieve a single todo item by its ID. ```bash curl http://localhost:8000/todos/1 ``` -------------------------------- ### Install Camel-AI Dependencies for MCPify Source: https://github.com/camel-ai/mcpify/blob/main/README.md Installs the 'camel-ai' library, an optional dependency for leveraging Camel-AI's features within MCPify. ```bash # For Camel-AI powered detection pip install camel-ai ``` -------------------------------- ### Install MCPify with UI Development Dependencies Source: https://github.com/camel-ai/mcpify/blob/main/README.md Installs the MCPify package along with extra dependencies required for UI development, including testing and linting tools. ```bash # Install UI development dependencies pip install 'mcpify[ui,dev]' ``` -------------------------------- ### Help Command Source: https://github.com/camel-ai/mcpify/blob/main/examples/python-cmd-tool/README.md Use the --help flag to view all available commands and their descriptions. ```bash python cli_tool.py --help ``` -------------------------------- ### Get Todo Source: https://github.com/camel-ai/mcpify/blob/main/examples/fastapi-todo-server/README.md Retrieves a specific todo item by its ID. ```APIDOC ## GET /todos/{todo_id} ### Description Retrieves a specific todo item by its unique identifier. ### Method GET ### Endpoint /todos/{todo_id} ### Parameters #### Path Parameters - **todo_id** (integer) - Required - The ID of the todo item to retrieve. ### Response #### Success Response (200) - **id** (integer) - Unique identifier. - **title** (string) - Todo title. - **description** (string) - Optional description. - **completed** (boolean) - Completion status. - **priority** (string) - Priority level. - **created_at** (string) - Creation timestamp. - **updated_at** (string) - Last update timestamp. ### Response Example ```json { "id": 1, "title": "Buy groceries", "description": "Milk, bread, eggs", "completed": false, "priority": "medium", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } ``` ``` -------------------------------- ### Usage Scenarios: API Detection and Testing Source: https://github.com/camel-ai/mcpify/blob/main/README.md Demonstrates how to detect and test APIs using different MCPify strategies and then view or serve the generated configurations. ```bash # Detect and test your APIs with different strategies mcpify detect my-project --output my-project.json # Auto-select best mcpify openai-detect my-project --output my-project-ai.json # AI-powered mcpify ast-detect my-project --output my-project-ast.json # Static analysis # Compare results mcpify view my-project.json mcpify serve my-project.json ``` -------------------------------- ### View Configuration Syntax Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Check the syntax of a configuration file. ```bash mcpify view config.json ``` -------------------------------- ### Configure HTTP Timeout Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Example of setting a custom timeout for an HTTP backend configuration. This is useful for long-running requests. ```json { "type": "http", "config": { "base_url": "...", "timeout": 120 # 2 minutes } } ``` -------------------------------- ### Server Backend Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md Configure the server backend for interactive servers or REPLs. Includes command, arguments, startup timeout, and ready signal. ```json { "type": "server", "config": { "command": "python3", "args": ["server.py"], "startup_timeout": 5, "ready_signal": "Ready>" } } ``` -------------------------------- ### Configure MCPify UI with Advanced Options Source: https://github.com/camel-ai/mcpify/blob/main/README.md Launches the MCPify UI and demonstrates how to set advanced analysis options such as exclude patterns, max file size, and detection strategy. ```bash # Start UI with custom settings python -m mcpify.ui # Configure advanced options: # • Exclude patterns: "*.md, tests/, docs/" # • Max file size: 100 KB # • Detection strategy: openai # • Include private repos: Yes ``` -------------------------------- ### MCPify Server Configuration - STDIO Mode Explained Source: https://github.com/camel-ai/mcpify/blob/main/README.md Explanation and command for using the default STDIO server mode, suitable for local development. ```bash mcpify serve config.json # or explicitly mcpify serve config.json --mode stdio ``` -------------------------------- ### Usage Scenarios: Production Deployment Source: https://github.com/camel-ai/mcpify/blob/main/README.md Shows how to generate a production configuration using the best available strategy and deploy it as an HTTP server with specified host and port. ```bash # Generate configuration with best available strategy mcpify detect production-app --output prod-config.json # Deploy as HTTP server mcpify serve prod-config.json --mode streamable-http --host 0.0.0.0 --port 8080 ``` -------------------------------- ### MCPify Server Configuration - Basic Usage Source: https://github.com/camel-ai/mcpify/blob/main/README.md Basic command to serve a configuration file. Defaults to STDIO mode. ```bash # Basic usage mcpify serve config.json ``` -------------------------------- ### MCPWrapper.run Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Starts the MCP server synchronously, blocking execution until the server is interrupted. It also handles backend startup and resource cleanup. ```APIDOC ## `run` ### Description Start the MCP server synchronously. ### Method run ### Behavior 1. Starts backend adapter if configured 2. Runs FastMCP server (blocks until interrupted) 3. Cleans up resources on exit ### Example ```python wrapper = MCPWrapper("config.json") wrapper.run() # Blocks until Ctrl+C ``` ``` -------------------------------- ### Run MCP Server Synchronously Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-wrapper.md Start the MCP server and its backend adapter (if configured) synchronously. This method blocks until the server is interrupted. ```python wrapper = MCPWrapper("config.json") wrapper.run() # Blocks until Ctrl+C ``` -------------------------------- ### MCPify Server Configuration - Streamable HTTP Mode Explained Source: https://github.com/camel-ai/mcpify/blob/main/README.md Explanation and commands for using the Streamable HTTP mode, including local development and production deployment configurations. ```bash # Local development mcpify serve config.json --mode streamable-http --port 8080 # Production deployment mcpify serve config.json --mode streamable-http --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Basic Project Detection Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-detectors.md Demonstrates how to automatically detect project configuration using the 'auto' strategy. The detector analyzes a specified project path. ```python from mcpify.detect import create_detector # Auto-detect with best available strategy detector = create_detector("auto") config = detector.detect_project("/path/to/my-project") # config contains: # { # "name": "my-project", # "description": "Project description", # "backend": {"type": "...", "config": {...}}, # "tools": [{"name": "...", "description": "...", ...}, ...] # } ``` -------------------------------- ### Development Workflow: Detect, View, Serve Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/quick-reference.md A typical development workflow using mcpify: detect endpoints, review the configuration, and then serve the application locally. ```bash # 1. Develop your API/CLI # ... create your app ... # 2. Auto-detect endpoints mcpify detect . --output server.json # 3. Review and adjust mcpify view server.json --verbose # 4. Test locally mcpify serve server.json # 5. Deploy # Use CI/CD with generated config ``` -------------------------------- ### Complete Validation Workflow Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/api-reference-validation.md A comprehensive example demonstrating the full validation workflow, including validating a file, printing results, and exiting if invalid. ```python from mcpify.validate import MCPConfigValidator, print_validation_results from pathlib import Path def validate_and_report(config_path: str) -> bool: """Validate config and return whether it's valid.""" validator = MCPConfigValidator() result = validator.validate_file(config_path) print_validation_results(result, verbose=True) return result.is_valid if __name__ == "__main__": is_valid = validate_and_report("config.json") if not is_valid: sys.exit(1) ``` -------------------------------- ### Handling File Not Found Errors Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/cli-interface.md Demonstrates how to resolve 'Project path does not exist' errors by verifying the path and retrying the command. ```bash # Error: Project path doesn't exist $ mcpify detect /nonexistent/path ❌ Error: Project path does not exist: /nonexistent/path # Solution: Verify path ls -la /correct/path mcpify detect /correct/path ``` -------------------------------- ### Server Backend Configuration Source: https://github.com/camel-ai/mcpify/blob/main/_autodocs/types.md Configuration for a backend that runs as a server process. Requires an executable, optional arguments, working directory, startup timeout, and a readiness indicator. ```python { "type": "server", "config": { "command": "python3", # Required: executable "args": ["server.py"], # Optional: arguments "cwd": ".", # Optional: working directory "startup_timeout": 5, # Optional: startup timeout "ready_signal": "Ready>" # Optional: readiness indicator } } ```