Lihil
2X faster ASGI web framework for python, offering high-level development, low-level performance.
What is Lihil?
Lihil is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 2x faster asgi web framework for python, offering high-level development, low-level performance.
2X faster ASGI web framework for python, offering high-level development, low-level performance.
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- 2X faster ASGI web framework for python, offering high-level
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx lihilConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Lihil
Lihil is a high-performance, strictly-typed ASGI web framework for Python 3.10+ that benchmarks 50–100% faster than comparable Python frameworks by combining msgspec-based serialization with async-first design. It provides enterprise-grade features out of the box — dependency injection, automatic request parameter parsing and validation from type hints, Server-Sent Events (SSE), WebSocket hubs with class-based channels, and upcoming first-class MCP (Model Context Protocol) support for building AI-agent-accessible endpoints. Developers building production API services or AI-agent backends who need both developer ergonomics and raw ASGI throughput choose Lihil over FastAPI or Starlette.
Prerequisites
- Python 3.10 or higher
- pip or uv package manager
- An ASGI server such as uvicorn (included in the standard extras)
- Optional: An MCP-compatible client to consume MCP endpoints once that feature ships
Install Lihil with standard extras
Install the lihil package with the standard extras, which bundles uvicorn for immediate use.
pip install "lihil[standard]"Create a basic Lihil application
Define routes using the Route and sub-route API. Lihil automatically parses and validates parameters from type hints across query strings, path params, headers, cookies, and request bodies.
from lihil import Lihil, Route
users = Route("/users")
@users.get
async def list_users() -> list[str]:
return ["alice", "bob"]
app = Lihil(users)Run the application with uvicorn
Start the ASGI server pointing at your application instance. Lihil will be available on http://localhost:8000.
uvicorn myapp:app --reloadAdd Server-Sent Events for AI streaming
Lihil has first-class SSE support, making it straightforward to stream LLM tokens to clients. Use the SSE and Stream return types on your endpoint.
from lihil import Route, SSE
from typing import AsyncGenerator
chat = Route("/chat")
@chat.sub("/stream").post
async def stream_tokens(question: str) -> AsyncGenerator[SSE, None]:
yield SSE(event="open")
# stream LLM tokens here
yield SSE(event="token", data={"text": "Hello"})
yield SSE(event="close")Use WebSocket hubs for real-time channels
Lihil's SocketHub provides class-based WebSocket channels with typed topic parameters, fan-out broadcasting, and dependency injection.
from lihil import Lihil
from lihil.ws import SocketHub, ChannelBase, Topic
hub = SocketHub("/ws")
@hub.channel
class ChatChannel(ChannelBase):
topic = Topic("room:{room_id}")
async def on_chat(self, room_id: str, text: str) -> None:
await self.publish({"text": text}, event="chat")
app = Lihil(hub)Lihil Examples
Client configuration
Lihil is a web framework, not a standalone MCP server package. A sample config showing how an AI client could call a Lihil-powered API over HTTP.
{
"mcpServers": {
"lihil": {
"command": "npx",
"args": ["lihil"]
}
}
}Prompts to try
Example questions to ask an AI assistant connected to a Lihil-powered API backend.
- "Call the /users endpoint and list all registered users."
- "Stream a response from the /chat/stream endpoint with my question."
- "What routes does this Lihil API expose?"
- "Send a POST request to /items with this JSON body and show the response."Troubleshooting Lihil
Import errors or 'module not found' for lihil after install
Ensure you are using Python 3.10 or higher. Run 'python --version' to check. Install into the correct environment using 'pip install lihil[standard]' with the active virtualenv.
WebSocket hub channels do not receive broadcast messages
Confirm you are calling 'await self.publish(payload, event="...")' inside a channel method and that the hub is mounted on the Lihil app via 'app = Lihil(hub)'. Do not mix HTTP Route trees with WebSocketRoute trees when calling Lihil().
SSE streaming endpoint hangs or closes immediately
Yield at least one SSE event before any long-running awaits. Ensure the return type annotation is 'AsyncGenerator[SSE, None]' and that the ASGI server supports streaming (uvicorn does by default).
Frequently Asked Questions about Lihil
What is Lihil?
Lihil is a Model Context Protocol (MCP) server that 2x faster asgi web framework for python, offering high-level development, low-level performance. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Lihil?
Follow the installation instructions on the Lihil GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with Lihil?
Lihil works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Lihil free to use?
Yes, Lihil is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Lihil Alternatives — Similar Developer Tools Servers
Looking for alternatives to Lihil? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Lihil in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Lihil?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.