Skip to content

Local-first AI assistant for exploring and understanding codebases. Powered by Ollama and MCP (Model Context Protocol). 100% private - runs entirely on your machine.

Notifications You must be signed in to change notification settings

shrimpy8/engineering-assistant

Repository files navigation

Engineering Assistant

A local-first AI assistant that helps developers understand codebases through transparent, secure, and well-designed tooling.

License Node TypeScript

Why This Project?

The Model Context Protocol (MCP) is an open standard that defines how AI models interact with external tools and data sources. Instead of proprietary integrations, MCP provides a universal interfaceβ€”like USB for AI tools. Any MCP-compatible tool works with any MCP-compatible AI system.

This project demonstrates MCP's flexibility by providing two ways to use the same tools:

  1. Web App Mode - A complete local UI powered by Ollama. 100% private, no data leaves your machine.
  2. MCP Server Mode - Connect the same tools to Claude Code, Cursor, or any MCP-compatible AI assistant for more powerful reasoning.

Same sandboxed, read-only file access. Same security guarantees. Your choice of interface and LLM.

Screenshots

Chat Interface with Tool Trace

Ask questions about any codebase and see exactly which files the AI reads in the Tool Trace panel.

Chat with Tool Calling

Settings Panel

Configure your repository path, select models, and adjust LLM parameters.

Settings

How It Works

Visual architecture documentation explaining the data flow and key concepts.

How It Works

Two Ways to Run

Use the local web app with Ollama, or connect the MCP server to Claude Code for enhanced reasoning.

Two Ways to Run

Features

  • Chat with AI about any codebase using local Ollama models
  • Transparent Tool Execution - See every file the AI reads in the Tool Trace panel
  • Read-Only Sandboxed Access - Secure, non-destructive exploration
  • SSE Streaming - Real-time responses with tool lifecycle events
  • MCP Protocol - Built on Model Context Protocol for standardization
  • Pre-loaded Context - Repo structure is pre-fetched so the AI knows your project before you ask
  • How It Works Page - Visual documentation at /how-it-works explaining the architecture

Quick Start Questions

Click these suggested questions to explore any repository:

Button Question
πŸ› οΈ Tech stack What is the technology stack used in this project?
πŸ“‹ What is this project? What is this project about?
πŸ“ Show structure Show me the project structure
πŸ” Find main entry Where is the main entry point?
πŸ“¦ List dependencies What dependencies does this project use?
βš™οΈ Explain codebase Explain the codebase

Prerequisites

  • Node.js 18+
  • npm 9+
  • Ollama running locally with a tool-compatible model

Required: Tool-Compatible Models

This app uses Ollama's native tool calling API for file browsing. Only certain models properly support this.

Verified working models:

Model Size Notes
llama3.1:8b 4.9GB Recommended - Best balance of capability and tool support
llama3.2:3b 2.0GB Faster, but may have stability issues

Models that do NOT work (output JSON text instead of using tool_calls):

  • mistral:7b, qwen2.5-coder, deepseek-coder, codellama
# Install Ollama (macOS)
brew install ollama

# Pull the recommended model
ollama pull llama3.1:8b

Quick Start

# Clone the repository
git clone https://github.com/shrimpy8/engineering-assistant.git
cd engineering-assistant

# Install dependencies
npm install

# Start development server
npm run dev

# Open http://localhost:3000

Project Structure

engineering-assistant/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                 # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ api/v1/          # REST API endpoints
β”‚   β”‚   └── how-it-works/    # Visual architecture documentation
β”‚   β”œβ”€β”€ components/          # React components
β”‚   β”‚   β”œβ”€β”€ chat/            # Chat UI components
β”‚   β”‚   β”œβ”€β”€ settings/        # Settings panel
β”‚   β”‚   β”œβ”€β”€ trace/           # Tool trace panel
β”‚   β”‚   └── ui/              # Reusable UI components
β”‚   β”œβ”€β”€ hooks/               # React hooks (useChat, useSettings)
β”‚   └── lib/                 # Core libraries
β”‚       β”œβ”€β”€ tools/           # MCP tool implementations
β”‚       β”œβ”€β”€ mcp/             # MCP client module
β”‚       β”œβ”€β”€ orchestrator/    # Chat orchestration
β”‚       └── ollama/          # Ollama integration
β”œβ”€β”€ mcp-server/              # Standalone MCP server
β”œβ”€β”€ config/                  # Configuration files
β”‚   └── prompts/             # System prompts
└── docs/                    # Documentation
    β”œβ”€β”€ API.md               # REST API reference
    β”œβ”€β”€ MCP.md               # MCP tools reference
    └── ARCHITECTURE.md      # System architecture

API Endpoints

Endpoint Method Description
/api/v1/health GET Service health check
/api/v1/models GET List available Ollama models
/api/v1/models/pull POST Pull Ollama model (SSE)
/api/v1/files GET List repository files
/api/v1/files/read POST Read file contents
/api/v1/chat/completions POST Chat with AI (SSE streaming)
/api/v1/prompt GET View system prompt

See docs/API.md for full documentation.

MCP Tools

The AI assistant has access to four read-only tools:

Tool Description
list_files List files and directories in a path
read_file Read contents of a specific file
search_files Search for patterns across files using regex
get_repo_overview Get repository structure, stats, and tech detection

See docs/MCP.md for tool parameters and response formats.

Configuration

Create a .env.local file (optional):

# Ollama configuration
OLLAMA_BASE_URL=http://127.0.0.1:11434
OLLAMA_DEFAULT_MODEL=llama3.1:8b

# Optional: Restrict repository access to a specific directory
ALLOWED_REPO_ROOT=/Users/yourname/projects

LLM Settings

Setting Default Notes
Temperature 0.3 Lower values = more reliable tool usage
Max Tool Rounds 2 Enables sequential tool calls
Tool Mode auto AI proactively uses tools

Tip: Keep temperature at 0.1-0.3 for reliable tool calling. Higher values may cause hallucinated file contents.

Pre-fetched Repository Context

When you set a repository path, the app automatically:

  1. Fetches the repository structure using get_repo_overview
  2. Injects this context into the system prompt
  3. The AI knows your project layout before you ask any questions

This eliminates the need to "warm up" with a structure question - you can ask "Explain the codebase" or "What's the tech stack?" immediately and get accurate answers.

Claude Code Integration

Because this project implements MCP, the same tools that power the web app can be used with any MCP-compatible AI assistant. Claude Code is Anthropic's CLI tool that supports MCP servers out of the box.

Two Modes of Operation

Mode LLM Tools Interface Use Case
Web App Ollama (local) Embedded MCP Next.js UI 100% private, local-first
Claude Code Claude (Anthropic) MCP Server CLI More capable reasoning

Quick Setup

  1. Build the MCP server:

    cd mcp-server && npm run build
  2. Add to Claude Code config (~/.claude.json):

    {
      "mcpServers": {
        "engineering-assistant": {
          "type": "stdio",
          "command": "node",
          "args": [
            "/path/to/engineering-assistant/mcp-server/dist/index.js",
            "/path/to/repo/to/explore"
          ]
        }
      }
    }
  3. Restart Claude Code and verify with /mcp

  4. Ask questions explicitly:

    Use the engineering-assistant MCP tools to tell me about this project
    

See docs/claude-code-integration.md for the full setup guide.

Development

# Development server
npm run dev

# Build for production
npm run build

# Run production build
npm start

# Type checking
npm run typecheck

# Linting
npm run lint

Design Principles

  1. Transparency Over Magic - Every AI action visible to users
  2. Local & Private - All processing on user's machine
  3. Security as a Feature - Sandboxed read-only access
  4. Errors Are Part of UX - Actionable error messages
  5. API Design Is Product Design - Consistent, predictable responses

Tech Stack

  • Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
  • Backend: Next.js API Routes, Server-Sent Events
  • AI: Ollama (local LLM), Model Context Protocol (MCP)
  • Testing: Playwright (E2E)

Documentation

License

MIT


Built to demonstrate modern developer tooling practices: transparent AI, local-first architecture, and Stripe-style API design.

About

Local-first AI assistant for exploring and understanding codebases. Powered by Ollama and MCP (Model Context Protocol). 100% private - runs entirely on your machine.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •