Skip to main content

A lightweight MCP tool layer for LLM agent frameworks.

Project description

LightMCP

A lightweight Python-based wrapper around MCP (Model Context Protocol) tools.

Installation

pip install lightmcp

Usage

from lightmcp import add

# Load and start a Notion tasks query tool
tool = add("notion.query_tasks")
server_info = tool.run()

# Load and start a GitHub issues tool
github_tool = add("github.list_issues")
github_server = github_tool.run()

# When done, stop the servers
tool.stop()
github_tool.stop()

Why LightMCP?

Token and Latency Savings

Traditional MCP servers often bundle numerous tools, resources, and prompts that you may never use. This leads to:

  • Increased token usage when communicating with LLMs
  • Higher latency due to loading unnecessary components
  • Larger memory footprint in your applications

LightMCP solves these problems by creating isolated micro-servers for each tool. You only instantiate and load the specific tools you need, resulting in:

  • Reduced token consumption
  • Lower latency for tool operations
  • Minimal resource usage

Focused Tool Architecture

Each tool in LightMCP is wrapped in a self-contained FastMCP server. This means:

  • No bloat or extra load
  • Only the exact functionality your agent needs
  • Clean separation between tools

Framework Compatibility

LightMCP is designed to work seamlessly with leading agent frameworks:

  • LangGraph
  • CrewAI
  • Agno
  • And more...

CLI Usage

LightMCP includes a command-line interface for managing tools:

# Add a new tool to the registry
lightmcp add-tool "custom.tool" "path/to/tool.py"

# List all available tools
lightmcp list-tools

# Remove a tool from the registry
lightmcp remove-tool "custom.tool"

Features

  • One-line setup for MCP tools
  • Zero unnecessary prompts/resources
  • FastMCP-based isolated micro-servers
  • Full compatibility with agent frameworks
  • CLI for tool management
  • Dual-mode tool support (FastMCP v2 + fallback)

Dual-Mode Tool Development

LightMCP supports a dual-mode architecture for tools, allowing them to run as FastMCP v2 servers when possible and falling back to direct module execution when needed:

# my_tool.py
from fastmcp import FastMCP

# FastMCP v2 server definition
mcp = FastMCP("My Tool")

@mcp.tool()
def do_something(param1: str, param2: int) -> dict:
    # Tool implementation
    return {"result": param1 * param2}
    
# LightMCP fallback mechanism
def run(params: dict) -> dict:
    return do_something(**params)
    
# For direct CLI execution
if __name__ == "__main__":
    mcp.run()

With this structure, your tool can:

  1. Run as a FastMCP v2 server when mcp.run() is called
  2. Execute via direct module loading if FastMCP isn't available
  3. Be started from CLI with fastmcp run my_tool.py

This architecture ensures maximum flexibility and reliability across different environments.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightmcp-0.1.4.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lightmcp-0.1.4-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file lightmcp-0.1.4.tar.gz.

File metadata

  • Download URL: lightmcp-0.1.4.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for lightmcp-0.1.4.tar.gz
Algorithm Hash digest
SHA256 16bd6f8bf40eee9202658984f2a5b89770cb8ac6a5c1834530f4754ae4a2434e
MD5 535a47ca883a18a04ae15ff11e6422f5
BLAKE2b-256 4b544743ce5592bdf3bbbbeda5cc7057f940e866ab4326952673cab1245eca59

See more details on using hashes here.

File details

Details for the file lightmcp-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: lightmcp-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for lightmcp-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9919f45d2b9570dfa4e25b1ab5fb0f5f86b696b370ed4ea08209390e565ccfc3
MD5 27d9e192b5a6a4420b3d4baee2aada69
BLAKE2b-256 acdd962071172f83576c1b0c24cc33548e63e3271d225968bba96d9bf5927de4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page