翻篇收录说明
翻篇网页快照

How to Use MCP Servers with Local LLMs | Unsloth Documentation

https://unsloth.ai/docs/basics/mcp

最近抓取:2026-12-04 23:27:41(北京时间)

最近内容变化:2026-12-02 10:56:19(北京时间)

这是最近一次有效抓取的文本快照,不含网页脚本、图片和动态交互内容。实际网页可能已更新。

访问原网页

页面简介

Learn how to connect MCP Servers to open AI models with screenshots.

正文摘录

This step-by-step guide shows you how to connect Model Context Protocol (MCP) servers to local LLMs like Qwen or Gemma, so any model you run can call external tools and services via MCP. Connecting MCP to a local model lets it securely use your local files, apps, databases, and tools instead of only chatting from memory, to build a more useful, private, and interchangeable AI assistant that can act on your real environment.We'll use the open-source repos Unsloth and llama.cpp as they are popular frameworks for local model inference/deployment. MCP works for local GGUF models and cloud provider models. We'll also show how multiple MCP Servers can be utilized.MCP tools work alongside other model capabilities such as code execution and web search, so a single model can search the web, run code, and call your connected services in the same thread.Use CasesOnce an MCP server is connected, you can ask your local model to do many automated tasks. A few examples:Search docs: “Find the relevant docs and summarize the setup steps.” - Context7 can be used.Analyze a codebase: “Map out this repo and explain where authentication, billing, and data access happen.” - The GitHub official MCP and GitMCP can be used to analyze repos.Search the web with embeddings - Exa's MCP Server can be used for semantic web searches with contextual embedding support.Debug websites UIs - The Playwright and Chrome DevTools MCP Servers can be used to drive websites to find fixes to issues.QuickstartWe'll be using two ways to connect your local model on your device to MCP Servers. Both use open-source packages: Unsloth and llama.cpp to run, serve and deploy your model.Unsloth MCP GuideLlama.cpp MCP Guide🦥 Unsloth GuideIn this example we'll use Unsloth to connect any local model like Qwen3.6 or Gemma 4 with the MCP Servers: Vercel, Context7, Exa and Hugging Face. We'll then ask a model what it can do with it. The same steps work for any MCP server.1Setup UnslothThe easiest way to get started is by installing the Unsloth Desktop app. It supports MacOS, Linux, Windows, NVIDIA, AMD, Intel and CPU setups.Download Unsloth Download for macOS Download for Windows Download for LinuxOr, if you prefer manual installation:MacOS, Linux, WSL:AskCopycurl -fsSL https://unsloth.ai/install.sh | shWindows PowerShell:AskCopyirm https://unsloth.ai/install.ps1 | iexSee here for detailed instructions.2Enable MCPClick on "MCP" in the chat toolbar.Unsloth Studio by default has MCP support for Context7, Exa and Hugging Face. Turning on Exa web search will disable the default search tool which we have.3Adding custom MCP serversTo add the Vercel MCP server, click on "Add custom MCP", and you will get a pop-up:Fill in the server details:Display name: a friendly label, e.g. Vercel.URL: the server's base endpoint, e.g. https://mcp.vercel.com.Choose an authentication method below.OAuth sign-inCustom headerFor servers that require browser-based authentication (GitHub, Linear, Vercel, etc.), turn on Use OAuth sign-in. A browser window will open on first connect so you can authorize Unsloth.For servers that authenticate with a token, leave OAuth off and click Add header under Custom headers. Add an Authorization header with your token:4Test & addClick Test connection to confirm Unsloth can reach the server. Once it succeeds, click Add server to save it.If Test connection fails, check that the URL is the server's base endpoint (not a docs page) and that your authentication method is correct. See Troubleshooting below.5Verify tools loadedThe server now appears in the MCP Servers list. Unsloth fetches its tools automatically and shows a confirmation, e.g. Refreshed "Vercel" (18 tools).Each server has controls to toggle it on/off, refresh its tools, edit it, or delete it. Make sure both the server's toggle and the Use MCP Servers master toggle are on, then close the dialog.It'll be highlighted if enabled. You can also disable them by simply clicking on them again.6Use it in chatPick any model from the Select model dropdown and start chatting. The model can now call the server's tools on its own when your request calls for it.Above, a local gemma-4-E2B-it-GGUF was asked "Can you use Vercel MCP server?" and reported the actions it can take: managing projects, analysing logs, listing teams, generating access links, checking domains, and searching Vercel's documentation.Using multiple MCP serversHow about calling multiple MCP servers like 3? We'll use Unsloth Studio's default Exa, Context7 & Hugging Face provided MCP servers and enable all 3.If you ask "Can Unsloth support Qwen finetuning", Exa will provide great details on it:Then as a follow up "Search Unsloth docs on how to do this", and Context7 is used for docs:Then type "Search Hugging Face for unsloth/Qwen models", and Hugging Face's MCP Server will be called:Another Specific Use case ExampleOnce a server is connected, ask the model to do real work in plain language. A few examples with the Vercel server:Debug a failing build: "Pull the build logs for my latest deployment and tell me why it failed."Check deployment status: "List my most recent deployments and their status."Search the docs: "Search the Vercel docs for how to set up a custom domain."Domain research: "Is myproject.dev available, and how much would it cost?"🦙 Llama.cpp Guide1Install or build llama.cppmacOS:Or for Linux, Windows, WSL build from source:A source build does not install llama-server on PATH. From the directory where you ran git clone, add the build output directory to PATH in the terminal that will run the server. On Linux or WSL (Bash):On native Windows with the default Visual Studio generator, Release executables are in llama.cpp\build\bin\Release. In PowerShell:With a single-configuration generator such as Ninja on Windows, use .\llama.cpp\build\bin instead. Repeat the PATH setup in each new server terminal, using the absolute path to your checkout if you have changed directories. The following multiline command examples use Bash syntax; on native PowerShell, put each command on one line or replace Bash line-continuation backslashes with PowerShell backticks. Homebrew users can keep using llama-server directly.2Start llama-server with a GGUFWe are using Gemma 4 E4B GGUF in this example:For the bigger Gemma 4 26B-A4B model:For more inference parameter adjustments, see our Gemma 4 guide.You can test the server:3Create an MCP filesystem sandboxCopy the absolute path. Create a separate project folder for your MCP host:Create server_config.json:Replace the path with your real workspace path. IBM’s mcp-cli docs use this same server_config.json shape and the same npx -y @modelcontextprotocol/server-filesystem /path/to/allowed/files filesystem configuration.4Run a terminal MCP host against llama.cppUse IBM’s mcp-cli; it is a command-line MCP client/host with chat mode, tool discovery, and custom OpenAI-compatible provider support. Its docs recommend uvx mcp-cli --help, support project server_config.json, and support runtime custom OpenAI-compatible providers via --api-base and --api-key.mcp-cli needs a config file to start up. So it's necessary to add a step to create it. For example:Then run:Then try:Then:mcp-cli has tool-call confirmation enabled by default, so you should see prompts before tool execution.Full code example:Game engines and 3D appsUnsloth has one-click MCP entries for Blender, Unity, Unreal Engine, Godot, Figma and Roblox Studio. See Game Engines and 3D Apps for step-by-step setup and demos.Qwen3.8-27B building a village in Unreal Engine 5.8 from Unsloth chat.Local MCP servers with Remote access or LAN accessBesides http(s):// URLs, the URL or executable field also accepts a local command such as npx, uvx or the path to a server binary, with its arguments in the Arguments rows. These local (stdio) servers run as a program on your computer.While Remote access or LAN access is on in Settings (or Unsloth was started with --secure), Unsloth is reachable from other devices, so local commands are turned off and saving one shows:You can still use local MCP servers in two ways:Run the server over HTTP on your own machine (recommended). Many MCP servers can serve HTTP themselves. Start it bound to 127.0.0.1 so only this computer can reach it, then add its address as the URL. For example, for osmmcp:Then add http://127.0.0.1:7082/mcp in the MCP dialog. This works in Unsloth Desktop and Studio with Remote access on. Run the MCP server on the computer running Unsloth, not on the device you browse from; with Docker, 127.0.0.1 is the container itself, so start the server inside the container (docker exec). For a server that only speaks stdio, an stdio-to-HTTP bridge such as mcp-proxy does the same job, e.g. mcp-proxy --port=8099 uvx mcp-server-fetch, then add http://127.0.0.1:8099/mcp.Allow local commands explicitly (Studio). Start Studio with the variable set yourself, and local commands stay enabled while Remote access or LAN access is on:On Windows PowerShell: $env:UNSLOTH_STUDIO_ALLOW_STDIO_MCP = "1"; unsloth studio.With option 2, anyone who can sign in to your Studio over the network can run programs on your computer through an MCP server. Only use it with a strong password on networks you trust, and prefer option 1.TroubleshootingIf a server fails to connect or its tools don't appear, check the URL is the server's base endpoint (e.g. https://mcp.vercel.com), not a docs or dashboard page. For OAuth servers, complete the browser sign-in when it opens; for token-based servers, verify the Authorization header and that the token is valid.If saving a local command fails with "Local commands are disabled while Remote Access is on", see Local MCP servers with Remote access or LAN access.Click Refresh if tools don't show up after connecting, and make sure both the individual server toggle and the Use MCP Servers master toggle are on.Security notesOnly connect MCP servers you trust. Review requested permissions and keep human confirmation enabled for actions th