Content
# local-chat
Cross-platform desktop chat client for local LLMs with MCP support
## motivation
Running LLMs locally gives you privacy and control, but most chat interfaces are either web-based or tied to specific models. This project provides a native desktop app that works with any local LLM server (ollama, llama.cpp, vLLM, etc.) and implements the Model Context Protocol so your models can interact with tools, filesystems, and external data sources. Think of it as a ChatGPT-like interface for your local setup, but with actual system integration.
## architecture
```mermaid
graph TB
UI[Electron UI Layer]
Chat[Chat Manager]
MCP[MCP Client]
LLM[LLM Adapter]
UI --> Chat
Chat --> MCP
Chat --> LLM
MCP --> Tools[MCP Servers]
LLM --> Local[Local LLM Server]
Tools --> FS[Filesystem]
Tools --> DB[Database]
Tools --> API[External APIs]
Local --> Ollama
Local --> LlamaCpp[llama.cpp]
Local --> Other[Other OpenAI-compatible]
```
## getting started
### install
```
npm install -g local-chat
```
Or download pre-built binaries from the releases page.
### quickstart
```typescript
// Start the app
local-chat
// Or with a specific config
local-chat --config ~/.local-chat/config.json
```
First run will prompt you to configure your LLM endpoint and any MCP servers you want to enable.
## how it works
The app uses Electron for the desktop interface and maintains persistent chat sessions in a local SQLite database. When you send a message, it goes through the chat manager which handles conversation history and context window management.
If you have MCP servers configured, the LLM can request tool calls during generation. The MCP client routes these to the appropriate server (which might be providing filesystem access, database queries, web search, etc.), executes them, and feeds the results back into the conversation. This all happens automatically based on the model's tool use capabilities.
The LLM adapter supports any OpenAI-compatible API, so you can point it at ollama, local llama.cpp servers, vLLM instances, or even remote endpoints if you want. Response streaming is handled natively for a responsive chat experience.
## configuration
Configuration lives in `~/.local-chat/config.json` by default:
```json
{
"llm": {
"endpoint": "http://localhost:11434/v1",
"model": "llama3.2",
"temperature": 0.7,
"maxTokens": 4096
},
"mcp": {
"servers": [
{
"name": "filesystem",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"]
},
{
"name": "postgres",
"command": "mcp-server-postgres",
"env": {
"DATABASE_URL": "postgresql://localhost/mydb"
}
}
]
},
"ui": {
"theme": "dark",
"fontSize": 14
}
}
```
MCP servers are launched as child processes when the app starts. They communicate over stdio using the MCP protocol.
## faq
**Does this work with cloud LLMs like GPT-4?**
Yes, you can point the endpoint at OpenAI or Anthropic APIs, but you'll lose the privacy benefits of running locally.
**What MCP servers are available?**
Check the official MCP servers repository. Common ones include filesystem access, database connectors, web browsers, and code execution sandboxes.
**Can I use multiple models?**
Not simultaneously in the same chat, but you can switch models between conversations or maintain separate configs.
**How much does it cost?**
Nothing. The app is free and open source. You just need to run your own LLM.
**Does it support vision models?**
Not yet. Text-only for now, but image inputs are planned.
## license
MIT