Skip to main content
Glama

Chat Context MCP

by aolshaun
MCP-VS-EXTENSION.md6.43 kB
# MCP Server vs VSCode Extension: Understanding the Difference ## Two Different Approaches ### MCP Server (Phase 3) **AI decides** when to invoke tools ### VSCode Extension (Phase 4) **User decides** when to invoke actions --- ## Detailed Comparison | Aspect | MCP Server | VSCode Extension | |--------|------------|------------------| | **Who invokes** | AI in current chat | User explicitly | | **Trigger** | AI detects: "how did I..." | User types: `/chat search` | | **UI** | Text-based responses | Rich UI (menus, panels) | | **Ambiguity** | Can be ambiguous | No ambiguity - explicit | | **Universality** | Works everywhere (Cursor, VSCode, Claude) | Editor-specific | | **Proactivity** | AI can auto-help | User must remember to use | | **Discovery** | AI suggests when relevant | User must know commands | | **Implementation** | Uses MCP protocol | Uses VSCode/Cursor Extension API | | **Complexity** | Simpler (just tool handlers) | More complex (UI components) | --- ## Real Examples ### MCP Server Usage ``` User: "I remember we discussed database migrations last week, can you remind me what we decided?" AI: *Internally thinks: User asking about PAST work* *Calls: search_sessions({ query: "database migrations" })* *Receives: [Session "DB Migration Plan" from 5 days ago]* "I found your session 'DB Migration Plan' from 5 days ago. You decided to use Prisma migrations with..." ``` **User didn't explicitly invoke anything** - AI decided to search. ### Extension Usage ``` User types: /chat → UI appears: ┌──────────────────────────────┐ │ 🔍 Search past sessions │ │ 📋 List recent sessions │ │ 🏷️ Browse by tag │ │ 📁 Browse by project │ └──────────────────────────────┘ User clicks: "Search past sessions" → Input box appears: ┌──────────────────────────────┐ │ Search: database migrations │ └──────────────────────────────┘ → Results appear: ┌──────────────────────────────┐ │ 1. DB Migration Plan (5d ago)│ │ 2. Schema Design (2w ago) │ └──────────────────────────────┘ User clicks: "DB Migration Plan" → Session content inserted into chat ``` **User explicitly controlled every step.** --- ## When to Use Each ### Use MCP When: - ✅ You want AI to **proactively help** - ✅ You want to **just ask naturally** and let AI figure it out - ✅ You want it to work in **multiple editors** (Cursor, VSCode, Claude Desktop) - ✅ You prefer **conversational** interaction Example: "Hey, pull in that auth discussion we had" → AI handles it ### Use Extension When: - ✅ You want **explicit control** over when to search - ✅ You want **visual UI** (not just text) - ✅ You prefer **commands** (`/chat`) over conversation - ✅ You want to **browse** sessions visually Example: You know you want to search, you type `/chat search auth` --- ## The Ambiguity Issue ### MCP Ambiguity Example ``` User: "How did I implement authentication?" ``` **Could mean:** 1. "How did I implement it in THIS current chat?" (AI already has this) 2. "How did I implement it in ANOTHER chat?" (needs MCP tool call) ### How MCP Handles It **Option A: AI asks for clarification** ``` AI: "Are you asking about: 1. Our current conversation? 2. A previous chat session?" ``` **Option B: AI makes educated guess** ``` AI: *Checks current chat - no auth discussion found* *Calls search_sessions("authentication")* "I don't see auth in our current chat, but I found 3 past sessions where you worked on it..." ``` **Option C: AI searches proactively** ``` AI: *Calls search tool anyway - it's fast* "I found 3 past sessions about authentication. If you meant our current chat, we haven't discussed auth yet in this conversation." ``` ### Extension Has No Ambiguity ``` User explicitly chooses: /chat search authentication ← Clearly asking for past sessions ``` No confusion possible! --- ## Why Build Both? ### MCP First (Phase 3) - ✅ Universal - works everywhere - ✅ Faster to build - ✅ Foundation for Extension - ✅ Enables AI-driven workflows ### Extension Later (Phase 4) - ✅ Adds explicit control - ✅ Richer UI experience - ✅ Uses same core library - ✅ Complements MCP (not replaces) ### Best of Both Worlds Users can choose their preference: - **Conversational users**: Just talk to AI, let it handle searching - **Power users**: Use `/chat` commands for explicit control - **Both**: AI searches automatically when detected, user can override with commands --- ## Technical Implementation ### MCP Server ```typescript // Simple tool handler server.addTool({ name: "search_sessions", description: "Search PAST sessions...", handler: async (params) => { const api = new CursorContext(); return await api.searchSessions(params); } }); ``` ### Extension ```typescript // Register command vscode.commands.registerCommand('cursor-context.search', async () => { // Show input box const query = await vscode.window.showInputBox(); // Search const api = new CursorContext(); const results = await api.searchSessions({ query }); // Show results in UI const selected = await vscode.window.showQuickPick( results.map(r => ({ label: r.nickname, session: r })) ); // Insert into editor if (selected) { // ... insert logic } }); ``` --- ## Recommendation ### For Phase 3: Build MCP - Start with MCP because it's simpler and universal - Write **very clear tool descriptions** that emphasize "PAST sessions" - Accept that slight ambiguity exists, but it's manageable - Document the ambiguity for users ### For Phase 4: Add Extension - Build Extension for users who want explicit control - Both use the same core library - Complementary, not competitive --- ## Summary **MCP = AI-driven, conversational, universal, slight ambiguity** **Extension = User-driven, explicit, UI-rich, no ambiguity** Both are valuable! MCP for convenience, Extension for control. 🎯

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aolshaun/chat-context-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server