{"type":"mcp_server","name":"LitServe","description":"**Concise Description:**\n\nDeploy agents, models, RAG & pipelines easily. MCP server simplifies AI deployment. No YAML/MLOps needed.","category":"AI","language":"Python","stars":3920,"forks":231,"owner":"Lightning-AI","github_url":"https://github.com/Lightning-AI/LitServe","homepage":"https://lightning.ai/litserve","setup":"## Setup\n\nThis section provides instructions for setting up and installing LitServe.\n\n### 1. Prerequisites\n\n*   **Python:** Ensure you have Python 3.8 or higher installed.\n*   **Pip:** Make sure you have pip installed. It usually comes with Python.\n\n### 2. Installation\n\nInstall LitServe using pip:\n\n```bash\npip install litserve\n```\n\n### 3. Configuration\n\nLitServe requires minimal configuration. The core configuration is done within your Python code when defining your `LitAPI` class and `LitServer` instance.\n\n### 4. Environment Variables\n\n*   **OPENAI_API_KEY (Optional):** If you plan to use the `NewsAgent` example or any other functionality that interacts with the OpenAI API, you'll need to set the `OPENAI_API_KEY` environment variable with your OpenAI API key.\n\n    ```bash\n    export OPENAI_API_KEY=\"YOUR_OPENAI_API_KEY\"\n    ```\n\n### 5. Example Usage\n\nHere's a basic example to verify your installation:\n\n```python\nimport litserve as ls\n\n# define the api to include any number of models, dbs, etc...\nclass InferencePipeline(ls.LitAPI):\n    def setup(self, device):\n        self.model1 = lambda x: x**2\n        self.model2 = lambda x: x**3\n\n    def predict(self, request):\n        x = request[\"input\"]    \n        # perform calculations using both models\n        a = self.model1(x)\n        b = self.model2(x)\n        c = a + b\n        return {\"output\": c}\n\nif __name__ == \"__main__\":\n    # 12+ features like batching, streaming, etc...\n    server = ls.LitServer(InferencePipeline(max_batch_size=1), accelerator=\"auto\")\n    server.run(port=8000)\n```\n\nSave this code to a file named `server.py` and run it:\n\n```bash\npython server.py\n```\n\nYou can then test the server using `curl`:\n\n```bash\ncurl -X POST http://127.0.0.1:8000/predict -H \"Content-Type: application/json\" -d '{\"input\": 4.0}'\n```","tools":"## Available Tools\n\nThe following table summarizes the features of LitServe, comparing self-managed deployments with fully managed deployments on Lightning AI:\n\n| Feature                                                                 | Self Managed                      | Fully Managed on Lightning","faq":null,"created_at":"2023-12-12T14:45:03+00:00","updated_at":"2025-07-07T09:00:40+00:00","source_url":"https://model-context-protocol.com/servers/litserve","related_articles":[]}