Skip to main content
Glama
lmstudio-ollama-mcp

lmstudio-ollama-mcp

by fthsrbst

lmstudio-ollama-mcp

npm install -g lmstudio-ollama-mcp
lmstudio-ollama-mcp doctor   # or: forge doctor
lmstudio-ollama-mcp "add unit tests for src/utils/logger.ts"

로컬 우선. 프라이빗. 무료. API 키 불필요. 프론티어 모델(GPT-4o, Claude 4)은 선택 사항이며, 작은 로컬 모델이 작업을 수해하는 동안 플래너로만 사용됩니다. forge / forgecode 별칭으로 기존 사용 습관을 그대로 유지할 수 있습니다.


왜 lmstudio-ollama-mcp인가?

Claude Code / Codex

lmstudio-ollama-mcp

실행 환경

클라우드 API(유료, 데이터가 기기를 벗어남)

LM Studio · Ollama · llama.cpp(오프라인, 프라이빗)

비용

토큰당 $

모델 다운로드 후 $0

서브 에이전트

단일 스레드 또는 클라우드 병렬

하드웨어 인지 로컬 병렬

모델 선택

벤더 종속

모든 GGUF / OpenAI 호환 모델

하이브리드 모드

—

프론티어가 계획, 로컬이 실행(선택 사항)

샌드박스

클라우드 컨테이너

내 파일 시스템, 내 규칙

MCP

—

준비 완료: 로컬 런타임을 MCP 도구로 연결

한 문장으로: lmstudio-ollama-mcp는 Claude Code의 에이전트 프 — 도구로 읽기 → 계획 → 수정 → 검증 — 을 MacBook로 가져옵니다. 지능한 라우터가 단순한 작업은 로컬 7B 모델로 보내고, 어려운 추리는 필요할 때만 프론티어 모델로 보냅니다.


Related MCP server: Shared Workspace MCP

데모

# 1 — Diagnose
lmstudio-ollama-mcp doctor
# Hardware: Apple M3 (8 cores / 16GB) • Recommended: 8 agents
# ● lmstudio (LM Studio) http://localhost:1234/v1  available
#   models: gemma-3-12b-qat, qwen3-27b-ud-iq2_s …

lmstudio-ollama-mcp models
# ● lmstudio  ▸ gemma-3-12b-qat 6.5GB Q4_0
#             ▸ qwen3-27b 7.8GB IQ2_S

# 2 — One-shot
lmstudio-ollama-mcp "refactor src/providers into a registry + add tests. keep public API stable"

# 3 — Parallel (auto-splits into sub-agents)
lmstudio-ollama-mcp --parallel 4 "implement auth module, write tests, and update docs"
# forge alias also works:
forge --parallel 4 "implement auth module, write tests, and update docs"

# 4 — Force a specific model
lmstudio-ollama-mcp --model ollama:qwen2.5-coder:14b "explain this repo's error handling"
lmstudio-ollama-mcp --provider lmstudio --model gemma-3-12b "fix the failing test in tests/tools.test.ts"

# 5 — Interactive
lmstudio-ollama-mcp
# lmstudio-ollama-mcp> add dark mode to docs/index.html

빠른 시작

사전 요구 사항

  • Node.js >= 18

  • 다음 중 하나:

    • LM Studio — 개발자 → 로컬 서버 → 시작 (포트 1234)

    • Ollama — ollama serve 실행 후 ollama pull qwen2.5-coder:7b

    • llama.cpp — ./llama-server -m model.gguf --port 8080

설치

npm install -g lmstudio-ollama-mcp
# aliases also available: forge, forgecode
# or one-off
npx lmstudio-ollama-mcp doctor

첫 실행

git clone https://github.com/your-org/your-project && cd your-project
lmstudio-ollama-mcp init   # creates lmstudio-ollama-mcp.json (also reads forgecode.json for compat)
lmstudio-ollama-mcp doctor # verify providers + hardware
lmstudio-ollama-mcp "list the codebase structure and suggest 3 small improvements"

로컬 전용 모드에는 API 키가 필요 없습니다. 하이브리드 모드(프론티어 + 로컬)에서는 환경 변수를 설정하세요:

export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...

아키텍처

