@houtini/lm 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,293 +1,159 @@
1
- # Houtini LM - LM Studio MCP Server with Expert Prompt Library and Custom Prompting
1
+ # @houtini/lm
2
2
 
3
- **Your unlimited AI companion: This MCP server connects Claude to LM Studio for code analysis, generation, and creativity**
3
+ [![npm version](https://img.shields.io/npm/v/@houtini/lm)](https://www.npmjs.com/package/@houtini/lm)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
5
 
5
- Transform your development workflow with our expert-level prompt library for code analysis, professional documentation generation, and creative project scaffolding - all running locally without API costs. For developers, vibe coders and creators alike.
6
+ MCP server that connects Claude to **any OpenAI-compatible LLM endpoint** LM Studio, Ollama, vLLM, llama.cpp, or any remote API.
6
7
 
7
- ## What This Does
8
+ Offload routine work to a local model. Keep your Claude context window for the hard stuff.
8
9
 
9
- Houtini LM **saves your Claude context window** by offloading detailed analysis tasks to LM Studio locally or on your company network whilst Claude focuses on strategy and complex problem-solving. Think of it as your intelligent coding assistant that never runs out of tokens.
10
+ ## Why
10
11
 
11
- **Perfect for:**
12
- - 🔍 **Code analysis** - Deep insights into quality, security, and architecture
13
- - 📝 **Documentation generation** - Professional docs from code analysis
14
- - 🏗️ **Project scaffolding** - Complete applications, themes, and components
15
- - 🎮 **Creative projects** - Games, CSS art, and interactive experiences
16
- - 🛡️ **Security audits** - OWASP compliance and vulnerability detection
12
+ Claude is great at orchestration and reasoning. Local models are great at bulk analysis, classification, extraction, and summarisation. This server lets Claude delegate to a local model on the fly — no API keys, no cloud round-trips, no context wasted.
17
13
 
18
- ## Quick Start Prompt Guide
14
+ **Common use cases:**
19
15
 
20
- Once installed, simply use natural language prompts with Claude:
16
+ - Classify or tag hundreds of items without burning Claude tokens
17
+ - Extract structured data from long documents
18
+ - Run a second opinion on generated code
19
+ - Summarise research before Claude synthesises it
20
+ - Delegate code review to a local model while Claude handles other work
21
21
 
22
- ```
23
- Use houtini-lm to analyse the code quality in C:/my-project/src/UserAuth.js
24
- ```
25
-
26
- ```
27
- Generate comprehensive unit tests using houtini-lm for my React component at C:/components/Dashboard.jsx
28
- ```
29
-
30
- ```
31
- Use houtini-lm to create a WordPress plugin called "Event Manager" with custom post types and admin interface
32
- ```
22
+ ## What's new in v2.1.0
33
23
 
34
- ```
35
- Audit the security of my WordPress theme using houtini-lm at C:/themes/my-theme
36
- ```
24
+ - **Smarter tool descriptions** — tool descriptions now encode prompting best practices for local LLMs, so Claude automatically sends well-structured prompts (complete code, capped output tokens, explicit format instructions)
25
+ - **New `code_task` tool** purpose-built for code analysis with an optimised system prompt and sensible defaults (temp 0.2, 500 token cap)
26
+ - **Delegation guidance** — each tool description tells Claude when to use it, what output to expect, and what to avoid (e.g. never send truncated code to a local model)
37
27
 
38
- ```
39
- Create a CSS art generator project using houtini-lm with space theme and neon colours
40
- ```
28
+ ## Install
41
29
 
42
- ```
43
- Use houtini-lm to convert my JavaScript file to TypeScript with strict mode enabled
44
- ```
45
-
46
- ```
47
- Generate responsive HTML components using houtini-lm for a pricing card with dark mode support
48
- ```
49
-
50
- ## Prerequisites
51
-
52
- **Essential Requirements:**
53
-
54
- 1. **LM Studio** - Download from [lmstudio.ai](https://lmstudio.ai)
55
- - Must be running at `ws://127.0.0.1:1234`
56
- - Model loaded and ready (13B+ parameters recommended)
57
-
58
- 2. **Desktop Commander MCP** - Essential for file operations
59
- - Repository: [DesktopCommanderMCP](https://github.com/wonderwhy-er/DesktopCommanderMCP)
60
- - Required for reading files and writing generated code
61
-
62
- 3. **Node.js 24.6.0 or later** - For MCP server functionality
63
- - Download from [nodejs.org](https://nodejs.org)
64
-
65
- 4. **Claude Desktop** - For the best experience
66
- - Download from [claude.ai/download](https://claude.ai/download)
67
-
68
- ## Installation
69
-
70
- ### 1. Install the Package
30
+ ### Claude Code (recommended)
71
31
 
72
32
  ```bash
73
- # Install globally via npm
74
- npm install -g @houtini/lm
75
-
76
- # Or use npx (no installation required)
77
- npx @houtini/lm
33
+ claude mcp add houtini-lm -e LM_STUDIO_URL=http://localhost:1234 -- npx -y @houtini/lm
78
34
  ```
79
35
 
80
- ### 2. Configure Claude Desktop
36
+ ### Claude Desktop
81
37
 
82
- Add to your Claude Desktop configuration file:
83
-
84
- **Windows**: `%APPDATA%/Claude/claude_desktop_config.json`
85
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
38
+ Add to `claude_desktop_config.json`:
86
39
 
87
40
  ```json
88
41
  {
89
42
  "mcpServers": {
90
43
  "houtini-lm": {
91
44
  "command": "npx",
92
- "args": ["@houtini/lm"],
45
+ "args": ["-y", "@houtini/lm"],
93
46
  "env": {
94
- "LLM_MCP_ALLOWED_DIRS": "C:/your-projects,C:/dev,C:/websites"
47
+ "LM_STUDIO_URL": "http://localhost:1234"
95
48
  }
96
49
  }
97
50
  }
98
51
  }
99
52
  ```
100
53
 
101
- ### 3. Start LM Studio
102
-
103
- 1. Launch LM Studio
104
- 2. Load a model (13B+ parameters recommended for best results)
105
- 3. Start the server at `ws://127.0.0.1:1234`
106
- 4. Verify the model is ready and responding
107
-
108
- ### 4. Verify Installation
109
-
110
- Restart Claude Desktop, then test with:
54
+ ### npx (standalone)
111
55
 
112
- ```
113
- Use houtini-lm health check to verify everything is working
56
+ ```bash
57
+ npx @houtini/lm
114
58
  ```
115
59
 
116
- ## Available Functions
60
+ ## Configuration
117
61
 
118
- ### 🔍 Analysis Functions (17 functions)
119
- - **`analyze_single_file`** - Deep code analysis and quality assessment
120
- - **`count_files`** - Project structure with beautiful markdown trees
121
- - **`find_unused_files`** - Dead code detection with risk assessment
122
- - **`security_audit`** - OWASP compliance and vulnerability scanning
123
- - **`analyze_dependencies`** - Circular dependencies and unused imports
124
- - And 12 more specialized analysis tools...
62
+ Set via environment variables or in your MCP client config:
125
63
 
126
- ### 🛠️ Generation Functions (10 functions)
127
- - **`generate_unit_tests`** - Comprehensive test suites with framework patterns
128
- - **`generate_documentation`** - Professional docs from code analysis
129
- - **`convert_to_typescript`** - JavaScript to TypeScript with type safety
130
- - **`generate_wordpress_plugin`** - Complete WordPress plugin creation
131
- - **`generate_responsive_component`** - Accessible HTML/CSS components
132
- - And 5 more generation tools...
64
+ | Variable | Default | Description |
65
+ |----------|---------|-------------|
66
+ | `LM_STUDIO_URL` | `http://localhost:1234` | Base URL of the OpenAI-compatible API |
67
+ | `LM_STUDIO_MODEL` | *(auto-detect)* | Model identifier — leave blank to use whatever's loaded |
68
+ | `LM_STUDIO_PASSWORD` | *(none)* | Bearer token for authenticated endpoints |
133
69
 
134
- ### 🎮 Creative Functions (3 functions)
135
- - **`css_art_generator`** - Pure CSS art and animations
136
- - **`arcade_game`** - Complete playable HTML5 games
137
- - **`create_text_adventure`** - Interactive fiction with branching stories
70
+ ## Tools
138
71
 
139
- ### ⚙️ System Functions (5 functions)
140
- - **`health_check`** - Verify LM Studio connection
141
- - **`list_functions`** - Discover all available functions
142
- - **`resolve_path`** - Path analysis and suggestions
143
- - And 2 more system utilities...
72
+ ### `chat`
144
73
 
145
- ## Context Window Management
74
+ Delegate a bounded task to the local LLM. The workhorse for quick questions, code explanation, and pattern recognition.
146
75
 
147
- Houtini LM implements intelligent context window management to maximize the efficiency of your local LM models while ensuring reliable processing of large files and complex analysis tasks.
148
-
149
- ### Dynamic Context Allocation
150
-
151
- **Adaptive Context Utilization**: Unlike systems with hardcoded token limits, Houtini LM dynamically detects your model's context window and allocates **95% of available tokens** for optimal performance:
152
-
153
- ```typescript
154
- // Context detection from your loaded model
155
- const contextLength = await model.getContextLength(); // e.g., 16,384 tokens
156
-
157
- // Dynamic allocation - 95% utilization
158
- const responseTokens = Math.floor(contextLength * 0.95); // 15,565 tokens available
76
+ ```
77
+ message (required) — the task, with explicit output format instructions
78
+ system — persona (be specific: "Senior TypeScript dev", not "helpful assistant")
79
+ temperature — 0.1 for code, 0.3 for analysis (default), 0.5 for suggestions
80
+ max_tokens — match to expected output: 150 for quick answers, 300 for explanations, 500 for code gen
159
81
  ```
160
82
 
161
- **Benefits:**
162
- - ✅ **Maximum efficiency** - No wasted context space
163
- - ✅ **Model-agnostic** - Works with any context size (4K, 16K, 32K+)
164
- - ✅ **Future-proof** - Automatically adapts to larger models
165
-
166
- ### Three-Stage Prompt System
83
+ **Tip:** Always send complete code — local models hallucinate details for truncated input.
167
84
 
168
- Houtini LM uses a sophisticated prompt architecture that separates concerns for optimal token management:
85
+ ### `custom_prompt`
169
86
 
170
- **Stage 1: System Context** - Expert persona and analysis methodology
171
- **Stage 2: Data Payload** - Your code, files, or project content
172
- **Stage 3: Output Instructions** - Structured response requirements
87
+ Structured 3-part prompt with separate system, context, and instruction fields. The separation prevents context bleed in local models — better results than stuffing everything into a single message.
173
88
 
174
89
  ```
175
- ┌─────────────────────┐
176
- │ System Context │ ← Expert role, methodologies
177
- ├─────────────────────┤
178
- │ Data Payload │ ← Your files/code (chunked if needed)
179
- ├─────────────────────┤
180
- │ Output Instructions │ ← Response format, requirements
181
- └─────────────────────┘
90
+ instruction (required) — what to produce (under 50 words works best)
91
+ system — persona, specific and under 30 words
92
+ context — COMPLETE data to analyse (never truncated)
93
+ temperature — 0.1 for review, 0.3 for analysis (default)
94
+ max_tokens — 200 for bullets, 400 for detailed review, 600 for code gen
182
95
  ```
183
96
 
184
- **Intelligent Processing:**
185
- - **Small files** → Single-stage execution for speed
186
- - **Large files** → Automatic chunking with coherent aggregation
187
- - **Multi-file projects** → Optimized batch processing
188
-
189
- ### Automatic Chunking Capability
97
+ ### `code_task`
190
98
 
191
- When files exceed available context space, Houtini LM automatically chunks content while maintaining analysis quality:
99
+ Purpose-built for code analysis. Wraps the local LLM with an optimised code-review system prompt and low temperature (0.2).
192
100
 
193
- **Smart Chunking Features:**
194
- - 🔍 **Natural boundaries** - Splits at logical sections, not arbitrary points
195
- - 🔄 **Context preservation** - Maintains analysis continuity across chunks
196
- - 📊 **Intelligent aggregation** - Combines chunk results into coherent reports
197
- - ⚡ **Performance optimization** - Parallel processing where possible
198
-
199
- **Example Chunking Process:**
200
101
  ```
201
- Large File (50KB) Context Analysis Exceeds Limit
202
-
203
- Split into 3 logical chunks → Process each chunk → Aggregate results
204
-
205
- Single comprehensive analysis report
102
+ code (required) complete source code (never truncate)
103
+ task (required) — what to do: "Find bugs", "Explain this function", "Add error handling"
104
+ language — "typescript", "python", "rust", etc.
105
+ max_tokens — default 500 (200 for quick answers, 800 for code generation)
206
106
  ```
207
107
 
208
- ### Timeout Configuration
209
-
210
- Houtini LM uses **120-second timeouts** (2 minutes) to accommodate thorough analysis on lower-powered systems:
211
-
212
- **Why Extended Timeouts:**
213
- - 🔍 **Complex analysis** - Security audits, architecture analysis, and comprehensive code reviews take time
214
- - 💻 **System compatibility** - Works reliably on older hardware and resource-constrained environments
215
- - 🧠 **Model processing** - Larger local models (13B-33B parameters) require more inference time
216
- - 📊 **Quality over speed** - Comprehensive reports are worth the wait
217
-
218
- **Timeout Guidelines:**
219
- - **Simple analysis** (100 lines): 15-30 seconds
220
- - **Medium files** (500 lines): 30-60 seconds
221
- - **Large files** (1000+ lines): 60-120 seconds
222
- - **Multi-file projects**: 90-180 seconds
108
+ **The local LLM excels at:** explaining code, finding common bugs, suggesting improvements, comparing patterns, generating boilerplate.
223
109
 
224
- **Performance Tips:**
225
- - Use faster models (13B vs 33B) for quicker responses
226
- - Enable GPU acceleration in LM Studio for better performance
227
- - Consider using `analysisDepth="basic"` for faster results when appropriate
110
+ **It struggles with:** subtle/adversarial bugs, multi-file reasoning, design tasks requiring integration.
228
111
 
229
- ### Memory Efficiency
112
+ ### `list_models`
230
113
 
231
- **Intelligent Caching**: Results are cached to prevent redundant processing
232
- **Resource Management**: Automatic cleanup of large contexts after processing
233
- **Streaming Responses**: Progressive output delivery for better user experience
114
+ Returns the models currently loaded on the LLM server.
234
115
 
235
- This architecture ensures Houtini LM can handle everything from small utility functions to entire enterprise codebases while maintaining consistent quality and performance across different hardware configurations.
116
+ ### `health_check`
236
117
 
237
- ## Documentation
118
+ Checks connectivity. Returns response time, auth status, and loaded model count.
238
119
 
239
- **Complete guides available:**
240
- - [Analysis Functions Guide](docs/analysis-functions-md.md) - All 17 analysis tools
241
- - [Generation Functions Guide](docs/generation-functions-md.md) - All 10 creation tools
242
- - [Creative Functions Guide](docs/creative-functions-md.md) - Games and art tools
243
- - [System Functions Guide](docs/system-functions-md.md) - Utilities and diagnostics
244
- - [Complete User Guide](docs/user-guide-md.md) - Comprehensive usage manual
120
+ ## Performance guide
245
121
 
246
- ## Recommended Setup
122
+ At typical local LLM speeds (~3-4 tokens/second on consumer hardware):
247
123
 
248
- **For Professional Development:**
249
- - **CPU**: 8-core or better (for local LLM processing)
250
- - **RAM**: 32GB (24GB for model, 8GB for development)
251
- - **Storage**: SSD with 100GB+ free space
252
- - **Model**: Qwen2.5-Coder-14B-Instruct or similar
124
+ | max_tokens | Response time | Best for |
125
+ |------------|--------------|----------|
126
+ | 150 | ~45 seconds | Quick questions, classifications |
127
+ | 300 | ~100 seconds | Code explanations, summaries |
128
+ | 500 | ~170 seconds | Code review, generation |
253
129
 
254
- **Performance Tips:**
255
- - Use 13B+ parameter models for professional-quality results
256
- - Configure `LLM_MCP_ALLOWED_DIRS` to include your project directories
257
- - Install Desktop Commander MCP for complete file operation support
258
- - Keep LM Studio running and model loaded for instant responses
130
+ Set `max_tokens` to match your expected output — lower values mean faster responses.
259
131
 
260
- ## Version History
261
-
262
- ### Version 1.0.0 (Current)
263
- - ✅ Complete function library (35+ functions)
264
- - ✅ Professional documentation system
265
- - ✅ WordPress-specific tools and auditing
266
- - ✅ Creative project generators
267
- - ✅ Comprehensive security analysis
268
- - ✅ TypeScript conversion and test generation
269
- - ✅ Cross-file integration analysis
270
-
271
- ## License
132
+ ## Compatible endpoints
272
133
 
273
- **MIT License** - Use this project freely for personal and commercial projects. See [LICENSE](LICENSE) for details.
134
+ | Provider | URL | Notes |
135
+ |----------|-----|-------|
136
+ | [LM Studio](https://lmstudio.ai) | `http://localhost:1234` | Default, zero config |
137
+ | [Ollama](https://ollama.com) | `http://localhost:11434` | Use OpenAI-compatible mode |
138
+ | [vLLM](https://docs.vllm.ai) | `http://localhost:8000` | Native OpenAI API |
139
+ | [llama.cpp](https://github.com/ggml-org/llama.cpp) | `http://localhost:8080` | Server mode |
140
+ | Remote / cloud APIs | Any URL | Set `LM_STUDIO_URL` + `LM_STUDIO_PASSWORD` |
274
141
 
275
- ## Contributing
142
+ ## Development
276
143
 
277
- We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on:
278
- - Code standards and patterns
279
- - Testing requirements
280
- - Documentation updates
281
- - Issue reporting
282
-
283
- ## Support
144
+ ```bash
145
+ git clone https://github.com/houtini-ai/lm.git
146
+ cd lm
147
+ npm install
148
+ npm run build
149
+ ```
284
150
 
285
- - **Issues**: [GitHub Issues](https://github.com/houtini-ai/lm/issues)
286
- - **Discussions**: [GitHub Discussions](https://github.com/houtini-ai/lm/discussions)
287
- - **Documentation**: Complete guides in the `docs/` directory
151
+ Run the test suite against a live LLM server:
288
152
 
289
- ---
153
+ ```bash
154
+ node test.mjs
155
+ ```
290
156
 
291
- **Ready to supercharge your development workflow?** Install Houtini LM and start building amazing things with unlimited local AI assistance.
157
+ ## License
292
158
 
293
- *Built for developers who think clearly but can't afford to think expensively.*
159
+ MIT
package/dist/index.js CHANGED
@@ -8,10 +8,17 @@
8
8
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
9
9
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
10
10
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
11
- const LM_BASE_URL = process.env.LM_STUDIO_URL || 'http://hopper:1234';
11
+ const LM_BASE_URL = process.env.LM_STUDIO_URL || 'http://localhost:1234';
12
12
  const LM_MODEL = process.env.LM_STUDIO_MODEL || '';
13
+ const LM_PASSWORD = process.env.LM_STUDIO_PASSWORD || '';
13
14
  const DEFAULT_MAX_TOKENS = 4096;
14
15
  const DEFAULT_TEMPERATURE = 0.3;
16
+ function apiHeaders() {
17
+ const h = { 'Content-Type': 'application/json' };
18
+ if (LM_PASSWORD)
19
+ h['Authorization'] = `Bearer ${LM_PASSWORD}`;
20
+ return h;
21
+ }
15
22
  async function chatCompletion(messages, options = {}) {
16
23
  const body = {
17
24
  messages,
@@ -24,7 +31,7 @@ async function chatCompletion(messages, options = {}) {
24
31
  }
25
32
  const res = await fetch(`${LM_BASE_URL}/v1/chat/completions`, {
26
33
  method: 'POST',
27
- headers: { 'Content-Type': 'application/json' },
34
+ headers: apiHeaders(),
28
35
  body: JSON.stringify(body),
29
36
  });
30
37
  if (!res.ok) {
@@ -34,7 +41,7 @@ async function chatCompletion(messages, options = {}) {
34
41
  return res.json();
35
42
  }
36
43
  async function listModels() {
37
- const res = await fetch(`${LM_BASE_URL}/v1/models`);
44
+ const res = await fetch(`${LM_BASE_URL}/v1/models`, { headers: apiHeaders() });
38
45
  if (!res.ok)
39
46
  throw new Error(`Failed to list models: ${res.status}`);
40
47
  const data = (await res.json());
@@ -44,46 +51,77 @@ async function listModels() {
44
51
  const TOOLS = [
45
52
  {
46
53
  name: 'chat',
47
- description: 'Send a message to the local LLM and get a response. Useful for offloading routine analysis to a local model and preserving Claude context.',
54
+ description: 'Delegate a bounded task to the local LLM (Qwen3-Coder, ~3-4 tok/s). ' +
55
+ 'Best for: quick code explanation, pattern recognition, boilerplate generation, knowledge questions. ' +
56
+ 'Use when you can work in parallel — fire this off and continue your own work. ' +
57
+ 'RULES: (1) Always send COMPLETE code, never truncated — the local LLM WILL hallucinate details for missing code. ' +
58
+ '(2) Set max_tokens to match expected output: 150 for quick answers (~45s), 300 for explanations (~100s), 500 for code generation (~170s). ' +
59
+ '(3) Be explicit about output format in your message ("respond in 3 bullets", "return only the function"). ' +
60
+ 'DO NOT use for: multi-step reasoning, creative writing, tasks needing >500 token output, or anything requiring tool use (use lm-taskrunner for tool-augmented tasks via mcpo).',
48
61
  inputSchema: {
49
62
  type: 'object',
50
63
  properties: {
51
- message: { type: 'string', description: 'User message to send' },
52
- system: { type: 'string', description: 'Optional system prompt' },
53
- temperature: { type: 'number', description: 'Sampling temperature (0–2, default 0.3)' },
54
- max_tokens: { type: 'number', description: 'Max tokens in response (default 4096)' },
64
+ message: { type: 'string', description: 'The task. Be specific about expected output format and length. Include COMPLETE code — never truncate.' },
65
+ system: { type: 'string', description: 'Persona for the local LLM. Be specific: "Senior TypeScript dev" not "helpful assistant". Short personas (under 30 words) get best results.' },
66
+ temperature: { type: 'number', description: '0.1 for factual/code tasks, 0.3 for analysis (default), 0.7 for creative suggestions. Stay under 0.5 for code.' },
67
+ max_tokens: { type: 'number', description: 'Cap this to match expected output. 150=quick answer, 300=explanation, 500=code generation. Lower = faster. Default 4096 is almost always too high.' },
55
68
  },
56
69
  required: ['message'],
57
70
  },
58
71
  },
59
72
  {
60
73
  name: 'custom_prompt',
61
- description: 'Run a structured prompt with system message, context, and instruction against the local LLM.',
74
+ description: 'Structured analysis on the local LLM with explicit system/context/instruction separation. ' +
75
+ 'This 3-part format gets the best results from local models — the separation prevents context bleed. ' +
76
+ 'System sets persona (be specific: "Senior TypeScript dev reviewing for security bugs"). ' +
77
+ 'Context provides COMPLETE data (full source file, full error log — never truncated). ' +
78
+ 'Instruction states exactly what to produce (under 50 words for best results). ' +
79
+ 'Best for: code review, comparison, refactoring suggestions, structured analysis. ' +
80
+ 'Expect 30-180s response time depending on max_tokens.',
62
81
  inputSchema: {
63
82
  type: 'object',
64
83
  properties: {
65
- system: { type: 'string', description: 'System prompt / persona' },
66
- context: { type: 'string', description: 'Background context or data to analyse' },
67
- instruction: { type: 'string', description: 'What to do with the context' },
68
- temperature: { type: 'number', description: 'Sampling temperature (default 0.3)' },
69
- max_tokens: { type: 'number', description: 'Max tokens (default 4096)' },
84
+ system: { type: 'string', description: 'Persona. Be specific and under 30 words. Example: "Expert Node.js developer focused on error handling and edge cases."' },
85
+ context: { type: 'string', description: 'The COMPLETE data to analyse. Full source code, full logs, full text. NEVER truncate — the local LLM fills gaps with plausible hallucinations.' },
86
+ instruction: { type: 'string', description: 'What to produce. Under 50 words. Specify format: "List 3 bugs as bullet points" or "Return a JSON array of {line, issue, fix}".' },
87
+ temperature: { type: 'number', description: '0.1 for bugs/review, 0.3 for analysis (default), 0.5 for suggestions.' },
88
+ max_tokens: { type: 'number', description: 'Match to expected output. 200 for bullets, 400 for detailed review, 600 for code generation.' },
70
89
  },
71
90
  required: ['instruction'],
72
91
  },
73
92
  },
93
+ {
94
+ name: 'code_task',
95
+ description: 'Purpose-built for code analysis tasks. Wraps the local LLM with an optimised code-review system prompt. ' +
96
+ 'Provide COMPLETE source code and a specific task — returns analysis in ~30-180s. ' +
97
+ 'Ideal for parallel execution: delegate to local LLM while you handle other work. ' +
98
+ 'The local LLM excels at: explaining code, finding common bugs, suggesting improvements, comparing patterns, generating boilerplate. ' +
99
+ 'It struggles with: subtle/adversarial bugs, multi-file reasoning, design tasks requiring integration. ' +
100
+ 'Output capped at 500 tokens by default (override with max_tokens).',
101
+ inputSchema: {
102
+ type: 'object',
103
+ properties: {
104
+ code: { type: 'string', description: 'COMPLETE source code. Never truncate. Include imports and full function bodies.' },
105
+ task: { type: 'string', description: 'What to do. Be specific and concise: "Find bugs", "Explain this function", "Add error handling to fetchData", "Compare these two approaches".' },
106
+ language: { type: 'string', description: 'Programming language for context: "typescript", "python", "rust", etc.' },
107
+ max_tokens: { type: 'number', description: 'Expected output size. Default 500. Use 200 for quick answers, 800 for code generation.' },
108
+ },
109
+ required: ['code', 'task'],
110
+ },
111
+ },
74
112
  {
75
113
  name: 'list_models',
76
- description: 'List models currently loaded in LM Studio.',
114
+ description: 'List models currently loaded in LM Studio. Use to verify which model will handle delegated tasks.',
77
115
  inputSchema: { type: 'object', properties: {} },
78
116
  },
79
117
  {
80
118
  name: 'health_check',
81
- description: 'Check connectivity to the local LM Studio instance.',
119
+ description: 'Check connectivity and latency to the local LM Studio instance. Run before delegating time-sensitive tasks.',
82
120
  inputSchema: { type: 'object', properties: {} },
83
121
  },
84
122
  ];
85
123
  // ── MCP Server ───────────────────────────────────────────────────────
86
- const server = new Server({ name: 'houtini-lm', version: '2.0.0' }, { capabilities: { tools: {} } });
124
+ const server = new Server({ name: 'houtini-lm', version: '2.1.0' }, { capabilities: { tools: {} } });
87
125
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
88
126
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
89
127
  const { name, arguments: args } = request.params;
@@ -122,6 +160,29 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
122
160
  content: [{ type: 'text', text: resp.choices[0]?.message?.content ?? '' }],
123
161
  };
124
162
  }
163
+ case 'code_task': {
164
+ const { code, task, language, max_tokens: codeMaxTokens } = args;
165
+ const lang = language || 'unknown';
166
+ const codeMessages = [
167
+ {
168
+ role: 'system',
169
+ content: `Expert ${lang} developer. Analyse the provided code and complete the task. Be specific — reference line numbers, function names, and concrete fixes. No preamble.`,
170
+ },
171
+ {
172
+ role: 'user',
173
+ content: `Task: ${task}\n\n\`\`\`${lang}\n${code}\n\`\`\``,
174
+ },
175
+ ];
176
+ const codeResp = await chatCompletion(codeMessages, {
177
+ temperature: 0.2,
178
+ maxTokens: codeMaxTokens ?? 500,
179
+ });
180
+ const codeReply = codeResp.choices[0]?.message?.content ?? '';
181
+ const codeUsage = codeResp.usage
182
+ ? `\n\n---\nModel: ${codeResp.model} | Tokens: ${codeResp.usage.prompt_tokens}→${codeResp.usage.completion_tokens} | ${lang}`
183
+ : '';
184
+ return { content: [{ type: 'text', text: codeReply + codeUsage }] };
185
+ }
125
186
  case 'list_models': {
126
187
  const models = await listModels();
127
188
  return {
@@ -143,7 +204,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
143
204
  content: [
144
205
  {
145
206
  type: 'text',
146
- text: `Connected to ${LM_BASE_URL} (${ms}ms)\nModels loaded: ${models.length}${models.length ? '\n' + models.join(', ') : ''}`,
207
+ text: `Connected to ${LM_BASE_URL} (${ms}ms)\nAuth: ${LM_PASSWORD ? 'enabled' : 'none'}\nModels loaded: ${models.length}${models.length ? '\n' + models.join(', ') : ''}`,
147
208
  },
148
209
  ],
149
210
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,oBAAoB,CAAC;AACtE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE,CAAC;AACnD,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAmBhC,KAAK,UAAU,cAAc,CAC3B,QAAuB,EACvB,UAAwE,EAAE;IAE1E,MAAM,IAAI,GAA4B;QACpC,QAAQ;QACR,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,mBAAmB;QACvD,UAAU,EAAE,OAAO,CAAC,SAAS,IAAI,kBAAkB;QACnD,MAAM,EAAE,KAAK;KACd,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC;IACzC,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,WAAW,sBAAsB,EAAE;QAC5D,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,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C;AACH,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,WAAW,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,KAAK,IAAI,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,24 +1,33 @@
1
1
  {
2
2
  "name": "@houtini/lm",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "description": "MCP server for local LLMs — connects to LM Studio or any OpenAI-compatible endpoint",
6
+ "mcpName": "io.github.houtini-ai/lm",
6
7
  "main": "dist/index.js",
7
8
  "bin": {
8
9
  "houtini-lm": "dist/index.js"
9
10
  },
10
11
  "scripts": {
11
12
  "build": "tsc && node add-shebang.mjs",
12
- "dev": "tsc --watch"
13
+ "dev": "tsc --watch",
14
+ "prepublishOnly": "npm run build"
13
15
  },
14
16
  "keywords": [
15
17
  "mcp",
16
18
  "model-context-protocol",
19
+ "mcp-server",
17
20
  "lm-studio",
21
+ "ollama",
22
+ "vllm",
18
23
  "openai",
24
+ "openai-compatible",
19
25
  "local-llm",
20
26
  "claude",
21
- "ai-tools"
27
+ "ai-tools",
28
+ "llama-cpp",
29
+ "ai",
30
+ "llm"
22
31
  ],
23
32
  "author": "Richard Baxter <richard@richardbaxter.co> (https://richardbaxter.co)",
24
33
  "license": "MIT",
@@ -30,6 +39,10 @@
30
39
  "bugs": {
31
40
  "url": "https://github.com/houtini-ai/lm/issues"
32
41
  },
42
+ "funding": {
43
+ "type": "github",
44
+ "url": "https://github.com/sponsors/houtini-ai"
45
+ },
33
46
  "dependencies": {
34
47
  "@modelcontextprotocol/sdk": "^1.26.0"
35
48
  },
@@ -42,6 +55,7 @@
42
55
  },
43
56
  "files": [
44
57
  "dist/**/*",
58
+ "server.json",
45
59
  "README.md",
46
60
  "LICENSE"
47
61
  ],
package/server.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "Houtini LM",
4
+ "description": "MCP server that connects Claude to any OpenAI-compatible LLM endpoint. Offload routine analysis to a local model and preserve your Claude context window.",
5
+ "icon": "https://houtini.ai/favicon.ico",
6
+ "repository": {
7
+ "url": "https://github.com/houtini-ai/lm",
8
+ "source": "github"
9
+ },
10
+ "version": "2.0.1",
11
+ "packages": [
12
+ {
13
+ "registryType": "npm",
14
+ "identifier": "@houtini/lm",
15
+ "version": "2.0.1",
16
+ "transport": [
17
+ {
18
+ "type": "stdio"
19
+ }
20
+ ],
21
+ "environmentVariables": [
22
+ {
23
+ "name": "LM_STUDIO_URL",
24
+ "description": "Base URL of the OpenAI-compatible API endpoint",
25
+ "isRequired": false,
26
+ "format": "url"
27
+ },
28
+ {
29
+ "name": "LM_STUDIO_MODEL",
30
+ "description": "Model identifier to use for requests (auto-detected if not set)",
31
+ "isRequired": false,
32
+ "format": "string"
33
+ },
34
+ {
35
+ "name": "LM_STUDIO_PASSWORD",
36
+ "description": "Bearer token for API authentication (no auth if blank)",
37
+ "isRequired": false,
38
+ "isSecret": true,
39
+ "format": "string"
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ }