Skip to content

LM Studio

LM Studio is a local LLM server — it serves models but does not consume MCP tools directly. To use AllMCP with an LM Studio model, pair it with a framework that supports both a custom LLM backend and MCP.


Both approaches keep the LLM local in LM Studio while AllMCP serves the tools remotely. Choose the one that matches the framework you already use.

Recommended approach: LangChain + LM Studio + AllMCP

install
pip install langchain-mcp-adapters langchain-openai langgraph
agent.py
import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
async def main():
client = MultiServerMCPClient({
"allmcp": {
"url": "https://go.allmcp.co/mcp/",
"transport": "streamable_http",
"headers": {"X-API-Key": "YOUR_API_KEY"},
}
})
tools = await client.get_tools()
# LM Studio's OpenAI-compatible endpoint
llm = ChatOpenAI(
base_url="http://localhost:1234/v1",
api_key="lm-studio", # any non-empty string
model="local-model", # matches the model loaded in LM Studio
)
agent = create_react_agent(llm, tools)
result = await agent.ainvoke({
"messages": [{"role": "user", "content": "List my Bitrix24 contacts"}]
})
print(result["messages"][-1].content)
asyncio.run(main())