ALLBEAPI:Turn any Python library into an MCP Server
AllBeAPI是一个高性能工具,可将任意Python库快速转换为LLM可用的MCP服务器。通过简单命令(如allbeapi start pandas)即可将库(如pandas)暴露为本地API,支持LLM安全执行Python代码、处理数据/图像等。其特点包括:自动生成API(无需手动配置)、智能序列化复杂对象(如DataFrame/图像)、纯本地运行保障安全,基于FastAPI/Pydantic
Turn any Python library into an LLM Tool in seconds.
AllBeAPI is a high-performance bridge that instantly exposes any Python library as a Model Context Protocol (MCP) server. It enables Large Language Models (Claude, ChatGPT, etc.) to execute local Python code, manipulate dataframes, process images, and interact with your system—safely and efficiently.
Built on the latest StreamableHTTP protocol for maximum compatibility with Claude Desktop, LangChain, and Cursor.
Installation
pip install allbeapi
Quick Start
Expose pandas (or any other library) to your LLM with a single command:
# Install, generate, and serve in one go
allbeapi start pandas
The server will start on http://127.0.0.1:8000/mcp.
Client Configuration
To use your new tool with Claude Desktop or other MCP clients, add the following to your claude_desktop_config.json:
{
"mcpServers": {
"pandas": {
"command": "uv",
"args": [
"run",
"allbeapi",
"start",
"pandas"
]
}
}
}
Key Features
Zero-Config Generation
Automatically inspects any installed Python package, extracts public APIs, and generates a fully compliant MCP server. No manual schema definition required.
Smart Serialization Engine
LLMs struggle with complex objects. AllBeAPI handles them automatically:
- DataFrames: Converted to markdown or JSON previews.
- Images: Automatically encoded or saved to temp storage.
- Classes: Stateful object management allows you to instantiate classes and call methods on instances.
Local & Secure
Runs entirely on your machine. No data leaves your network. You control the host binding (default 127.0.0.1) and execution environment.
Modern Stack
- Typer: For a robust, ergonomic CLI experience.
- FastAPI / Starlette: High-performance async networking.
- Pydantic: Strict data validation and schema generation.
Advanced Usage
Inspect a Library
Check which functions will be exposed before generating code:
allbeapi inspect numpy
Generate Only
Generate the server code without running it (useful for customization):
allbeapi generate matplotlib --output-dir ./my-server
License
This project is licensed under the AGPL v3 License.
更多推荐
所有评论(0)