Skip to main content
Glama

llm-chat-mcp

Continue.dev의 config.yaml에 구성된 LLM 모델과 상호작용하기 위한 MCP 서버.

기능

에이전트가 구성된 모델을 검사하고 채팅 요청을 보낼 수 있게 해주는 4가지 도구를 노출합니다:

  • llm_chat_list_models — 구성의 모든 모델을 이름과 id와 함께 나열

  • llm_chat_get_model_params — 모든 모델의 매개변수(temperature, topP 등) 검사

  • llm_chat_get_model_prompt — 모델에 구성된 시스템 프롬프트 읽기

  • llm_chat_send_request — 모델과 채팅, 선택적으로 매개변수 재정의 또는 파일에서 프롬프트 로드

Related MCP server: Polybrain MCP Server

설치

pip install -e .

또는 설치 없이 소스에서 직접 실행.

CLI 사용법

python -m llm_chat_mcp --default-model "GLM-5.2-FP8"
python -m llm_chat_mcp --config /path/to/config.yaml --default-model "ModelName"
python -m llm_chat_mcp --help

인자

설명

기본값

--config PATH

config.yaml의 경로

~/.continue/config.yaml

--default-model NAME

send_request의 기본 모델

(없음)

--timeout SECONDS

요청 제한 시간(초)

19

--relative_paths_base PATH

상대 출력 파일 경로를 해석하기 위한 기본 디렉터리

(프로세스 cwd)

--auto-output-dir PATH

응답이 auto_file_threshold를 초과하고 output_file_path가 설정되지 않았을 때 자동 생성된 출력 파일의 디렉터리

(OS 임시 디렉터리)

구성

  • 구성은 모든 요청마다 다시 읽힙니다 — 재시작 불필요

  • 인증은 config.yaml의 각 모델 항목에서 apiKey를 사용합니다

  • 모델이 지정되지 않은 경우(CLI나 도구 호출 모두에서), 오류가 설정 방법을 알려줍니다

llm_chat_send_request 매개변수

주요 도구입니다. LLM에 채팅 완료 요청을 보내고 응답을 반환합니다.

입력 매개변수

매개변수

유형

기본값

설명

model_selector

str

(CLI 기본값)

config.yaml의 모델 이름 또는 id

prompt_text

str

(없음)

보낼 프롬프트 텍스트

prompt_files

list

(없음)

파일 사양 목록(문자열 경로 또는 {path, start_line, end_line} 딕셔너리)

include_line_numbers

bool

true

각 파일 줄 앞에 N: 접두사 추가

system_prompt

str

(구성에서)

시스템 메시지 재정의; ""는 완전히 억제

temperature, topP, topK, minP

float

(구성에서)

샘플링 매개변수

maxTokens, presencePenalty, frequencyPenalty

int/float

(구성에서)

생성 매개변수

extraParams

dict

(없음)

API 요청에 병합되는 추가 본문 속성

details

bool

false

응답에 추론/사고 콘텐츠 포함

timeout

float

(CLI 기본값)

요청별 제한 시간 재정의

output_file_path

str

(없음)

전체 응답을 이 파일에 기록(--relative_paths_base 기준으로 상대 경로 해석)

append

bool

false

덮어쓰지 않고 output_file_path에 추가; appended_line_start/appended_line_end 반환

inline_preview_chars

int

500

인라인으로 반환되는 콘텐츠의 최대 문자 수; 미리보기는 파일이 기록될 때만 적용

auto_file_threshold

int

8000

response_chars가 이 값을 초과하고 output_file_path가 설정되지 않았을 때 응답을 파일에 자동 기록; 0은 비활성화

응답 구조

항상 JSON으로 반환됩니다:

{
  "content": "<preview, full content, or empty>",
  "truncated": true,
  "metadata": {
    "model_name": "...",
    "model": "...",
    "elapsed_seconds": 1.23,
    "request_sent": {...},
    "response_headers": {...},
    "response_chars": 1234,
    "output_file": "...",
    "auto_output_file": "...",
    "created_dirs": [...],
    "appended_line_start": 201,
    "appended_line_end": 250
  }
}

출력 전략

도구는 매개변수와 응답 크기에 따라 세 가지 전략 중 하나를 선택합니다:

  1. 명시적 파일(output_file_path 설정): 전체 응답이 파일에 기록됩니다. append=true이면 응답이 추가되고 appended_line_start/appended_line_end(1부터 시작, 포함)가 반환되어 호출자가 extract_lines를 통해 추가된 부분만 읽을 수 있습니다.

  2. 자동 파일(output_file_path 없음, auto_file_threshold > 0, response_chars > threshold): 전체 응답이 --auto-output-dir(또는 OS 임시 디렉터리)의 자동 생성 파일에 기록됩니다. 파일 이름 형식: llm_output_<YYYYMMDD_HHMMSS>_<6-char-uuid>.json.

  3. 인라인 전용(파일 기록 없음): 전체 콘텐츠가 content 필드에 반환됩니다.

인라인 미리보기

파일이 기록되면(명시적 또는 자동), content 필드에는 응답의 미리보기가 포함됩니다:

  • inline_preview_chars > 0이고 len(content) > inline_preview_chars인 경우: [truncated, full response in <file_path>] 접미사가 붙은 잘린 미리보기.

  • inline_preview_chars > 0이고 len(content) <= inline_preview_chars인 경우: 전체 콘텐츠(미리보기에 맞음).

  • inline_preview_chars == 0인 경우: 빈 content(파일에 전체 응답이 있음).

파일이 기록되지 않으면 inline_preview_chars와 관계없이 전체 콘텐츠가 인라인으로 반환됩니다 — 이는 데이터 손실을 방지합니다.

Continue.dev 통합

.continue/mcpServers/llm-chat.yaml에 추가:

name: LLM Chat MCP server
version: 0.2.0
schema: v1
mcpServers:
  - name: LLM Chat MCP server
    command: python
    args:
      - "-m"
      - "llm_chat_mcp"
      - "--default-model"
      - "GLM-5.2-FP8"
      - "--timeout"
      - "570"
      - "--relative_paths_base"
      - "/path/to/your/workspace"
      - "--auto-output-dir"
      - "/path/to/your/workspace/.continue/skills/large-tasks/tmp-outputs"
    env:
      PYTHONPATH: "/path/to/llm-chat-mcp"

그런 다음 Continue.dev를 다시 로드합니다.

프로젝트 구조

llm-chat-mcp/
├── pyproject.toml          # Dependencies: mcp, pyyaml, httpx
├── README.md               # This file
├── llm_chat_mcp/
│   ├── __init__.py
│   ├── __main__.py         # CLI entry point + tool registration
│   ├── config.py           # Config loading, model resolution
│   └── api.py              # API client, error handling
└── tests/
    └── test_output_strategies.py  # Tests for append, inline_preview, auto_file

테스트

python tests/test_output_strategies.py

테스트는 API 호출을 모의(mock)하고 파일 기록 및 응답 조합 로직을 검증합니다. output_file_path, append, inline_preview_chars, auto_file_threshold의 모든 조합을 다룹니다.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers