Lazy MCP

Lazy MCP

A proxy MCP server that lazy-loads tools from configured servers on demand, reducing token usage and enabling mid-session server switching.

Category
访问服务器

README

mcp-lazy

npx for MCP servers — install the catalog once, pay the context cost only for what you actually load.

Crates.io License: MIT CI

The Problem

Adding an MCP server to your agent is a one-way door. Every server you add — Supabase, Sentry, Playwright, Betterstack — dumps all of its tool definitions into context permanently, whether you use them once a session or never. Want to add one mid-session? Restart and lose your context. There's no lazy loading, no unloading, no cost visibility. You're paying rent on tools you're not using, every single turn.

mcp-lazy is the single MCP server you point your client at instead of N real ones — it shows you a one-line catalog, loads real tools only when an agent asks for them, and lets you hot-swap servers mid-session without losing your conversation.

Without mcp-lazy With mcp-lazy
Tools in context at session start 40+ (every configured server) 4 (list_servers, load_server, unload_server, server_status)
Add a new server mid-session Restart client, lose context load_server("name"), keep going
Know what a server costs you No visibility server_status shows per-server token estimate
Idle server you forgot about Sits in context forever Auto-unloads after idle timeout (coming soon)

Demo

(Demo GIF showing list_servers -> load_server("playwright") -> tool call -> unload_server goes here)

Install

cargo install lazy-mcp-proxy

Then, configure your Claude Desktop or Claude Code client to point to lazy-mcp:

{
  "mcpServers": {
    "lazy-mcp": {
      "command": "lazy-mcp",
      "args": ["--config", "/path/to/your/config.toml"]
    }
  }
}

Quickstart Config

Create a config.toml file to define your server catalog. You can define as many servers as you want; they cost zero context tokens until loaded.

[[servers]]
name = "supabase"
description = "Query and manage Supabase projects (tables, RLS, storage, auth)"
command = "npx"
args = ["-y", "@supabase/mcp-server-supabase"]
env = { SUPABASE_ACCESS_TOKEN = "${SUPABASE_ACCESS_TOKEN}" }
auto_unload_after_idle_secs = 600

[[servers]]
name = "playwright"
description = "Browser automation: navigate, click, screenshot"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-playwright"]

How it works

lazy-mcp acts as a transparent proxy. When it starts, it advertises only its meta-tools to your client. When you ask it to load a server, it spawns that server as a child process, fetches its tool list, namespaces them (e.g. playwright.navigate), and fires a notifications/tools/list_changed event. Your client re-fetches the tool list and instantly sees the new tools, mid-session.

Meta-Tools Reference

Tool Description
list_servers Returns the catalog of available servers and their load status.
load_server(name) Spawns the real MCP server and merges its tools into the client's context.
unload_server(name) Tears down the child connection and removes its tools from context.
server_status Shows uptime and estimated token footprint for each loaded server.

Supported Servers

You can add any standard MCP server to your catalog. See config.example.toml in this repo for a comprehensive list covering:

  • Dev tooling: filesystem, git, github, fetch
  • Data/infra: supabase, postgres, sqlite, sentry, betterstack
  • Browser/automation: playwright, puppeteer
  • Productivity/comms: slack, google-drive, notion, linear
  • Search/knowledge: brave-search, memory

Comparison to Alternatives

Currently, developers work around client limitations by writing one-off bash scripts or curl wrappers that expose temporary endpoints. This creates unmaintainable glue code, lacks proper child-process lifecycle management, and offers no native namespacing. lazy-mcp replaces this hack with real, reusable infrastructure: standard stdio transport, proper LRU eviction (roadmap), and isolated namespacing.

Roadmap

Non-goals for v1, planned for future releases:

  • Semantic auto-loading (automatically loading a server based on intent).
  • Remote/HTTP transport (SSE/WebSocket proxying).
  • Interactive Dashboard for monitoring server usage.

Contributing

See CONTRIBUTING.md for details. Good first issue: Add a popular MCP server to our config.example.toml catalog! It requires zero Rust knowledge and helps everyone.

License

MIT License.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选