ADR-017: MCP-LSP Integration Architecture

Status: Accepted Version: 1.0 Date: 2025-12-21 Supersedes: N/A Related ADRs: ADR-016 Related PRDs: N/A


[!NOTE] Implementation Details: The technical specification for this architecture is in SDS-052: Semantic Tooling & IDE Integration. This ADR remains the authoritative architectural decision; SDS-052 provides implementation details.

Context

SEA-Forge™ includes language intelligence capabilities via the DomainForge™ DSL language server. To enable AI agents to leverage this semantic intelligence, we need a standardized way to expose LSP capabilities.

LSP (Language Server Protocol) provides authoritative, semantic code intelligence (hover, go-to-definition, diagnostics, code actions).

MCP (Model Context Protocol) provides LLM applications a standardized way to call tools and access resources, enabling models to request context rather than guessing.

When integrated:

Decision

Expose DomainForge™ LSP capabilities via MCP as a semantic probe for AI agents, treating hover, diagnostics, and code actions as safe, authoritative tools.

Integration Architecture

1
2
3
4
5
VS Code Extension (Node/TS) ↔ Rust LSP Server ↔ MCP Server (optional)
                                    ↓
                            Standard LSP Clients
                                    ↓
                            AI Agents via MCP

Approach Selection

Option Description Verdict
FastMCP (Python) Quick MVP, minimal code ❌ Problematic for VS Code (Python dependency)
Node MCP Server Runs in extension host ✅ Best for VS Code packaging
Rust MCP Server Single binary with LSP ✅ Best for long-term infra
No MCP Direct LSP from VS Code ✅ Simplest for VS Code-only

Recommendation: For VS Code extension, prefer No MCP (use VS Code’s existing LSP integration) or Node MCP Server. Use Rust MCP Server if shared service is needed across multiple clients.

LSP Tools to Expose via MCP

Expose a small, safe subset of LSP requests:

Tool LSP Method MCP Exposure
Hover textDocument/hover ✅ Primary — fast, safe, authoritative
Diagnostics textDocument/publishDiagnostics ✅ Read-only error/warning info
Definition textDocument/definition ✅ Navigation context
References textDocument/references ✅ Usage discovery
Code Actions textDocument/codeAction ⚠️ Preview only, no auto-apply
Rename textDocument/rename ⚠️ Preview only, human approval required

Security and Permissions

Default stance: least privilege

Trust boundary rules:

Value Proposition

What you gain:

When it’s not worth it:

Rationale

Hover is the highest ROI tool to expose first because:

This gives AI agents a “semantic microscope” without mutation risks.

Alternatives Considered

Direct Code Analysis by AI

Rejected — LLMs cannot reliably analyze code semantics; leads to hallucination.

Separate AI Parser

Rejected — Duplicates work; diverges from language server truth.

Full LSP Exposure

Rejected — Too dangerous; mutations without validation.

Constraints

Quality Attributes

Bounded Contexts Impacted

Consequences

Positive

Negative

Additional Notes

Post-MVP (requires stable LSP server)