Ambiance MCP Server
Ambiance MCP is a local code-retrieval and analysis server that gives coding agents ranked code context, source excerpts, and dependency-following tools, with optional semantic/AI/frontend/debug helpers.
Retrieve ranked code locations, numbered excerpts, and project context using issue-style or literal queries.
Explore incrementally: discover candidates, read selected files, and follow dependencies/references/routes.
Generate project hints, architecture orientation, and file symbol summaries.
Analyze frontend routes, components, data flow, design system, and risks.
Parse error logs/stack traces into ranked debug context.
Run AST-aware structural searches with ast-grep patterns across multiple languages.
Work offline/deterministically by default, with optional embeddings, AI advice, cloud tools, and handoffs.
Manage token budgets, truncation, runtime status, and embedding/index state.
Provides semantic analysis, AST parsing, and code compaction for C/C++ codebases with intelligent symbol extraction
Enables searching, listing, and analyzing GitHub repositories through cloud integration, providing structured context and graph-based repository analysis
Offers comprehensive semantic analysis, AST parsing, and intelligent code compaction for JavaScript projects with symbol extraction and project navigation
Provides specialized frontend insights and comprehensive analysis for Next.js applications, including architecture detection and React-specific tooling
Supports Node.js project analysis with semantic compaction, dependency analysis, and intelligent navigation hints for server-side JavaScript applications
Integrates with OpenAI APIs for AI-enhanced code analysis, intelligent context generation, detailed code explanations, and embedding-based semantic search
Supports PostgreSQL integration for local development environments when running the full Ambiance server stack
Provides semantic analysis, AST parsing, and intelligent code compaction for Python codebases with comprehensive symbol extraction and project insights
Offers specialized frontend analysis and insights for React applications, including component structure analysis and React-specific architectural patterns
Enables semantic analysis, AST parsing, and code compaction for Rust projects with intelligent symbol extraction and project navigation
Supports Supabase integration for local development environments when running the full Ambiance server stack with local database instances
Provides comprehensive semantic analysis, AST parsing, and intelligent code compaction for TypeScript projects with advanced symbol extraction and type analysis
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Ambiance MCP Server explain the main function in src/index.ts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
| Agent-selected search, complete source reads, and relationship hops |
| Budgeted source evidence; defaults to CLI index output |
| Project orientation and architecture |
| File symbols and analysis |
| Evidence for errors and stack traces |
| Structural search with exact source locations |
| Project file and symbol manifest |
| Runtime and dependency diagnostics on demand |
Enable specialized tools with comma-separated AMBIANCE_MCP_TOOLS groups:
Group | Additional tools |
|
|
|
|
|
|
|
|
|
|
| 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 |
|
Source bundle |
|
|
Larger source bundle |
|
|
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 --jsonThe 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 | Pass an existing absolute |
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 |
AI tools are missing | Enable the |
AI calls fail | Check server-side credentials, provider endpoint, model access, and |
Development
For source builds, the local Codex launcher, and release checks, see CONTRIBUTING.
MIT. See LICENSE.
Available Tools
6 toolsast_grep_searchA
🔍 AST-Grep structural code search tool
Performs powerful structural code search using ast-grep's pattern matching capabilities. Unlike text-based search, this matches syntactical AST node structures.
Key Features:
Structural pattern matching (not just text)
Multi-language support (JS, TS, Python, Go, Rust, etc.)
Wildcard variables ($VAR, $FUNC, $ARGS)
Precise code location information
Fast Rust-based execution with performance optimizations
Comprehensive pattern validation with helpful error messages
120-second timeout for very large projects
Automatic respect for .gitignore files (no manual exclusions needed)
Pattern Syntax:
Use $ + UPPERCASE for wildcards: $FUNC, $VAR, $ARGS
Patterns look like real code: 'function $NAME($ARGS) { $BODY }'
Match specific constructs: 'new $CLASS($ARGS)'
Valid characters: (), {}, [], "", '', numbers, operators, keywords
NOT regex: do NOT use '|', '.*', '.+', '/pattern/', or escapes like '(' or '{'.
Common Mistakes to Avoid: ❌ Don't use: 'function $FUNC' (ambiguous, multiple AST interpretations) ❌ Don't use: 'export $TYPE' (ambiguous, multiple AST interpretations) ❌ Don't use: '$NAME' (too generic, matches everything) ❌ Don't use: /pattern/ (regex syntax not supported)
✅ Good Patterns:
'function $NAME($ARGS) { $BODY }' (complete function structure)
'export const $NAME = $VALUE' (exported constant)
'import $NAME from "$MODULE"' (import statement)
'new $CLASS($ARGS)' (constructor call)
'def ' (Python function definitions)
'class $NAME:' (Python class)
'await $PROMISE' inside 'for ($COND) { $BODY }' (relational patterns)
Examples:
Find all functions: 'function $NAME($ARGS) { $BODY }'
Find all exports: 'export const $NAME = $VALUE'
Find imports: 'import $NAME from "$MODULE"'
Find class instantiation: 'new $CLASS($ARGS)'
Find method calls: '$OBJ.$METHOD($ARGS)'
Find async functions: 'async function $NAME($ARGS) { $BODY }'
Find arrow functions: 'const $NAME = ($ARGS) => $BODY'
Find React components: 'export function $NAME($PROPS) { return $JSX }'
Find Python function definitions: 'def '
Find Python classes: 'class $NAME:'
Advanced Usage:
Use $$$ for zero or more arguments: 'console.log($$$ARGS)'
Use relational rules: 'await $PROMISE' inside 'for ($COND) { $BODY }'
Use multiple searches for OR conditions (alternation not supported)
Direct CLI Usage (for agents with command line access): Agents with command line access can run ast-grep directly:
Basic usage
npx ast-grep --pattern "function $NAME($ARGS) { $BODY }" --lang ts
Python function definitions
npx ast-grep --pattern "def " --lang py
Python classes
npx ast-grep --pattern "class $NAME:" --lang py
With file filtering (recommended for large projects)
npx ast-grep --pattern "def " --lang py src/**/*.py
JSON output
npx ast-grep --pattern "class $NAME:" --lang py --json=stream
Full documentation
npx ast-grep --help
Note: ast-grep respects .gitignore files automatically - no --exclude-dir flags needed
Use Cases:
Code refactoring and migration
Finding specific patterns across codebase
Security auditing for dangerous patterns
Architecture analysis and dependency tracking
Finding unused imports or exports
API usage analysis
Performance Optimizations for Large Projects:
120-second timeout for very large projects
Automatically respects .gitignore files for exclusions
For additional exclusions, configure .gitignore in your project
Tips for Large Projects (like D:\Dev\SWE-agent):
Use filePattern to search specific directories: "src/**/*.py"
Add large directories to .gitignore: node_modules/, tests/, docs/, etc.
Consider CLI usage for better performance: npx ast-grep --pattern "import json" --lang py src/**/*.py
Inputs: projectPath (required), pattern, rulePath, ruleYaml, +8 more.
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
Scored across 6 tools
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.
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.
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.
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
Related MCP Connectors
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceProvides AI-powered code intelligence for any codebase using local LLMs and vector search, enabling semantic code search, pattern analysis, and context-optimized code generation with 90% token savings.2MIT
- AlicenseAqualityDmaintenanceAnalyzes codebases from local directories, GitHub, and Azure DevOps, providing intelligent context to AI coding assistants through repository structure, critical files, and semantic maps.144MIT
- AlicenseNot gradedqualityDmaintenanceMake any LLM a codebase expert instantly. Provides deep code intelligence through semantic search, architecture mapping, security analysis, and smart context that fits perfectly in token windows.MIT
- AlicenseNot gradedqualityBmaintenanceReduces token consumption for AI coding agents by 50-70% through intelligent code context filtering, Git delta tracking, and local SQLite/Tree-sitter indexing.167 npmMIT