Lihil

v1.0.0Developer Toolsstable

2X faster ASGI web framework for python, offering high-level development, low-level performance.

aiapiasgiasynciofast
Share:
215
Stars
0
Downloads
0
Weekly
0/5

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

Build fast ASGI web applications
Combine high-level development with performance
Enable async Python frameworks
raceychan

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx lihil

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

Install Lihil with standard extras

Install the lihil package with the standard extras, which bundles uvicorn for immediate use.

pip install "lihil[standard]"
2

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)
3

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 --reload
4

Add 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")
5

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.

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.

Quick Config Preview

{ "mcpServers": { "lihil": { "command": "npx", "args": ["-y", "lihil"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides