Skip to main content
Glama
Ambiance MCP Server

Ambiance MCP Server

by sbarron

Ambiance MCP

Give coding agents ranked code locations, numbered source excerpts, and ways to follow dependencies across a project. Search with issue wording, read selected source, and refine the next query using what the code reveals.

Ambiance MCP shares its retrieval engine with Ambiance CLI. Local code retrieval works without an LLM API key. AI advice and cloud tools are optional.

Qwen for local semantic retrieval

MCP 0.4.0 defaults semantic context to Qwen3-Embedding-0.6B plus BM25. Try this profile on larger codebases when you need to find behavior across modules and only know how to describe the issue. Ambiance CLI uses its lightweight MiniLM profile by default. To opt into Qwen in a compatible CLI build, run ambiance context "How are duplicate uploads handled?" --local-profile qwen3.

Connecting and listing tools do not load the encoder or build an index. The first semantic request uses cached local model assets; it can create or refresh an index.

Qwen requires Python, PyTorch and cached model assets. The compatible CLI package includes setup instructions in docs/local-quality-profile.md and Python requirements in dist/src/local/qwen-requirements.txt. Prepare both before the first semantic call. The tested Windows setup used several GB of encoder-process memory. Each server process can load one worker and reuse it across projects.

MCP retains its worker for five idle minutes by default. Set AMBIANCE_QWEN_IDLE_MS to an integer from 0 to 3600000. A value of 0 keeps the worker resident until shutdown. Set AMBIANCE_LOCAL_PROFILE=default for the MiniLM profile, or USE_LOCAL_EMBEDDINGS=false for deterministic context without embedding work. Explicit profile and idle settings take precedence over MCP defaults.

MCP 0.4.0 installs CLI 0.7.0 as its retrieval runtime. See building from source for the development setup.

Related MCP server: Code Expert MCP Server

Connect your MCP client

Requires Node.js 22 or newer, with npm/npx available to your client. Add an Ambiance server to its MCP configuration, then reconnect:

{
  "mcpServers": {
    "ambiance": {
      "command": "npx",
      "args": ["-y", "@jackjackstudios/ambiance-mcp@latest"]
    }
  }
}

The CLI runtime is installed as a package dependency. Your MCP client launches Ambiance over stdio when it connects; a separate server terminal is unnecessary. Each connected client sends requests to its own registered server process. On Windows, clients that cannot launch npx directly can use "command": "cmd" with "args": ["/c", "npx", "-y", "@jackjackstudios/ambiance-mcp@latest"].

This configuration enables Qwen for semantic context and requires the assets described above. To start with deterministic retrieval, add "env": { "USE_LOCAL_EMBEDDINGS": "false" } to the server configuration. Check the connection with local_runtime_status, then use local_context to retrieve evidence from your project.

Select the project

Pass the repository or worktree's absolute path as projectPath and reuse it on follow-up calls. An agent working inside a Git worktree can obtain it with git rev-parse --show-toplevel. One registration can serve different projects; the path can change on the next call without editing server configuration.

If omitted, a single workspace folder supplied by the client selects the project. Multiple folders, no folders, or a failed workspace lookup require an explicit projectPath. Clients without MCP roots support use WORKSPACE_FOLDER or the server's launch directory as a fallback.

Replace /absolute/path/to/repo in the examples with your project directory. Windows paths are supported; escape backslashes inside JSON strings.

Tools

Use local_explore to build context incrementally. discover ranks ordinary issue words with lexical retrieval; opt-in mode: "hybrid" uses a ready local semantic index and reports the effective mode. search preserves literal matching. Select source and choose dependency/reference/route candidates from that evidence; copy a returned ref into read or follow. Batch discovery with queries and reads with selections, under one response budget. Scope searches to a file or folder. The host agent chooses each hop and verifies behavior. Direct reads and normal source tools are also available; no exploration or context call is mandatory.

For a project with upload cancellation, call local_explore to discover candidates:

{
  "projectPath": "/absolute/path/to/repo",
  "action": "discover",
  "query": "cancel upload retry",
  "scope": "src"
}

Select a relevant target and copy its returned ref into a source read:

{
  "projectPath": "/absolute/path/to/repo",
  "action": "read",
  "ref": "<ref returned by discover>"
}

If that source calls abortUpload, refine discovery with the observed symbol and check which adapter the caller imports. Batch independent queries with queries: ["abortUpload", "upload adapter"] and selected reads with selections: [{ "ref": "<first ref>" }, { "ref": "<second ref>" }]. Inspect each outcome for empty, delivered, deferred, or rejected evidence. Use follow for candidate dependencies, references, or routes, then read the needed source. Changed source requires a new search. Stop when the question is grounded in evidence.

A literal search for cancel upload retry looks for that phrase. If it returns no matches, try discover with the same words, narrow the scope, or refine using an identifier already found in source. Empty results alone do not establish that the code or behavior is absent.

The default tool set is deliberately small:

Tool

Purpose

local_explore

Agent-selected search, complete source reads, and relationship hops

local_context

Budgeted source evidence; defaults to CLI index output

local_project_hints

Project orientation and architecture

local_file_summary

File symbols and analysis

local_debug_context

Evidence for errors and stack traces

ast_grep_search

Structural search with exact source locations

local_project_manifest

Project file and symbol manifest

local_runtime_status

Runtime and dependency diagnostics on demand

Enable specialized tools with comma-separated AMBIANCE_MCP_TOOLS groups:

Group

Additional tools

frontend

frontend_insights

maintenance

manage_embeddings

handoff

local_handoff

ai

ai_get_context, ai_code_explanation, ai_project_insights, ai_debug

cloud

ambiance_search_github_repos, ambiance_list_github_repos, ambiance_get_context, ambiance_get_graph_context

all

All groups

All seven previous local tool names remain available. Set AMBIANCE_MCP_TOOLS=frontend,maintenance to expose the specialized local tools. Existing USE_LOCAL_EMBEDDINGS=true or USE_LOCAL_STORAGE=true configurations also expose manage_embeddings; the latter retains its legacy configuration alias. AI and cloud groups require their existing provider credentials when called.

Startup connects without provider probes, embedding model loading, or background index generation. A context request can use the CLI's incremental index refresh. USE_LOCAL_EMBEDDINGS=false or per-request useEmbeddings=false keeps context retrieval deterministic. Optional provider failures are reported when invoked.

Optional AI advice

Enable the ai group to ask a configured LLM for summaries, explanations, or debugging guidance. The adviser is separate from the model running your coding agent. AI calls send selected project context and the question to the configured provider, using your API account and its pricing.

For OpenAI, make OPENAI_API_KEY available to the server through your client's secret or environment configuration. Add these settings to the server's env object and reconnect:

{
  "AMBIANCE_MCP_TOOLS": "ai",
  "OPENAI_PROVIDER": "openai",
  "OPENAI_BASE_URL": "https://api.openai.com/v1",
  "OPENAI_BASE_MODEL": "gpt-6-luna",
  "OPENAI_MINI_MODEL": "gpt-6-luna",
  "OPENAI_REASONING_EFFORT": "medium",
  "USE_OPENAI_EMBEDDINGS": "false"
}

This example explicitly selects Luna at medium effort for both model slots. Set both slots to gpt-6.1-terra to select Terra instead. Model access and supported reasoning settings depend on the configured provider and model.

For ai_get_context, inspect data.sourceEvidence alongside the adviser report and cite the returned paths and numbered source. If the needed branch is missing, refine with local_explore and read it. The report is advice; source evidence and task verification determine whether an answer or edit is supported.

Semantic retrieval

Use mode: "hybrid" with local_explore to add semantic candidates from a ready local index. It reports the effective mode and index status and falls back when that index is unavailable; discovery does not build or repair it.

For local_context and ai_get_context, useEmbeddings=true enables semantic retrieval and may build or refresh an index. useEmbeddings=false selects deterministic retrieval. Model setup and indexing time are separate from the response-token budget. Enable the maintenance group for index status and explicit create, update, or repair operations.

For a repair lookup, pass evidenceScope: "implementation" to local_context to filter conventional tests, docs, examples, fixtures, benchmarks, and TypeScript declarations from the results. Omit it when you want that supporting evidence. Use local_explore with action: "read" to inspect a returned file and line range.

Response contract

Every tool advertises input and output schemas. Results contain matching JSON in content[0].text and structuredContent:

{
  "success": true,
  "tool": "local_context",
  "data": {
    "files": ["src/example.ts"],
    "locations": [[0, "example", 4, 9]],
    "totalLocations": 1
  },
  "truncated": false,
  "estimatedTokens": 135
}

For context index output, locations contains ranked rows in the form [fileIndex, symbol, startLine, endLine]. Resolve files[fileIndex] against the returned projectPath. Line numbers are one-based. A file dictionary avoids repeating long paths, and index text is omitted because it repeats those locations. totalLocations reports the untrimmed count. Low budgets drop the lowest-ranked locations atomically and set truncated=true while preserving file IDs.

The adapter omits repeated context bundles and answer drafts. It keeps retrieval metadata and embedding freshness or degradation information. For tools other than local_explore, maxTokens defaults to 3000. Context accepts 256-64000; other tools retain their 256-16000 range. The budget counts the complete serialized tool result, including both text and structured output and JSON escaping. Token counts use a four-characters-per-token estimate; they are not model-specific tokenizer guarantees.

local_explore has a separate budget contract: its maxTokens defaults to 6000 and accepts 256-16000 for the shared JSON evidence payload. The adapter allows additional space for the MCP envelope and duplicated representations, capped at min(64000, maxTokens * 4 + 1024). Its maxTokens is not the whole-response limit described above. Inspect per-query and per-read outcomes when a batch cannot fit all selected evidence.

For a curated source bundle, use format="enhanced". contextTokens controls source-evidence generation independently of that whole-response budget:

Output

Source budget

Whole MCP response budget

Index navigation

No source bodies

maxTokens=3000

Source bundle

contextTokens=6000

maxTokens=16000

Larger source bundle

contextTokens=12000

maxTokens=32000

These are ceilings, not targets. index remains compact when its locations fit; raising a token budget does not automatically increase the selected location count. Source bundles preserve complete attributed excerpts when the response must be reduced. They do not silently discard all source text to fit navigation. Compare actual provider usage, since CLI JSON and MCP envelopes have different serialization overhead. Make additional targeted queries when evidence is missing; first-call orientation does not impose a universal one-call limit.

When truncated=true and needed evidence is missing, narrow the query, request a selected file summary, or raise the budget. Handler failures, including {success:false}, return isError=true with an error code, message, and recovery suggestion. Cancellation stops waiting and propagates a signal; already-started work may finish, including mutations.

CLI and handoffs

Direct commands run the installed CLI. Existing context --query and --format json spellings are translated for compatibility:

ambiance-mcp context --query "resolveSessionSelection" --format json --no-embeddings
ambiance-mcp embeddings status --json
ambiance-mcp handoff list --json

The optional handoff tool scopes discovery to the current project by default and creates compact handoffs. Cross-project discovery uses allProjects=true. Raw transcript export requires includeTranscript=true.

CLI context packs are reusable retrieval presets. Saved evidence snapshots from older MCP betas are a different format and are not automatically migrated.

Troubleshooting

Symptom

Next step

Client cannot start the server

Check Node.js 22+, the configured command, and availability of the pinned package version.

Wrong project or PROJECT_PATH_REQUIRED

Pass an existing absolute projectPath on the call and its follow-ups.

Empty discovery or search

Inspect recovery guidance, check scope, and refine using words or identifiers from source.

Source deferred or response truncated

Read fewer selected targets, narrow the query, or increase the relevant budget.

Semantic setup is slow

Use lexical discovery or useEmbeddings=false; inspect index status separately.

AI tools are missing

Enable the ai group and reconnect the client.

AI calls fail

Check server-side credentials, provider endpoint, model access, and local_runtime_status.

Development

For source builds, the local Codex launcher, and release checks, see CONTRIBUTING.

MIT. See LICENSE.

Available Tools

6 tools
frontend_insightsB

🔍 Map routes, components, data flow, design system, and risks in the web layer with embedding-enhanced analysis. Analyzes Next.js/React projects for architecture insights, component similarities, and potential issues using semantic embeddings.

Inputs: projectPath (required), format, includeContent, subtree, +6 more.

local_contextA

🚀 Enhanced local context with deterministic query-aware retrieval, AST-grep, and actionable intelligence. Provides: (1) deterministic AnswerDraft, (2) ranked JumpTargets, (3) tight MiniBundle (≤3k tokens), (4) NextActions—all using AST + static heuristics. Optional embedding enhancement when available. Completely offline with zero external dependencies for core functionality.

Inputs: query (required), projectPath (required), taskType, maxSimilarChunks, +10 more.

local_debug_contextA

🐛 Gather comprehensive debug context from error logs and codebase analysis with focused embedding enhancement

When to use:

  • When you have error logs, stack traces, or console output to analyze

  • When debugging complex issues with multiple file involvement

  • When you need to understand error context across the codebase

  • Before using AI debugging tools to get structured context

What this does:

  • Parses error logs to extract file paths, line numbers, symbols, and error types

  • Extracts focused error contexts (~200 characters) for precise embedding queries

  • Uses tree-sitter to build symbol indexes for TypeScript/JavaScript/Python files

  • Searches codebase for symbol matches with surrounding context

  • ENHANCED: Uses semantic embeddings with focused error contexts for better relevance

  • Processes each error/warning separately for improved semantic matching

  • Ranks matches by relevance (severity, recency, frequency, semantic similarity)

  • Returns comprehensive debug report ready for AI analysis

Input: Error logs or stack traces as text Output: Structured debug context report with ranked matches and semantic insights

Performance: Fast local analysis, ~1-3 seconds depending on codebase size Embedding Features: Focused context queries reduce noise and improve relevance

Inputs: logText (required), projectPath (required), maxMatches, format, +4 more.

local_file_summaryA

📄 Get quick AST-based summary and key symbols for any file. Fast file analysis without external dependencies. Accepts absolute paths or relative paths (when workspace can be detected).

Inputs: filePath (required), includeSymbols, maxSymbols, format.

local_project_hintsC

📊 Generate intelligent project navigation hints with word clouds, folder analysis, and architecture detection. Supports multiple output formats including markdown and HTML, with AI-powered analysis and configurable performance options. Accepts absolute paths or relative paths (when workspace can be detected).

Inputs: projectPath, format, maxFiles, folderPath, +3 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: ast_grep_search is for structural code search, frontend_insights analyzes web architecture, local_context provides general query-aware retrieval, local_debug_context focuses on debugging, local_file_summary gives file-level analysis, and local_project_hints offers project navigation. The descriptions reinforce these unique roles, making tool selection unambiguous.

    Naming Consistency4/5

    The naming is mostly consistent with a clear pattern: all tools use snake_case and start with a descriptive prefix (ast_grep_, frontend_, local_) followed by a noun or noun phrase. The minor deviation is that 'frontend_insights' uses a compound noun while others are simpler (e.g., 'local_context'), but this doesn't hinder readability or predictability.

    Tool Count5/5

    With 6 tools, the count is well-scoped for a code analysis and development assistance server. Each tool serves a specific, valuable function (e.g., search, insights, context, debugging, file summary, project hints), and none feel redundant or out of place, fitting a typical range for such a domain.

    Completeness5/5

    The tool set provides comprehensive coverage for code analysis and development workflows: it includes search (ast_grep_search), architectural analysis (frontend_insights), context retrieval (local_context), debugging (local_debug_context), file-level inspection (local_file_summary), and project navigation (local_project_hints). There are no obvious gaps; agents can handle tasks from low-level code examination to high-level project understanding.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers