home / mcp / lingshu mcp server
Provides a FastMCP server wrapper for the Lingshu medical AI model enabling MCP clients to analyze images, generate reports, and answer medical questions.
Configuration
View docs{
"mcpServers": {
"alibaba-damo-academy-lingshu_mcp": {
"command": "python",
"args": [
"mcp_server_lingshu.py",
"--host",
"127.0.0.1",
"--port",
"4200",
"--path",
"/lingshu",
"--log-level",
"info"
],
"env": {
"LINGSHU_MODEL": "lingshu-medical-mllm/Lingshu-7B",
"LINGSHU_SERVER_API": "api_key",
"LINGSHU_SERVER_URL": "http://localhost:8000/v1"
}
}
}
}You can run a FastMCP server that wraps the Lingshu medical AI model, enabling MCP clients to submit requests for medical image analysis, structured reports, and medical Q&A. This guide walks you through installing, starting the MCP server, and connecting a client for testing and integration.
Start by running the MCP server that wraps the Lingshu model locally. Use the following command to launch the server, which exposes the MCP endpoint at your chosen host and port: python mcp_server_lingshu.py --host 127.0.0.1 --port 4200 --path /lingshu --log-level info.
Once the MCP server is running, test the connection with the provided test client. Set the MCP URL to the local endpoint and run the client as shown: python mcp_client_lingshu.py --mcp-url http://127.0.0.1:4200/lingshu.
Prerequisites you need installed before you begin:
Step-by-step commands to set up the environment and dependencies:
pip install -r requirements.txt
# Optional: set up a Python virtual environment
python -m venv venv
source venv/bin/activate # on Unix or macOS
venv\Scripts\activate # on Windows
# Ensure you have FastMCP and related tooling installed in your environment
pip install fastmcp # if not already included in requirements.txt
# Install any additional dependencies required by the Lingshu integration
pip install -r requirements.txt
# Ensure your LLM backend (e.g., vLLM) is accessible and started separately
# Start the vLLM server as described in its own setup steps (not shown here)
"} ,{Environment variables shown for running the MCP server are used to configure the Lingshu backend. You will set these in your shell before starting the MCP server.
Example environment variable setup before launching the MCP server:
export LINGSHU_SERVER_URL="http://localhost:8000/v1"
export LINGSHU_SERVER_API="api_key"
export LINGSHU_MODEL="lingshu-medical-mllm/Lingshu-7B" # matches your vLLM deployment
python mcp_server_lingshu.py --host 127.0.0.1 --port 4200 --path /lingshu --log-level info
"}]},{Analyze medical images through the Lingshu model and return structured insights suitable for clinical review.
Generate detailed, structured medical reports from model outputs and imaging data.
Provide expert answers to medical questions based on the Lingshu model outputs and context.