┌─────────────────────────────────────────────────────────┐
│  CLI  lmstudio-ollama-mcp "task"  •  doctor  •  models   │
│       aliases: forge, forgecode                         │
├─────────────────────────────────────────────────────────┤
│  Router  (strategy: auto | local-first | frontier-first)│
│  ├─ classify(prompt) → trivial | small | medium | large │
│  └─ thresholds.preferLocalFor: lint/format/test/search  │
├─────────────────────────────────────────────────────────┤
│  Orchestrator  (decompose → batch by deps → schedule)   │
│  ├─ Planner LLM decomposes goal → SubTasks[]            │
│  └─ Scheduler (hardware-aware p-limit, preserves order) │
├─────────────────────────────────────────────────────────┤
│  Agent Loop  (provider.chat ↔ tool executor)            │
│  ├─ Tools: read_file, write_file, edit_file, bash,      │
│  │        glob, grep, list_dir                           │
│  └─ Max 25 tool turns, exact-string edits               │
├─────────────────────────────────────────────────────────┤
│  Providers  (OpenAI-compatible)                         │
│  ├─ LM Studio  http://localhost:1234/v1  (+ fs scan)    │
│  ├─ Ollama     http://localhost:11434 (+ /api/tags)     │
│  ├─ llama.cpp  http://localhost:8080/v1                 │
│  └─ Frontier   OpenAI / Anthropic (optional)            │
├─────────────────────────────────────────────────────────┤
│  Hardware Detector  •  Scheduler                        │
│  cores × overcommit, free mem / perAgent → maxParallel │
│  Apple Silicon bonus, clamp 1..16                       │
└─────────────────────────────────────────────────────────┘

데이터 흐름:

User prompt
  → Router.classify → pick provider+model (local for small, frontier for large)
  → If parallel & non-trivial: Orchestrator.decompose → 2-6 SubTasks
  → Scheduler.runAll(SubTasks) with maxParallel = f(cores, RAM)
  → Each SubTask → Agent(provider, model, ToolExecutor) → tool loop
  → Synthesis agent merges results
  → Final summary

프로바이더

프로바이더

기본 URL

탐색 방법

참고

LM Studio

http://localhost:1234/v1

/v1/models + ~/.lmstudio/models/**/*.gguf 검색

reasoning_content 지원(Gemma)

Ollama

http://localhost:11434

/api/tags 기본, 폴백 /v1/models

ollama pull <model> 필요

llama.cpp

http://localhost:8080

/halth + /v1/models

llama-server로 모든 GGUF 가능

OpenAI

https://api.openai.com/v1

API

OPENAI_API_KEY 설정

Anthropic

https://api.anthropic.com

API

ANTHROPIC_API_KEY 설정

모든 프로바이더는 tools(함수 호출)를 지원하는 OpenAI 호환 Chat Completions를 사용합니다. reasoning_content(Qwen/Gemma)는 자동으로 정규화됩니다.

사용자 지정 엔드포인트 추가

// lmstudio-ollama-mcp.json
{
  "providers": {
    "my-local": { "type": "openai", "baseUrl": "http://192.168.1.10:1234/v1", "enabled": true }
  }
}

병렬 서브 에이전트

플래너 LLM(가능하면 프론티어, 그렇지 않으면 로컬)을 통해 복잡한 목표를 2–6개의 독립적인 하위 작업으로 분할합니다. 실행은 하드웨어에 의해 제한됩니다:

// hardware/detector.ts — recommendParallelism()
cpuLimit = floor(cores * overcommit) - 1
memLimit = floor((totalGb*1024 - 2048) / perAgentMb)
maxParallel = min(cpuLimit, memLimit) + appleSiliconBonus
// clamp: 1..8 default, up to 16 on 64GB machines
lmstudio-ollama-mcp --parallel 8 "migrate codebase from Jest to Vitest"
# Decomposed:
#  t1 Explore & plan  →  search (routed to local 7B)
#  t2 Implement       →  code   (routed to local or frontier)
#  t3 Verify          →  test   (routed to local)
# Runner: Scheduler.runAll with p-limit = 8

dependsOn이 있는 작업은 위상 순서로 배치됩니다. 즉, N번째 배치(N)는 N-1이 완료된 후에만 시작됩니다.

로컬 모델 친화적: 단순 작업(lint, format, summarize, explain)은 전략과 관계없이 항상 로컬로 라우팅됩니다.


구성

구성 해석 순서: DEFAULT < ~/.lmstudio-ollama-mcp/config.json < ./lmstudio-ollama-mcp.json < 환경 변수.
하위 호환성을 위해 레거시 ~/.forgecode/config.json 및 forgecode.json / forge.json도 여전히 읽습니다(새 경로가 우선).

lmstudio-ollama-mcp config --show   # resolved JSON
lmstudio-ollama-mcp config --path   # file locations
lmstudio-ollama-mcp init            # scaffold lmstudio-ollama-mcp.json

lmstudio-ollama-mcp.json 참조

