LocalAiMCP
OfficialClick on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LocalAiMCPlist all available models"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
LocalAiMCP
A stateless, asynchronous FastMCP control plane for LocalAI. The bundled LocalAI Swagger contains 114 paths / 123 operations, and all 123 remain usable through typed, validated callables. To avoid sending roughly 123 operation schemas to the model on every MCP request, only a curated set is advertised directly; everything else is discoverable and executable on demand.
Two Swagger WebSocket operations are implemented as bounded one-call exchanges, multipart routes support file uploads, and binary responses can be saved under ./data/output and returned inline as base64 when small enough.
Run
git clone https://github.com/twinlunarstarz-dev/LocalAiMCP.git
cd LocalAiMCP
cp .env.example .env
# Edit LOCALAI_BASE_URL / LOCALAI_API_KEY if needed.
docker compose up -d --buildThe MCP endpoint is:
http://localhost:8000/mcpFor VS Code/Zoo Code or another Streamable HTTP MCP client, use that URL as the remote MCP server endpoint. The container defaults to host.docker.internal:8080 for LocalAI and includes the Linux host-gateway mapping.
Related MCP server: LM Studio MCP Bridge
Curated tool surface
The server does not advertise all 123 LocalAI operations by default. The default preset advertises 20 commonly useful operation tools plus five fixed discovery/system helpers.
Default directly exposed operation tools:
# System/model information
get_system_info
get_metrics
get_token_metrics
list_models
list_model_capabilities
get_backend_monitor
# Generation/media
chat
complete_text
generate_image
inpaint_image
generate_sound
generate_video
text_to_speech
text_to_speech_with_voice
# Voice
list_voice_profiles
create_voice_profile
analyze_voice
verify_speakers
# 3D
generate_3d_asset
remesh_3d_assetThe five fixed MCP helpers are:
list_additional_tools
search_additional_tools
execute_additional_tool
server_health
schema_auditThus the default tools/list surface is 25 tools, rather than about 128. The exact number is configurable.
Configure which LocalAI operations are directly visible
Set LOCALAI_MCP_EXPOSED_TOOLS to a comma-separated list of semantic operation names:
LOCALAI_MCP_EXPOSED_TOOLS=chat,list_models,generate_image,text_to_speech,generate_3d_assetSpecial values:
* expose all 123 Swagger operations directly
none expose no Swagger operations directly; use only the gateway/system helpers
gateway-only same as noneAn empty or unset value uses the built-in 20-operation preset. Invalid names fail startup instead of silently disappearing.
Changing direct exposure affects only what MCP clients receive in tools/list; it does not remove the hidden operation from LocalAiMCP.
Additional-tool gateway
Less common tools stay in an internal typed registry and are accessed through three small tools.
list_additional_tools
Returns the complete sorted list of hidden tool names and nothing schema-heavy. It is intentionally compact so a model can inspect the whole hidden catalog on demand without permanently carrying those schemas in every request.
search_additional_tools
Searches only hidden tools using a plain-language goal or an exact tool name. Each match returns:
semantic tool name
detailed purpose/input/output description
tags
complete input JSON schema
Examples:
search_additional_tools(query="detokenize token ids")
search_additional_tools(query="transcribe audio")
search_additional_tools(query="install a backend")
search_additional_tools(query="inspect request traces")execute_additional_tool
Executes a hidden capability by semantic name:
{
"tool_name": "detokenize",
"arguments": {
"request": {
"model": "my-model",
"tokens": [1, 42, 9001]
}
}
}The arguments object is validated against the same generated Pydantic schema used by a directly exposed operation. Invalid or unknown fields return a validation error and the expected input schema before any LocalAI request is made. This is not a curl-style dispatcher: the model uses semantic tool names and typed arguments rather than HTTP methods/routes.
Directly exposed operations are intentionally rejected by execute_additional_tool; the client should call their normal MCP tool directly.
The previous advanced raw_request escape hatch and probe_safe_endpoints helper are retained as hidden additional tools, so reducing tools/list does not remove those capabilities.
LLM-oriented descriptions
The registry is designed so a model does not need prior LocalAI API knowledge:
Tool names describe tasks rather than mirroring HTTP routes or methods.
Every typed HTTP operation states its purpose, expected inputs, and success output.
JSON request schemas carry field-level descriptions, including conservative fallback guidance when Swagger only says things like
Requestor leaves a field undocumented.Referenced request objects surface useful top-level fields directly in descriptions.
Response descriptions explain whether data appears under
data,text,events,base64, orsaved_path.Search returns the complete input schema only when the hidden tool is relevant.
Wrapper plumbing such as custom headers and per-call timeouts stays off normal typed operations.
For example, hidden tool detokenize explains that its request contains:
tokens: integer token IDs to convert back to textmodel: LocalAI model name or alias whose tokenizer should be used
and that the JSON response contains content, the detokenized text.
Design
FastMCP 3.4.7, pinned for reproducibility.
Streamable HTTP + stateless mode. Multiple Uvicorn workers are safe because discovery and execution use a process-local immutable registry rather than conversational/session state.
Async LocalAI I/O with
httpx; independent calls can run concurrently.123 typed Swagger operation callables with semantic names and generated input validation; only the configured subset is registered directly with FastMCP.
On-demand gateway for hidden operations, preserving full LocalAI functionality without advertising every schema on every request.
Multipart support for audio, images, GLB files, branding assets, and voice profiles. File arguments accept
data:URIs,base64:<data>, HTTP(S) URLs, or files under/data.Binary support for audio/images/GLB responses. Small payloads are returned as base64; binary payloads can also be saved to
/data/output.SSE-aware response handling aggregates LocalAI SSE events into a structured result.
WebSocket support for backend-log streaming and realtime audio transforms using bounded exchanges.
Bearer auth via
LOCALAI_API_KEY; no token is stored in code or returned to MCP clients.
Response wrapper
Typed HTTP operations return a predictable wrapper:
ok: whether LocalAI returned a successful HTTP statusstatus_code: LocalAI HTTP statuselapsed_ms: request durationdata: parsed JSON response bodiestext: text responsesevents: collected SSEdata:payloadsbase64,size_bytes,mime_type,saved_path: binary response metadata/content when applicable
Always check ok before consuming the response body.
File inputs
For multipart tools, a file argument can be any of:
data:<mime>;base64,<payload>base64:<payload>an
http://orhttps://URL that the MCP container can fetcha local path under
LOCALAI_MCP_FILE_ROOT(/datain Compose)
The Compose file mounts ./data to /data.
LocalAI streaming behavior
LocalAI request bodies that set stream=true are forwarded unchanged. If LocalAI answers with text/event-stream, the MCP call collects the SSE data: events and returns them when the LocalAI stream ends.
The two Swagger WebSocket routes are mapped specially:
stream_backend_logs: collect backend log messages for a model up tomax_messages, then close.stream_audio_transform: send one session/config object plus base64 PCM frames, collect transformed messages up tomax_messages, then close.
They may be direct or hidden depending on LOCALAI_MCP_EXPOSED_TOOLS; hidden WebSocket tools remain executable through execute_additional_tool.
Verification
Repository tests verify:
exact Swagger coverage: 114 paths / 123 operations
123 unique reviewed semantic names
the default curated exposure count and MCP
tools/listcountthe full hidden-name catalog
hidden search returning real descriptions and generated input schemas
hidden execution validating arguments before network access
every non-WebSocket operation description explaining inputs and outputs
referenced request/response schemas surfacing real fields
detokenizeexposing useful token/model/content guidance on demandWebSocket detection, response wrapping, and binary handling
built wheels containing all four bundled Swagger payload parts
Run locally with dependencies installed:
python -m pip install -e '.[test]'
pytestContainer validation:
docker compose config
docker compose buildAn MCP client should perform the normal MCP initialize handshake against http://localhost:8000/mcp.
Configuration
Variable | Default | Purpose |
|
| LocalAI base URL visible to the container |
| empty | Optional LocalAI bearer token |
| built-in 20-tool preset | Comma-separated directly exposed Swagger operation names; |
|
| Overall LocalAI request timeout seconds |
|
| Connection timeout seconds |
|
| Maximum fetched/uploaded file size |
|
| Maximum buffered LocalAI response size |
|
| Binary bytes allowed inline as base64 |
|
| Save binary responses to output directory |
|
| Published host port |
|
| Uvicorn worker count |
Security note
The additional-tool gateway can still execute LocalAI administrative/destructive operations, including model/backend install/delete, task/job controls, trace/log clearing, branding, node budgets, and voice-profile administration. Hiding a tool from tools/list reduces context size; it is not an authorization boundary. Do not publish port 8000 to an untrusted network without authentication and network access controls in front of it.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
471Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceExposes MCP tools that enable remote LLMs to query local Docker containers, OS processes, and system services in real time.-
- FlicenseCqualityDmaintenanceEnables MCP clients to interact with local LLMs via LM Studio, supporting dynamic chat, vision, RAG, file interaction, and model orchestration.28-
- FlicenseAqualityCmaintenanceMCP server that connects LLM agents to a local LM Studio instance, enabling model management, OpenAI-compatible chat completions, text completions, and embeddings through a set of tools.91-
- AlicenseAqualityBmaintenanceAn MCP server exposing 72 tools across 26 homelab services, enabling LLMs to monitor and manage infrastructure, media, storage, and networking with a single endpoint.16MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/twinlunarstarz-dev/LocalAiMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server