### Install and Authenticate LeanMCP CLI Source: https://docs.leanmcp.com/quickstart This snippet shows how to install the LeanMCP CLI using Homebrew on macOS and then authenticate it with your API key. This allows you to manage MCP projects locally from your terminal. ```bash brew tap rosaboyle/mcli brew install mcli mcli auth login --api-key ``` -------------------------------- ### Perform First Setup for LeanMCP CLI Source: https://docs.leanmcp.com/cli/installation Authenticates the LeanMCP CLI tool with your API key, which is required for managing MCP projects. You need to obtain your API key from the LeanMCP Dashboard settings. ```bash mcli auth login --api-key ``` -------------------------------- ### Full Project Creation Workflow Source: https://docs.leanmcp.com/cli/projects Demonstrates the complete process of creating an MCP project, from navigating to the project directory to starting a build and checking its status. Includes commands and expected output. ```bash # 1. Navigate to your MCP project cd ~/my-awesome-mcp # 2. Create project with all details mcli projects create \ --name "Awesome File MCP" \ --description "Advanced file management for AI agents" \ --path . # 3. Monitor the upload progress # ✅ Creating project 'Awesome File MCP'... # ✅ Zipping 45 files... # ✅ Uploading to S3... # ✅ Updating project record... # ✅ Saving local configuration... # 4. Start a build mcli projects build proj_newprojectid # 5. Check status mcli projects show proj_newprojectid ``` -------------------------------- ### Create MCP Project with LeanMCP CLI Source: https://docs.leanmcp.com/quickstart This command demonstrates how to create a new MCP project using the LeanMCP CLI. It specifies the project name and the local directory containing the project files. Ensure you have authenticated the CLI first. ```bash mcli projects create --name "My MCP" --path ./ ``` -------------------------------- ### Install LeanMCP CLI via Direct Download (macOS) Source: https://docs.leanmcp.com/cli/installation Installs the LeanMCP CLI tool on macOS by directly downloading the executable. This method is suitable if Homebrew is not available. It includes downloading the appropriate binary for your architecture (Apple Silicon or Intel), making it executable, and moving it to a system-wide binary directory. ```bash # Apple Silicon (M1/M2/M3) curl -L https://github.com/rosaboyle/mcli-releases/releases/latest/download/mcli-darwin-arm64 -o mcli chmod +x mcli sudo mv mcli /usr/local/bin/ ``` ```bash # Intel curl -L https://github.com/rosaboyle/mcli-releases/releases/latest/download/mcli-darwin-amd64 -o mcli chmod +x mcli sudo mv mcli /usr/local/bin/ ``` -------------------------------- ### Batch Project Operations Source: https://docs.leanmcp.com/cli/projects Shows how to list all projects and their statuses, and how to iterate through the list to get detailed information for each project using a bash loop and 'jq'. ```bash # List all projects and show their status mcli projects list # Get detailed info for each project for id in $(mcli projects list --json | jq -r '.[].id'); do echo "=== Project $id ===" mcli projects show $id done ``` -------------------------------- ### Create MCP Project using LeanMCP CLI Source: https://docs.leanmcp.com/cli/projects Commands to create a new MCP project. Supports interactive mode for guided setup or flag-based creation with specified name, description, and path. It automatically handles file scanning, zipping, uploading, and local configuration saving. ```bash mcli projects create ``` ```bash mcli projects create --name "My MCP Server" --description "AI assistant for file management" --path ./my-project ``` ```bash # Navigate to your project directory cd ~/my-mcp-project # Create project interactively mcli projects create # CLI will prompt for: # - Project name: My File Manager MCP # - Description: Helps AI manage files and directories # - Directory path: . (current directory) # Progress tracking: # ✅ Collect project information # ✅ Create project record # ✅ Scan and zip files (respects .gitignore) # ✅ Upload to S3 # ✅ Update project record # ✅ Save local configuration (.leanmcp/config.json) ``` -------------------------------- ### Verify LeanMCP CLI Installation Source: https://docs.leanmcp.com/cli/installation Checks if the LeanMCP CLI tool has been installed correctly by displaying its version. This command should be run after installation to confirm the tool is accessible and functional. ```bash mcli --version ``` -------------------------------- ### Local Configuration File Schema for LeanMCP Projects Source: https://docs.leanmcp.com/cli/projects Example of the `.leanmcp/config.json` file generated after project creation. It stores project metadata, framework information, S3 location, and CLI settings like version and last sync time. ```json { "project": { "id": "proj_1234567890abcdef", "name": "My File Manager MCP", "description": "Helps AI manage files and directories", "framework": "typescript", "status": "created", "s3Location": "s3://bucket/projects/proj_123.zip" }, "cli": { "version": "1.0.0", "lastSync": "2024-01-15T10:30:00Z", "projectPath": "/Users/me/my-mcp-project" } } ``` -------------------------------- ### Create Project Source: https://docs.leanmcp.com/cli/projects Create a new MCP project and upload files from a specified directory. Supports interactive mode or using flags for configuration. ```APIDOC ## Create Project Create a new MCP project and upload files from a directory. ### Method `POST` (conceptual, as this is a CLI command) ### Endpoint `/projects` (conceptual, CLI command: `mcli projects create`) ### Parameters #### CLI Flags - `--name` (string) - Optional - The name for the new MCP project. - `--description` (string) - Optional - A description for the new MCP project. - `--path` (string) - Optional - The local directory path containing the project files. Defaults to the current directory. ### Request Example (CLI) ```bash mcli projects create --name "My MCP Server" --description "AI assistant for file management" --path ./my-project ``` ### Response (CLI Output & Local Config) Upon successful creation, a `.leanmcp/config.json` file is saved locally, containing project details. #### Local Configuration Example (`.leanmcp/config.json`) ```json { "project": { "id": "proj_1234567890abcdef", "name": "My File Manager MCP", "description": "Helps AI manage files and directories", "framework": "typescript", "status": "created", "s3Location": "s3://bucket/projects/proj_123.zip" }, "cli": { "version": "1.0.0", "lastSync": "2024-01-15T10:30:00Z", "projectPath": "/Users/me/my-mcp-project" } } ``` ``` -------------------------------- ### Build Simple Tool MCP Source: https://docs.leanmcp.com/api-reference/build JSON configuration for building an MCP server with only tools. This example defines a 'calculator' MCP with an 'add' tool. ```json { "name": "calculator", "template": "basic", "tools": [ { "name": "add", "description": "Add two numbers together", "inputSchema": { "type": "object", "properties": { "a": {"type": "number"}, "b": {"type": "number"} } } } ] } ``` -------------------------------- ### Build Management Source: https://docs.leanmcp.com/cli/projects Manage builds for your MCP projects, including starting a new build and listing existing builds. ```APIDOC ## Build Management Manage builds for your MCP projects. ### Start New Build Trigger a new build for your project. ### Method `POST` (conceptual, as this is a CLI command) ### Endpoint `/projects/{project-id}/build` (conceptual, CLI command: `mcli projects build `) ### Parameters #### Path Parameters - **project-id** (string) - Required - The unique identifier of the project to build. ### Request Example (CLI) ```bash mcli projects build proj_abc123 ``` ### Response (CLI Output) Provides confirmation and details about the initiated build. **Output Example:** ``` 🔨 Starting build for project proj_abc123... ✅ Build started successfully! Build ID: build_xyz789 Status: queued Created: 2024-01-15 12:00:00 ``` ### List Project Builds View all builds associated with a specific project. ### Method `GET` (conceptual, as this is a CLI command) ### Endpoint `/projects/{project-id}/builds` (conceptual, CLI command: `mcli projects builds `) ### Parameters #### Path Parameters - **project-id** (string) - Required - The unique identifier of the project whose builds to list. ### Request Example (CLI) ```bash mcli projects builds proj_abc123 ``` ### Response (CLI Output) Outputs a table detailing the builds for the specified project. **Output Example:** ``` 🔨 Fetching builds for project proj_abc123... Found 5 build(s): ┌─────────────────┬─────────────┬─────────────────────┬──────────────┐ │ Build ID │ Status │ Created │ Duration │ ├─────────────────┼─────────────┼─────────────────────┼──────────────┤ │ build_xyz789 │ succeeded │ 2024-01-15 12:00:00 │ 2m 34s │ │ build_abc456 │ succeeded │ 2024-01-15 10:30:00 │ 1m 45s │ │ build_def123 │ failed │ 2024-01-14 15:20:00 │ 45s │ │ build_ghi890 │ succeeded │ 2024-01-14 09:15:00 │ 2m 12s │ │ build_jkl567 │ succeeded │ 2024-01-13 16:30:00 │ 1m 58s │ └─────────────────┴─────────────┴─────────────────────┴──────────────┘ ``` ``` -------------------------------- ### Install LeanMCP CLI using Homebrew (macOS) Source: https://docs.leanmcp.com/cli/installation Installs the LeanMCP CLI tool on macOS using the Homebrew package manager. This is the recommended installation method for macOS users. It requires Homebrew to be installed. ```bash brew tap rosaboyle/mcli brew install mcli ``` -------------------------------- ### List Projects Source: https://docs.leanmcp.com/cli/projects View a list of all your existing MCP projects, including their ID, Name, Status, and Creation date. ```APIDOC ## List Projects View all your projects. ### Method `GET` (conceptual, as this is a CLI command) ### Endpoint `/projects` (conceptual, CLI command: `mcli projects list`) ### Parameters None ### Request Example (CLI) ```bash mcli projects list ``` ### Response (CLI Output) The command outputs a table listing projects. **Output Example:** ``` 📋 Fetching projects... Found 3 project(s): ┌─────────────────────┬─────────────────────┬─────────────┬─────────────────────┐ │ ID │ Name │ Status │ Created │ ├─────────────────────┼─────────────────────┼─────────────┼─────────────────────┤ │ proj_abc123 │ File Manager MCP │ deployed │ 2024-01-15 10:30:00 │ │ proj_def456 │ Email Assistant │ building │ 2024-01-14 15:20:00 │ │ proj_ghi789 │ Database Helper │ created │ 2024-01-13 09:15:00 │ └─────────────────────┴─────────────────────┴─────────────┴─────────────────────┘ ``` ``` -------------------------------- ### Show Project Details Source: https://docs.leanmcp.com/cli/projects Retrieve detailed information about a specific MCP project using its project ID. ```APIDOC ## Show Project Details Get detailed information about a specific project. ### Method `GET` (conceptual, as this is a CLI command) ### Endpoint `/projects/{project-id}` (conceptual, CLI command: `mcli projects show `) ### Parameters #### Path Parameters - **project-id** (string) - Required - The unique identifier of the project to retrieve. ### Request Example (CLI) ```bash mcli projects show proj_abc123 ``` ### Response (CLI Output) The command outputs a detailed view of the specified project. **Output Example:** ``` 🔍 Fetching project proj_abc123... Project Details: ┌─────────────────┬─────────────────────────────┐ │ ID │ proj_abc123 │ │ Name │ File Manager MCP │ │ Description │ Helps AI manage files │ │ Framework │ typescript │ │ Status │ deployed │ │ Repository URL │ https://github.com/... │ │ S3 Location │ s3://bucket/projects/... │ │ Created │ 2024-01-15 10:30:00 │ │ Updated │ 2024-01-15 11:45:00 │ └─────────────────┴─────────────────────────────┘ ``` ``` -------------------------------- ### Build MCP Server with cURL Source: https://docs.leanmcp.com/api-reference/build Example request to build an MCP server using cURL. This demonstrates how to send a POST request with a JSON payload containing server configuration, including name, template, tools, and resources. ```bash curl -X POST https://api.leanmcp.com/v1/build \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "email-assistant", "template": "basic", "tools": [ { "name": "send_email", "description": "Send an email to someone", "inputSchema": { "type": "object", "properties": { "to": {"type": "string"}, "subject": {"type": "string"}, "body": {"type": "string"} }, "required": ["to", "subject", "body"] } } ], "resources": [ { "uri": "user://contacts", "name": "User Contacts", "description": "List of user contact information", "mimeType": "application/json" } ] }' ``` -------------------------------- ### Build Data Access MCP Source: https://docs.leanmcp.com/api-reference/build JSON configuration for building an MCP server that provides AI access to user data. This example includes 'User Profile' and 'User Settings' resources. ```json { "name": "user-data", "template": "basic", "resources": [ { "uri": "user://profile", "name": "User Profile", "description": "Current user profile information" }, { "uri": "user://settings", "name": "User Settings", "description": "User application settings" } ] } ``` -------------------------------- ### Build Failure Handling Source: https://docs.leanmcp.com/cli/projects Displays the error message for build failures and advises checking build logs in the dashboard or verifying project configuration. ```bash ❌ Build failed with status: failed **Solutions:** * Check build logs in the dashboard * Verify project configuration * Ensure all dependencies are included ``` -------------------------------- ### Deploy MCP Server to Staging using cURL Source: https://docs.leanmcp.com/api-reference/deploy This example shows how to deploy an MCP server to a staging environment using cURL. It requires the MCP ID and environment. Optional configuration parameters can be included as needed. Replace 'YOUR_API_KEY' with your valid API key. ```bash curl -X POST https://api.leanmcp.com/v1/deploy \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mcp_id": "mcp_abc123def456", "environment": "staging" }' ``` -------------------------------- ### LeanMCP CLI Working Directory Context Source: https://docs.leanmcp.com/cli/projects Demonstrates how certain LeanMCP CLI commands can automatically detect the current project context if the working directory contains a `.leanmcp/config.json` file. ```bash # In a directory with .leanmcp/config.json cd ~/my-mcp-project ``` -------------------------------- ### Project Not Found Error Handling Source: https://docs.leanmcp.com/cli/projects Displays the error message for when a requested project resource cannot be found. ```bash ❌ Project not found The requested resource was not found. ``` -------------------------------- ### List All MCP Projects using LeanMCP CLI Source: https://docs.leanmcp.com/cli/projects Command to display a list of all managed MCP projects. The output includes project ID, name, status, and creation timestamp, presented in a tabular format. ```bash mcli projects list ``` -------------------------------- ### Authentication Error Handling Source: https://docs.leanmcp.com/cli/projects Displays the error message for authentication issues and provides the command to log in using an API key. ```bash ❌ Not authenticated Please run: mcli auth login --api-key ``` -------------------------------- ### Example JSON for AI Agent Prompt Template Source: https://docs.leanmcp.com/building/introduction This JSON defines a 'meeting_invite' prompt template for AI agents. It includes a name, a description, and a template string with placeholders like '{name}', '{date}', and '{time}'. This allows the AI to generate customized meeting invitations. ```json { "name": "meeting_invite", "description": "Create a meeting invite email", "template": "Hi {name}, let\'s meet on {date} at {time}..." } ``` -------------------------------- ### MCP Server Build Success Response Source: https://docs.leanmcp.com/api-reference/build Example of a successful response after building an MCP server. It includes the success status, server ID, name, build status, URL, and build time. ```json { "success": true, "data": { "mcp_id": "mcp_abc123def456", "name": "email-assistant", "status": "ready", "url": "https://mcp-abc123def456.leanmcp.com", "build_time": 8.5 }, "meta": { "request_id": "req_789xyz", "timestamp": "2023-12-01T12:00:00Z" } } ``` -------------------------------- ### MCP Prompt Testing Strategy Source: https://docs.leanmcp.com/building/best-practices Provides examples of realistic test prompts for evaluating MCP designs. It emphasizes testing for AI's ability to select the right tools based on natural language requests, rather than direct commands. ```text Test prompts: ❌ "Call the send_email function" ✅ "Email John about tomorrow's meeting" ✅ "Let Sarah know I'll be late" ✅ "Send a thank you note to the client" ``` -------------------------------- ### Trigger and Manage Builds for MCP Projects using LeanMCP CLI Source: https://docs.leanmcp.com/cli/projects Commands to manage the build process for MCP projects. Includes triggering a new build for a project by its ID and listing all historical builds associated with a project, showing their status and duration. ```bash mcli projects build ``` ```bash mcli projects build proj_abc123 ``` ```bash mcli projects builds ``` ```bash mcli projects builds proj_abc123 ``` -------------------------------- ### Project Operations (ID from Config) Source: https://docs.leanmcp.com/cli/projects Commands to build and show project details using the project ID found in the local .leanmcp/config.json file. Requires 'jq' to parse JSON. ```bash mcli projects build $(cat .leanmcp/config.json | jq -r '.project.id') mcli projects show $(cat .leanmcp/config.json | jq -r '.project.id') ``` -------------------------------- ### S3 Upload Failure Handling Source: https://docs.leanmcp.com/cli/projects Displays the error message for S3 upload failures due to connection timeouts and suggests solutions like checking internet connection or reducing project size. ```bash ❌ S3 upload failed: connection timeout **Solutions:** * Check internet connection * Retry the operation * Reduce project size if needed ``` -------------------------------- ### Example Success Response for MCP Server Deployment Source: https://docs.leanmcp.com/api-reference/deploy This JSON object represents a successful deployment response. It includes details such as the deployment ID, status, URL, deployment time, and health check endpoint. ```json { "success": true, "data": { "deployment_id": "deploy_xyz789abc", "status": "deployed", "url": "https://my-mcp.example.com", "deploy_time": 45.2, "health_check": "https://my-mcp.example.com/health" }, "meta": { "request_id": "req_deploy_456", "timestamp": "2023-12-01T12:00:00Z" } } ``` -------------------------------- ### Show Details of a Specific MCP Project using LeanMCP CLI Source: https://docs.leanmcp.com/cli/projects Command to retrieve detailed information for a specified MCP project ID. The output includes ID, Name, Description, Framework, Status, Repository URL, S3 Location, Created, and Updated timestamps. ```bash mcli projects show ``` ```bash mcli projects show proj_abc123 ``` -------------------------------- ### MCP Resource URI Design Source: https://docs.leanmcp.com/building/best-practices Provides examples of meaningful and clear URIs for MCP resources, contrasting them with generic or uninformative ones. Well-designed URIs help AI agents understand resource content. ```text user://profile # User's profile data contacts://list # List of contacts calendar://events # Calendar events tasks://pending # Pending tasks ``` ```text resource://1 # What is resource 1? data://x # What is x? api://endpoint # Too generic ``` -------------------------------- ### Example JSON for AI Agent Tool Source: https://docs.leanmcp.com/building/introduction This JSON structure defines a 'send_email' tool that an AI agent can use. It specifies the tool's name, a description of its function, and the parameters it requires, such as 'to', 'subject', and 'body'. This helps the AI understand how to invoke the tool correctly. ```json { "name": "send_email", "description": "Send an email to someone", "parameters": { "to": "email address", "subject": "email subject", "body": "email content" } } ``` -------------------------------- ### Example JSON for AI Agent Resource Source: https://docs.leanmcp.com/building/introduction This JSON snippet represents a 'User Contacts' resource accessible to an AI agent. It includes a URI for accessing the data, a name for the resource, and a description of its content, enabling the AI to retrieve and understand user contact information. ```json { "uri": "user://contacts", "name": "User Contacts", "description": "List of user contact information" } ``` -------------------------------- ### Authenticate API Requests with API Key Source: https://docs.leanmcp.com/api-reference/introduction All API requests must include an API key in the Authorization header. Obtain your API key from the LeanMCP Dashboard. This example shows a typical curl command for authentication. ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.leanmcp.com/v1/build ``` -------------------------------- ### Make POST Request to Test MCP Server (Bash) Source: https://docs.leanmcp.com/api-reference/test Example of how to make a POST request to the MCP server testing API using curl. This includes setting authentication, content type, and the JSON payload with parameters like mcp_id, message, and optional context. ```bash curl -X POST https://api.leanmcp.com/v1/test \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mcp_id": "mcp_abc123def456", "message": "Send an email to john@example.com saying hello", "ai_model": "claude-3", "context": { "user_id": "user_123" } }' ``` -------------------------------- ### Example Success Response from MCP Server Test Source: https://docs.leanmcp.com/api-reference/test Demonstrates a successful response from the MCP server testing API. It includes a success flag, AI agent's response, tools utilized, resources accessed, execution time, and success rate. ```json { "success": true, "data": { "ai_response": "I've sent an email to john@example.com with the subject 'Hello' and a friendly greeting message.", "tools_used": ["send_email"], "resources_accessed": ["user://contacts"], "execution_time": 2.3, "success_rate": 1.0 }, "meta": { "request_id": "req_test_789", "timestamp": "2023-12-01T12:00:00Z" } } ``` -------------------------------- ### LeanMCP CLI Authentication Failed Error Source: https://docs.leanmcp.com/cli/authentication Example of an 'Authentication failed' error message from the LeanMCP CLI, indicating an invalid or expired API key. The message suggests re-running the login command with a valid key. ```bash ❌ Authentication failed Your API key is invalid or has expired. Please run: mcli auth login --api-key ``` -------------------------------- ### LeanMCP CLI Access Denied Error Source: https://docs.leanmcp.com/cli/authentication Example of an 'Access denied' error message from the LeanMCP CLI, indicating insufficient permissions for the provided API key. The message suggests checking API key scopes or creating a new key with appropriate permissions. ```bash ❌ Access denied Your API key doesn't have permission to [action]. ``` -------------------------------- ### MCP Server Test Payload for Edge Cases (JSON) Source: https://docs.leanmcp.com/api-reference/test Example JSON payload designed to test edge cases or ambiguous requests with an MCP server. It includes minimal parameters to see how the AI handles unclear instructions. ```json { "mcp_id": "your-mcp-id", "message": "Do that thing with the data", "ai_model": "claude-3" } ``` -------------------------------- ### GET /v1/deploy/{deployment_id}/status Source: https://docs.leanmcp.com/api-reference/deploy Retrieves the current status of a specific MCP server deployment. ```APIDOC ## GET /v1/deploy/{deployment_id}/status ### Description Checks the status of a specific MCP server deployment. This endpoint is useful for monitoring the progress and outcome of a deployment. ### Method GET ### Endpoint /v1/deploy/{deployment_id}/status ### Parameters #### Path Parameters - **deployment_id** (string) - Required - The unique identifier of the deployment to check. ### Response #### Success Response (200) - **status** (string) - The current status of the deployment. Possible values: `deploying`, `deployed`, `failed`, `stopped`. ### Response Example ```json { "status": "deployed" } ``` ``` -------------------------------- ### POST /v1/build Source: https://docs.leanmcp.com/api-reference/build Build a new MCP server using provided templates, tools, resources, and prompts. ```APIDOC ## POST /v1/build ### Description Build a new MCP server with your tools, resources, and prompts. ### Method POST ### Endpoint /v1/build ### Parameters #### Request Body - **name** (string) - Required - Name of your MCP server - **template** (string) - Required - Template to use. Options: `basic`, `advanced`, `custom` - **tools** (array) - Optional - Array of tools your MCP provides - **Tool Object** - **name** (string) - Required - Tool identifier (e.g., "send_email") - **description** (string) - Required - What this tool does (helps AI understand when to use it) - **inputSchema** (object) - Required - JSON Schema for tool inputs - **resources** (array) - Optional - Array of resources your MCP provides - **Resource Object** - **uri** (string) - Required - Resource URI (e.g., "user://profile") - **name** (string) - Required - Human-readable name - **description** (string) - Required - What data this resource provides - **mimeType** (string) - Optional - Content type (default: "application/json") - **prompts** (array) - Optional - Array of prompt templates your MCP provides - **Prompt Object** - **name** (string) - Required - Prompt identifier - **description** (string) - Required - What this prompt helps with - **template** (string) - Required - Prompt template with variables ### Request Example ```json { "name": "email-assistant", "template": "basic", "tools": [ { "name": "send_email", "description": "Send an email to someone", "inputSchema": { "type": "object", "properties": { "to": {"type": "string"}, "subject": {"type": "string"}, "body": {"type": "string"} }, "required": ["to", "subject", "body"] } } ], "resources": [ { "uri": "user://contacts", "name": "User Contacts", "description": "List of user contact information", "mimeType": "application/json" } ] } ``` ### Response #### Success Response (200) - **success** (boolean) - Whether the build succeeded - **data** (object) - Build data - **mcp_id** (string) - Unique ID for your MCP server - **name** (string) - Name of your MCP server - **status** (string) - Build status: "building", "ready", "failed" - **url** (string) - URL where your MCP is accessible - **build_time** (number) - Build time in seconds #### Response Example ```json { "success": true, "data": { "mcp_id": "mcp_abc123def456", "name": "email-assistant", "status": "ready", "url": "https://mcp-abc123def456.leanmcp.com", "build_time": 8.5 }, "meta": { "request_id": "req_789xyz", "timestamp": "2023-12-01T12:00:00Z" } } ``` ``` -------------------------------- ### Deploy MCP Server to Production using cURL Source: https://docs.leanmcp.com/api-reference/deploy This snippet demonstrates how to deploy an MCP server to a production environment using a cURL command. It includes parameters for MCP ID, environment, and optional configuration like custom domains, scaling, and environment variables. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```bash curl -X POST https://api.leanmcp.com/v1/deploy \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "mcp_id": "mcp_abc123def456", "environment": "production", "config": { "domain": "my-mcp.example.com", "scaling": { "min_instances": 2, "max_instances": 20 }, "env_vars": { "API_KEY": "your-api-key", "DEBUG": "false" } } }' ``` -------------------------------- ### Delete Project Source: https://docs.leanmcp.com/cli/projects Permanently remove an MCP project and all its associated data. Requires a `--force` flag for confirmation. ```APIDOC ## Delete Project Remove a project permanently. ### Method `DELETE` (conceptual, as this is a CLI command) ### Endpoint `/projects/{project-id}` (conceptual, CLI command: `mcli projects delete `) ### Parameters #### Path Parameters - **project-id** (string) - Required - The unique identifier of the project to delete. #### Query Parameters - `--force` (boolean) - Required - Use this flag to confirm the permanent deletion. Without it, a warning will be displayed. ### Request Example (CLI) To confirm deletion: ```bash mcli projects delete proj_abc123 --force ``` To see the warning without deleting: ```bash mcli projects delete proj_abc123 ``` ### Response (CLI Output) **With `--force` flag:** ``` 🗑️ Deleting project proj_abc123... ✅ Project deleted successfully! ``` **Without `--force` flag:** ``` ⚠️ WARNING: This will permanently delete the project and all associated data. Use --force to confirm deletion. ``` ``` -------------------------------- ### MCP Tool Naming Conventions Source: https://docs.leanmcp.com/building/best-practices Demonstrates best practices for naming MCP tools to ensure clarity and avoid confusion for AI agents. It contrasts good, action-oriented names with unclear or ambiguous ones. ```json ["create_user"] ``` ```json [ "create_user", "add_user", "new_user", "register_user", "signup_user" ] ``` ```json { "send_email": "✅ Clear action", "email": "❌ Unclear if reading or sending", "get_email": "✅ Clear action", "email_data": "❌ What happens to the data?" } ``` ```json { "get_user": "✅ Consistent pattern", "create_user": "✅ Consistent pattern", "fetchUserData": "❌ Different pattern", "user_delete": "❌ Different pattern" } ``` ```json // ❌ Confusing for AI ["email_send", "send_email", "mail_send", "dispatch_email"] // ✅ Pick one clear name ["send_email"] ``` -------------------------------- ### Get MCP Server Deployment Status using cURL Source: https://docs.leanmcp.com/api-reference/deploy This command retrieves the deployment status of a specific MCP server deployment. Replace 'deploy_xyz789abc' with the actual deployment ID you want to check. ```bash GET https://api.leanmcp.com/v1/deploy/deploy_xyz789abc/status ``` -------------------------------- ### Build an MCP Server Request Source: https://docs.leanmcp.com/api-reference/introduction Initiates the process of building an MCP server. Requires a server name, template, and optionally tools and resources. The request is made using a POST method to the /v1/build endpoint. ```bash POST /v1/build { "name": "my-mcp-server", "template": "basic", "tools": [...], "resources": [...] } ``` -------------------------------- ### Build an MCP Server Source: https://docs.leanmcp.com/api-reference/introduction Build an MCP server from a template, specifying tools and resources. ```APIDOC ## POST /v1/build ### Description Build an MCP server from a template, specifying tools and resources. ### Method POST ### Endpoint /v1/build ### Parameters #### Request Body - **name** (string) - Required - The name of the MCP server. - **template** (string) - Required - The template to use for building the MCP server. - **tools** (array) - Optional - A list of tools to include. - **resources** (array) - Optional - A list of resources to include. ### Request Example ```json { "name": "my-mcp-server", "template": "basic", "tools": [...], "resources": [...] } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - The response data, specific to the request. - **meta** (object) - Metadata about the request, including request ID and timestamp. #### Response Example ```json { "success": true, "data": { /* response data */ }, "meta": { "request_id": "req_123", "timestamp": "2023-12-01T12:00:00Z" } } ``` ``` -------------------------------- ### POST /v1/deploy Source: https://docs.leanmcp.com/api-reference/deploy Deploys an MCP server to a specified environment. Supports custom configurations for domains, scaling, and environment variables. ```APIDOC ## POST /v1/deploy ### Description Deploys your tested MCP server to production, staging, or development environments. Allows for custom configurations such as domains, auto-scaling, and environment variables. ### Method POST ### Endpoint /v1/deploy ### Parameters #### Request Body - **mcp_id** (string) - Required - ID of the MCP server to deploy - **environment** (string) - Required - Deployment environment. Options: `production`, `staging`, `development` - **config** (object) - Optional - Deployment configuration - **domain** (string) - Optional - Custom domain for your MCP - **scaling** (object) - Optional - Auto-scaling configuration - **min_instances** (number) - Optional - Minimum number of instances (default: 1) - **max_instances** (number) - Optional - Maximum number of instances (default: 10) - **env_vars** (object) - Optional - Environment variables for your MCP ### Request Example ```json { "mcp_id": "mcp_abc123def456", "environment": "production", "config": { "domain": "my-mcp.example.com", "scaling": { "min_instances": 2, "max_instances": 20 }, "env_vars": { "API_KEY": "your-api-key", "DEBUG": "false" } } } ``` ### Response #### Success Response (200) - **success** (boolean) - Whether the deployment succeeded - **data** (object) - Deployment details - **deployment_id** (string) - Unique deployment ID - **status** (string) - Deployment status: "deploying", "deployed", "failed" - **url** (string) - Production URL of your MCP - **deploy_time** (number) - Deployment time in seconds - **health_check** (string) - Health check endpoint URL #### Response Example ```json { "success": true, "data": { "deployment_id": "deploy_xyz789abc", "status": "deployed", "url": "https://my-mcp.example.com", "deploy_time": 45.2, "health_check": "https://my-mcp.example.com/health" } } ``` ``` -------------------------------- ### Delete MCP Project using LeanMCP CLI Source: https://docs.leanmcp.com/cli/projects Command to permanently delete an MCP project. Requires the `--force` flag to confirm deletion, otherwise, it will display a warning prompt. This action removes the project and all its associated data. ```bash mcli projects delete --force ``` ```bash mcli projects delete proj_abc123 --force ``` ```bash mcli projects delete proj_abc123 ⚠️ WARNING: This will permanently delete the project and all associated data. Use --force to confirm deletion. ``` -------------------------------- ### Deploy to Production Source: https://docs.leanmcp.com/api-reference/introduction Deploy an MCP server to a specified environment, such as production. ```APIDOC ## POST /v1/deploy ### Description Deploy an MCP server to a specified environment, such as production. ### Method POST ### Endpoint /v1/deploy ### Parameters #### Request Body - **mcp_id** (string) - Required - The ID of the MCP server to deploy. - **environment** (string) - Required - The environment to deploy to (e.g., 'production'). ### Request Example ```json { "mcp_id": "your-mcp-id", "environment": "production" } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - The response data, specific to the request. - **meta** (object) - Metadata about the request, including request ID and timestamp. #### Response Example ```json { "success": true, "data": { /* response data */ }, "meta": { "request_id": "req_123", "timestamp": "2023-12-01T12:00:00Z" } } ``` ``` -------------------------------- ### MCP Tool Description Clarity Source: https://docs.leanmcp.com/building/best-practices Illustrates the importance of writing specific and informative descriptions for MCP tools. Vague descriptions hinder AI understanding, while clear ones improve tool selection and usage. ```json { "name": "calculate_tax", "description": "Calculate tax amount for a purchase based on item price and location" } ``` ```json { "name": "process_data", "description": "Processes data" } ``` -------------------------------- ### MCP Resource Description Specificity Source: https://docs.leanmcp.com/building/best-practices Illustrates the difference between vague and specific descriptions for MCP resources. Specific descriptions enhance AI's ability to understand and utilize resource data correctly. ```json { "uri": "user://profile", "description": "User profile including name, email, preferences, and account settings" } ``` ```json { "uri": "user://data", "description": "User data" } ``` -------------------------------- ### MCP Prompt Template Design Source: https://docs.leanmcp.com/building/best-practices Compares a simple, effective prompt template with variables to a complex one. Good templates are flexible without being overly complicated for AI interpretation. ```text Hi {name}, Your meeting with {attendee} is scheduled for {date} at {time}. Best regards, {sender} ``` ```text {greeting_type} {name_with_title}, {conditional_text_based_on_time_of_day} {meeting_type} with {attendee_list_formatted} is {scheduling_verb} for {date_formatted_long} at {time_with_timezone}. {closing_based_on_relationship}, {sender_with_signature} ``` -------------------------------- ### Deploy MCP to Production Environment Source: https://docs.leanmcp.com/api-reference/introduction Deploys a specified MCP to a target environment, typically production. This operation uses a POST request to the /v1/deploy endpoint and requires the MCP ID and environment name. ```bash POST /v1/deploy { "mcp_id": "your-mcp-id", "environment": "production" } ``` -------------------------------- ### LeanMCP CLI Login Command Source: https://docs.leanmcp.com/cli/authentication Logs into the LeanMCP CLI using an API key. Replace with your actual API key obtained from the LeanMCP dashboard. The command expects the API key as an argument. ```bash mcli auth login --api-key ``` ```bash mcli auth login --api-key airtrain_1234567890abcdef... ``` -------------------------------- ### MCP Error-Resistant Parameters Source: https://docs.leanmcp.com/building/best-practices Demonstrates how to design MCP parameters to be error-resistant, favoring structured inputs over free-text fields that require parsing. This reduces the likelihood of AI input errors. ```json { "year": {"type": "integer", "minimum": 2020, "maximum": 2030}, "month": {"type": "integer", "minimum": 1, "maximum": 12}, "day": {"type": "integer", "minimum": 1, "maximum": 31} } ``` ```json { "date": {"type": "string", "description": "Date in any format"} } ``` -------------------------------- ### POST /v1/test Source: https://docs.leanmcp.com/api-reference/test Tests an MCP server by sending a message to an AI agent and observing its interaction with the server. ```APIDOC ## POST /v1/test ### Description Tests an MCP server by sending a message to an AI agent and observing its interaction with the server. This endpoint allows you to simulate AI agent behavior and assess its capabilities. ### Method POST ### Endpoint /v1/test ### Parameters #### Request Body - **mcp_id** (string) - Required - ID of the MCP server to test - **message** (string) - Required - Message to send to the AI agent - **ai_model** (string) - Optional - AI model to use for testing. Options: `claude-3`, `gpt-4`, `gpt-3.5`. Default: `claude-3` - **context** (object) - Optional - Additional context for the AI agent - **user_id** (string) - Optional - User ID for resource access - **session_data** (object) - Optional - Session-specific data ### Request Example ```json { "mcp_id": "mcp_abc123def456", "message": "Send an email to john@example.com saying hello", "ai_model": "claude-3", "context": { "user_id": "user_123" } } ``` ### Response #### Success Response (200) - **success** (boolean) - Whether the test completed successfully - **data** (object) - Test Results - **ai_response** (string) - The AI agent's response - **tools_used** (array) - List of tools the AI called - **resources_accessed** (array) - List of resources the AI accessed - **execution_time** (number) - Test execution time in seconds - **success_rate** (number) - Success rate of tool calls (0-1) #### Response Example ```json { "success": true, "data": { "ai_response": "I've sent an email to john@example.com with the subject 'Hello' and a friendly greeting message.", "tools_used": ["send_email"], "resources_accessed": ["user://contacts"], "execution_time": 2.3, "success_rate": 1.0 }, "meta": { "request_id": "req_test_789", "timestamp": "2023-12-01T12:00:00Z" } } ``` ``` -------------------------------- ### MCP Schema Simplicity Source: https://docs.leanmcp.com/building/best-practices Highlights the need for simple and flat input schemas in MCP designs. Complex, nested schemas can lead to errors for AI agents, whereas flat structures are easier to parse. ```json { "properties": { "user_id": {"type": "string"}, "email": {"type": "string"}, "name": {"type": "string"} } } ``` ```json { "properties": { "user": { "type": "object", "properties": { "profile": { "type": "object", "properties": { "settings": { /* more nesting... */ } } } } } } } ```