{
  "version": 1,
  "providers": {
    "lmstudio": { "type": "lmstudio", "baseUrl": "http://localhost:1234/v1", "enabled": true },
    "ollama":   { "type": "ollama",   "baseUrl": "http://localhost:11434",      "enabled": true },
    "llamacpp": { "type": "llamacpp", "baseUrl": "http://localhost:8080",       "enabled": true },
    "openai":   { "type": "openai",   "baseUrl": "https://api.openai.com/v1",   "apiKey": "sk-..." }
  },
  "router": {
    "strategy": "auto", // auto | local-first | frontier-first | local-only
    "frontierProvider": "openai",
    "frontierModel": "gpt-4o-mini",
    "thresholds": {
      "smallTaskMaxTokens": 2000,
      "preferLocalFor": ["lint","format","test","search","summarize","explain"]
    }
  },
  "hardware": {
    "maxParallelAgents": 4,      // auto if omitted
    "maxMemoryPerAgentMb": 1200,
    "cpuOvercommit": 1
  },
  "permissions": {
    "allowBash": true,
    "allowWriteOutsideWorkspace": false,
    "allowNetwork": true
  }
}

전략:

  • auto — 단순/소형 → 로컬, 중형/대형 → 가능하면 프론티어, 아니면 로컬. (권장)

  • local-first — 중형/대형만 프론티어로 보냄.

  • local-only — 프론티어를 절대 호출하지 않음(에어갭 환경).

  • frontier-first — 항상 프론티어를 우선.


도구

에이전트는 7개의 도구를 제공합니다 — Claude Code와 동일한 구성이며, 작업 공간에 샌드박스됩니다:

도구

설명

read_file

파일 읽기(2 MB 제한)

write_file

파일 생성/덮어쓰기(mkdir -p 자동)

edit_file

정확한 문자열 바꾸기(정확히 한 번 일치해야 함)

bash

명령 실행(timeout 30s, 5 MB 버퍼)

glob

fast-glob 검색

grep

정규식 검색(node_modules/dist/.git 제외)

list_dir

디렉터리 목록

안전: permissions.allowWriteOutsideWorkspace=true가 아니면 경로 이탈이 차단됩니다. 위험한 명령(rm -rf /)은 거부되며, 큰 출력은 잘립니다(30k).


비교: 어떤 모델을 언제 사용할까

작업

로컬이 유리한 이유

예시

Lint / format / grep

0.2초 vs 2초 RTT

lmstudio-ollama-mcp "format src/**/*.ts with prettier"

설명 / 요약

프라이빗 코드베이스가 로컬에 남음

lmstudio-ollama-mcp "explain how auth works"

작은 수정

큐 없고 무료

lmstudio-ollama-mcp "add zod validation to src/config/schema.ts"

대규모 리팩터링

프론티어가 계획, 로컬이 병렬로 실행

lmstudio-ollama-mcp "migrate to ESM"

어려운 추론

70B / 프론티어 필요

lmstudio-ollama-mcp --model openai:gpt-4o "design CRDT sync"


개발

npm install
npm run build        # tsc
npm test             # vitest
npm run dev -- doctor

프로젝트 구조:

src/
  cli/            commander CLI + commands (doctor, models, config, init)
  config/         Zod schema + layered store (global ↔ project)
  hardware/       detector (cores/RAM/GPU) + p-limit scheduler
  providers/      base + openai-compatible + lmstudio/ollama/llamacpp + registry + router
  core/           Agent (tool loop) + Orchestrator (decompose + parallel)
  tools/          definitions + executor (fs/glob/grep/bash)
  utils/          logger, format
tests/            vitest suites (hardware, tools, router, config, providers)
docs/             GitHub Pages landing (WizardZ-inspired, lime/black)

로드맵

  • 스트리밍 출력(--stream)

  • MCP(Model Context Protocol) 서버 — 로컬 모델을 다른 에이전트용 MCP 도구로 노출

  • 영구 메모리(.lmstudio-ollama-mcp/memory.md)

  • lmstudio-ollama-mcp plan — 실행 없이 분해만 시도(dry-run)

  • 스크린샷 기반 UI 작업을 위한 비전 모델(Gemma 12B 멀티모달)

  • hooks — 도구 전/후 후크

  • Windows / Linux GPU(CUDA/Vulkan) 스케줄러 힌트


기여

PR 환영합니다. 핵심 원칙을 지켜 주세요: 로컬 우선, 최소 의존성, 하드웨어 인지, 조잡한 AI 산출물 없이.

npm run build && npm test

키워드

lm-studio lmstudio ollama llama.cpp local-llm local-first coding-agent autonomous-agent claude-code codex sub-agents parallel-agents mcp model-context-protocol hardware-aware openai-compatible gguf agentic dev-tools ai-coding on-device-ai privacy


라이선스

MIT — LICENSE 참조.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers