- Explore MCP Servers
- lmstudio-mcp
Lmstudio Mcp
What is Lmstudio Mcp
lmstudio-mcp is a FastMCP server that provides an interface to interact with LMStudio’s local language models, allowing users to query and interact with models through a simple API.
Use cases
Use cases for lmstudio-mcp include querying language models for information, generating text based on prompts, and enhancing problem-solving capabilities in applications that utilize LMStudio’s models.
How to use
To use lmstudio-mcp, ensure that Python 3.x, LMStudio, and the required packages are installed. Start the server by running ‘python lmstudio_api.py’. You can then use the provided API endpoints to get available models and query specific models with prompts.
Key features
Key features of lmstudio-mcp include the ability to list all loaded models in LMStudio, send prompts to specific models with custom system prompts, and a simple API interface for model interactions.
Where to use
lmstudio-mcp can be used in various fields that require natural language processing, such as chatbots, virtual assistants, and any application that benefits from language model interactions.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Lmstudio Mcp
lmstudio-mcp is a FastMCP server that provides an interface to interact with LMStudio’s local language models, allowing users to query and interact with models through a simple API.
Use cases
Use cases for lmstudio-mcp include querying language models for information, generating text based on prompts, and enhancing problem-solving capabilities in applications that utilize LMStudio’s models.
How to use
To use lmstudio-mcp, ensure that Python 3.x, LMStudio, and the required packages are installed. Start the server by running ‘python lmstudio_api.py’. You can then use the provided API endpoints to get available models and query specific models with prompts.
Key features
Key features of lmstudio-mcp include the ability to list all loaded models in LMStudio, send prompts to specific models with custom system prompts, and a simple API interface for model interactions.
Where to use
lmstudio-mcp can be used in various fields that require natural language processing, such as chatbots, virtual assistants, and any application that benefits from language model interactions.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
LMStudio API MCP Server
This is a FastMCP server that provides an interface to interact with LMStudio’s local language models. It allows you to query and interact with models loaded in LMStudio through a simple API.
Features
- List all loaded models in LMStudio
- Send prompts to specific models with custom system prompts
- Simple API interface for model interactions
Prerequisites
- Python 3.x
- LMStudio installed and running
- FastMCP package installed
- LMStudio Python package installed
Usage
The server provides two main endpoints:
1. Get Available Models
get_lmstudio_models() -> list[str]
Returns a list of all models currently loaded in LMStudio. Each model entry contains information about the model including its display name, which is used to identify the model in subsequent API calls.
2. Query a Model
ask_lmstudio_model(model: str, system_prompt: str, prompt: str) -> str
Sends a prompt to a specific model with a custom system prompt.
Parameters:
model: The display name of the model to usesystem_prompt: The system prompt to set the contextprompt: The actual prompt to send to the model
Example
# Get list of available models
models = get_lmstudio_models()
# Ask a question to a specific model
response = ask_lmstudio_model(
model="Your Model Name",
system_prompt="You are a helpful assistant.",
prompt="What is the capital of France?"
)
Running the Server
To start the MCP server, simply run:
python lmstudio_api.py
Error Handling
The server includes basic error handling:
- Returns “Model not found” if the specified model doesn’t exist
- Returns “No response from model” if the model fails to generate a response
Note
Make sure LMStudio is running and the desired models are loaded before using this API.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










