Skip to content

MCP

PT | EN

Vectora works exclusively via MCP (Model Context Protocol). This document describes how Vectora implements MCP, its architecture, and how IDEs (Claude Code, Cursor, Zed) integrate.

What is MCP?

MCP is an open protocol that allows LLMs (Large Language Models) to call “tools” on a computer. Unlike generic REST APIs, MCP is optimized for:

  • Tool Discovery: The IDE discovers which tools are available.
  • Structured I/O: JSON schemas to ensure validation.
  • Error Handling: Structured responses with automatic retry.
  • Capability Negotiation: Client and server agree on features.
┌─────────────┐
│     IDE     │ (Claude Code, Cursor, etc)
│ (MCP Client)│
└──────┬──────┘
       │ {"jsonrpc": "2.0", "method": "resources/list"}
┌──────────────────────────┐
│   Vectora MCP Server     │
│ (mcp service running)    │
│                          │
│ • Tool: search_context   │
│ • Tool: analyze_file     │
│ • Tool: find_references  │
└──────────────────────────┘
       │ {"result": [...], "tools": [...]}

Why Does Vectora Use MCP?

AlternativeProblemHow MCP Resolves
REST APISDK in each IDE, complex configurationMCP is native in Claude Code/Cursor
CLI ToolNo shared context between IDE and toolMCP maintains state between calls
SubprocessSlow, no structured outputMCP is efficient + native JSON
LSP (Language Server)Designed for autocomplete, not AIMCP is generic for any tool

Result: One IDE (Claude Code) ↔ Multiple MCPs (Vectora, pytest, git, file-system).

Vectora MCP Architecture

Vectora implements MCP with a clear stack: the MCP client in the IDE connects to the Vectora server via STDIO, which orchestrates the Harness Runtime, Context Engine, and Tool Executor.

Components

IDE (Claude Code)
    └─→ MCP Client (built-in)
         ├─→ STDIO Transport (pipe)
         └─→ Vectora MCP Server
              ├─→ Harness Runtime (validation)
              │    ├─→ Guardian (security)
              │    └─→ Preconditions (verification)
              ├─→ Context Engine (search)
              │    ├─→ Embeddings (Voyage 4)
              │    ├─→ Search (HNSW + Qdrant)
              │    └─→ Reranking (Voyage 2.5)
              └─→ Tool Executor
                   ├─→ search_context
                   ├─→ analyze_file
                   ├─→ find_references
                   └─→ ... (12 tools total)

Transport

Vectora MCP uses STDIO (stdin/stdout pipes):

# In Claude Code's settings.json
"mcp": {
  "vectora": {
    "command": "vectora",
    "args": ["mcp", "--stdio"]
  }
}

# Vectora starts with:
# STDIN ← JSON messages from the IDE
# STDOUT → JSON responses from Vectora

Protocol Flow

The MCP flow in Vectora goes through three phases: initialization where the IDE and server negotiate capabilities, discovery of available tools, and tool execution with error handling.

1. Initialization

// IDE sends
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {},
    "clientInfo": {
      "name": "claude-code",
      "version": "1.0.0"
    }
  }
}

// Vectora responds
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2024-11-05",
    "capabilities": {
      "tools": {} // Available tools
    },
    "serverInfo": {
      "name": "vectora",
      "version": "0.8.0"
    }
  }
}

2. Tool Discovery

// IDE requests tools list
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/list"
}

// Vectora lists (simplified example)
{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tools": [
      {
        "name": "search_context",
        "description": "Semantic search across codebase",
        "inputSchema": {
          "type": "object",
          "properties": {
            "query": {"type": "string"},
            "top_k": {"type": "integer", "default": 10}
          }
        }
      }
    ]
  }
}

3. Tool Execution

// IDE calls tool
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "search_context",
    "arguments": {
      "query": "How to validate JWT tokens?",
      "top_k": 5
    }
  }
}

// Vectora executes (passes through Harness + Guardian)
// Returns result
{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Found 5 relevant chunks..."
      },
      {
        "type": "text",
        "text": "[JSON with chunks, metadata, precision]"
      }
    ]
  }
}

Vectora MCP Tools (12 Total)

ToolInputOutputLatency SLA
search_contextquery, top_kchunks, precision<300ms
analyze_filefile_pathstructure, imports, exports<200ms
find_referencessymbol_namecall sites, types<250ms
file_summaryfile_pathsummary, key functions<150ms
list_workspacefilter (opt)files, structure<100ms
get_dependenciesfile_pathdirect, indirect deps<200ms
analyze_changesfile_paths[]impact analysis<400ms
validate_importsfile_paths[]validation results<300ms
search_by_typetype_nameusages of type<250ms
get_configkey (opt)config value<50ms
index_statusnonestatus, size, chunks<100ms
execute_queryquery_type, paramsgeneric query<500ms

See MCP Tools Reference for full details.

IDE Configuration

Each IDE has a different process for configuring MCP servers. Below are examples for the most used platforms.

Claude Code (Recommended)

// ~/.claude/claude_desktop_config.json
{
  "mcpServers": {
    "vectora": {
      "command": "vectora",
      "args": ["mcp", "--stdio"]
    }
  }
}

Cursor

// .cursor/settings.json
{
  "mcp": {
    "vectora": {
      "command": "vectora",
      "args": ["mcp", "--stdio"],
      "env": {
        "VECTORA_NAMESPACE": "my-project"
      }
    }
  }
}

Zed

// .zed/settings.json
{
  "language_servers": {
    "vectora": {
      "binary": {
        "path": "vectora"
      },
      "initialization_options": {
        "namespace": "my-project"
      }
    }
  }
}

Error Handling

MCP defines structured errors:

// Tool fails with error
{
  "jsonrpc": "2.0",
  "id": 3,
  "error": {
    "code": -32602,
    "message": "Invalid params",
    "data": {
      "error_code": "NAMESPACE_NOT_FOUND",
      "detail": "Namespace 'invalid' does not exist"
    }
  }
}

Vectora error codes:

  • NAMESPACE_NOT_FOUND (404)
  • AUTHENTICATION_FAILED (401)
  • RATE_LIMIT_EXCEEDED (429)
  • INVALID_SCHEMA (400)
  • TIMEOUT (504)
  • INTERNAL_ERROR (500)

Performance & Optimizations

Vectora implements various techniques to maintain low latency and high scalability: streaming for large responses, caching frequent results, and batch processing.

Streaming (For large responses)

MCP supports streaming of tool results:

// Chunked response
{
  "jsonrpc": "2.0",
  "id": 3,
  "result": {
    "content": [
      { "type": "text", "text": "Chunk 1...", "partial": true },
      { "type": "text", "text": "Chunk 2...", "partial": true },
      { "type": "text", "text": "Chunk 3...", "partial": false } // end
    ]
  }
}

Caching

Vectora caches search results:

Client: search_context("How to validate tokens?")
  ↓ (first time)
Server: Processes + Returns + **Caches with 5min TTL**
  ↓ (second time, same query within 5min)
Server: Returns from cache (0ms vs 230ms)

Batch Calls

IDEs can make multiple parallel calls:

[
  {"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "search_context", "arguments": {...}}},
  {"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "analyze_file", "arguments": {...}}},
  {"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "find_references", "arguments": {...}}}
]

Debug & Logging

To understand what is happening between the IDE and Vectora, use the MCP Inspector or activate structured logging. Both help diagnose integration issues.

MCP Inspector

# View MCP messages in real-time
# (IDE + Vectora)
vectora mcp --debug

# Output:
# [MCP] Client → Server: {"jsonrpc": "2.0", "method": "initialize", ...}
# [MCP] Server → Client: {"jsonrpc": "2.0", "result": {...}, ...}
# [MCP] Tool call: search_context | Query: "..." | Time: 234ms

Logging Structure

# logs/mcp.log (JSON)
{
  "timestamp": "2026-04-19T10:30:45Z",
  "level": "INFO",
  "event": "tool_executed",
  "tool_name": "search_context",
  "tool_duration_ms": 234,
  "error_code": null,
  "precision": 0.87,
  "chunks_returned": 5,
}

Comparison: MCP vs Alternatives

AspectMCPREST APILSP
SetupAutomatic in IDEManual configManual config
DiscoveryDynamic (tools/list)Static documentationStatic
StatePersistent (session)StatelessStateless
Latency<10ms IPC>100ms network<50ms IPC
IDE SupportClaude Code, Cursor, ZedAllSome

Conclusion: MCP is ideal for tools that need persistent context + discovery.

External Linking

ConceptResourceLink
MCPModel Context Protocol Specificationmodelcontextprotocol.io/specification
MCP Go SDKGo SDK for MCP (mark3labs)github.com/mark3labs/mcp-go
Anthropic ClaudeClaude Documentationdocs.anthropic.com/
Voyage EmbeddingsVoyage Embeddings Documentationdocs.voyageai.com/docs/embeddings
Voyage RerankerVoyage Reranker APIdocs.voyageai.com/docs/reranker
JWTRFC 7519: JSON Web Token Standarddatatracker.ietf.org/doc/html/rfc7519

Part of the Vectora ecosystem · Open Source (MIT) · Contributors