### MCP Tool: workspace_manager Examples Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Examples of using the 'workspace_manager' MCP tool for managing project lifecycle, including setting the project root, triggering re-indexing, and retrieving indexing diagnostics. ```json { "tool": "workspace_manager", "arguments": { "action": "set_project_root", "path": "/path/to/new/project" } } { "tool": "workspace_manager", "arguments": { "action": "trigger_index", "path": "/path/to/project" } } { "tool": "workspace_manager", "arguments": { "action": "get_indexing_diagnostics" } } ``` -------------------------------- ### MCP Tool: lsp_query Examples Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Examples of using the 'lsp_query' MCP tool for Language Server Protocol integration, including finding symbol definitions, references, type hierarchies, and analyzing impact. ```json { "tool": "lsp_query", "arguments": { "action": "definition", "path": "/absolute/path/to/file.go", "line": 42, "character": 15 } } { "tool": "lsp_query", "arguments": { "action": "references", "path": "/absolute/path/to/file.go", "line": 42, "character": 15 } } { "tool": "lsp_query", "arguments": { "action": "type_hierarchy", "path": "/absolute/path/to/file.go", "line": 10, "character": 6 } } { "tool": "lsp_query", "arguments": { "action": "impact_analysis", "path": "/absolute/path/to/file.go", "line": 50, "character": 10 } } ``` -------------------------------- ### MCP Tool: search_workspace Examples Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Examples of using the 'search_workspace' MCP tool for various search actions including vector semantic search, regex matching, graph traversal, and checking index status. ```json { "tool": "search_workspace", "arguments": { "action": "vector", "query": "authentication middleware implementation", "limit": 10, "path": "internal/" } } { "tool": "search_workspace", "arguments": { "action": "regex", "query": "func.*Handler\\(", "limit": 50, "path": "*.go" } } { "tool": "search_workspace", "arguments": { "action": "graph", "query": "Searcher" } } { "tool": "search_workspace", "arguments": { "action": "index_status" } } ``` -------------------------------- ### Run Development Server (Next.js) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/frontend-web/README.md Commands to start the Next.js development server using different package managers. This allows for local development and testing of the application. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Get Codebase Skeleton (Go) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/skills/vector-context/SKILL.md Retrieves the high-level structural overview of the codebase. Useful for understanding the project's organization before diving into details. ```Go func get_codebase_skeleton() { // Implementation to get codebase skeleton } ``` -------------------------------- ### MCP Tool: analyze_code Examples Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Examples of using the 'analyze_code' MCP tool for advanced codebase diagnostics, including AST skeleton generation, dead code detection, duplicate code detection, and dependency validation. ```json { "tool": "analyze_code", "arguments": { "action": "ast_skeleton", "path": "internal/mcp" } } { "tool": "analyze_code", "arguments": { "action": "dead_code", "path": "internal/" } } { "tool": "analyze_code", "arguments": { "action": "duplicate_code", "path": "internal/api" } } { "tool": "analyze_code", "arguments": { "action": "dependencies", "path": "." } } ``` -------------------------------- ### Get Related Context (Go) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/skills/vector-context/SKILL.md Fetches detailed semantic context for a given file, including its code chunks, imports, and resolved local dependencies. Essential for understanding a file's role and connections within the project. ```Go func get_related_context(filePath string) { // Implementation to get related context } ``` -------------------------------- ### Build and Run Vector MCP Go Server Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Instructions for building the server from source and running it in different modes (stdio, daemon, indexing, version check). Requires Go 1.22+ and C++ build tools. ```bash make build ./bin/server ./bin/server -daemon ./bin/server -index ./bin/server -version ``` -------------------------------- ### MCP Configuration for Claude Desktop Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Configure Vector MCP Go as an MCP server for Claude Desktop. ```APIDOC ## MCP Configuration for Claude Desktop Configure Vector MCP Go as an MCP server for Claude Desktop. ### Description This section provides the configuration structure for setting up Vector MCP Go as an MCP server, specifically for integration with applications like Claude Desktop. It outlines the necessary JSON format for defining the MCP server, including its command, arguments, and environment variables. ### Method N/A (Configuration file) ### Endpoint N/A (Configuration file) ### Parameters #### Request Body (JSON Configuration) - **mcpServers** (object) - Required - A map of MCP server configurations. - **vector-mcp-go** (object) - Required - Configuration for the Vector MCP Go server. - **command** (string) - Required - The path to the Vector MCP Go executable. - **args** (array) - Optional - Command-line arguments for the executable. - **env** (object) - Optional - Environment variables for the server process. - **PROJECT_ROOT** (string) - Required - The root directory of the project. - **DATA_DIR** (string) - Required - The directory for storing data. - **ENABLE_LIVE_INDEXING** (string) - Optional - Enables live indexing, "true" or "false". ### Request Example ```json { "mcpServers": { "vector-mcp-go": { "command": "/path/to/vector-mcp-go", "args": [], "env": { "PROJECT_ROOT": "/path/to/your/project", "DATA_DIR": "/home/user/.local/share/vector-mcp-go", "ENABLE_LIVE_INDEXING": "true" } } } } ``` ### Response N/A (This is a configuration example, not an API response.) ``` -------------------------------- ### Systemd Service Configuration Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Run Vector MCP Go as a managed background service using systemd. ```APIDOC ## Systemd Service Configuration Run Vector MCP Go as a managed background service. ### Description This section details how to configure and manage the Vector MCP Go server as a systemd service. It includes the service unit file content and the bash commands to enable, start, and check the status of the service. ### Method N/A (Systemd service configuration and commands) ### Endpoint N/A ### Parameters #### Systemd Service File (`/etc/systemd/system/vector-mcp.service`) - **[Unit]** - **Description** (string) - Description of the service. - **After** (string) - Specifies that the service should start after the network is available. - **[Service]** - **Type** (string) - Service type, typically "simple". - **User** (string) - The user to run the service as. - **Environment** (string) - Sets environment variables for the service process. - **PROJECT_ROOT** (string) - The root directory of the project. - **DATA_DIR** (string) - The directory for storing data. - **ENABLE_LIVE_INDEXING** (string) - Enables live indexing, "true" or "false". - **ExecStart** (string) - The command to execute to start the service. - **Restart** (string) - When to restart the service, e.g., "always". - **RestartSec** (integer) - Seconds to wait before restarting. - **[Install]** - **WantedBy** (string) - Specifies the target to be enabled for, typically "multi-user.target". #### Bash Commands - **sudo systemctl enable vector-mcp.service**: Enables the service to start on boot. - **sudo systemctl start vector-mcp.service**: Starts the service immediately. - **sudo systemctl status vector-mcp.service**: Checks the current status of the service. ### Request Example (Systemd Service File) ```ini # /etc/systemd/system/vector-mcp.service [Unit] Description=Vector MCP Go Server After=network.target [Service] Type=simple User=youruser Environment="PROJECT_ROOT=/path/to/project" Environment="DATA_DIR=/home/user/.local/share/vector-mcp-go" Environment="ENABLE_LIVE_INDEXING=true" ExecStart=/path/to/vector-mcp-go -daemon Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ``` ### Response N/A (This is a configuration and command example, not an API response.) ``` -------------------------------- ### Store Project Context (Go) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/skills/vector-context/SKILL.md Saves contextual information, such as architectural decisions or technical debt notes, into the project's knowledge base. This data can be retrieved later using semantic search. ```Go func store_context(text string) { // Implementation to store context } ``` -------------------------------- ### Trigger Project Indexing (Go) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/skills/vector-context/SKILL.md Initiates the indexing process for a specified project path. This is crucial for ensuring that semantic search and context retrieval are based on the latest codebase. ```Go func trigger_project_index(project_path string) { // Implementation to trigger project indexing } ``` -------------------------------- ### Configure Vector MCP Go Server Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Configuration options for the Vector MCP Go server using environment variables or command-line flags. Covers project root, data directories, model paths, and server port. ```bash # Environment variables export PROJECT_ROOT="/path/to/your/project" export DATA_DIR="$HOME/.local/share/vector-mcp-go" export DB_PATH="$DATA_DIR/lancedb" export MODELS_DIR="$DATA_DIR/models" export MODEL_NAME="BAAI/bge-small-en-v1.5" export RERANKER_MODEL_NAME="cross-encoder/ms-marco-MiniLM-L-6-v2" export API_PORT="47821" export ENABLE_LIVE_INDEXING="true" export DISABLE_FILE_WATCHER="false" export EMBEDDER_POOL_SIZE="2" # Command-line flags ./bin/server -data-dir="/custom/data/path" -models-dir="/custom/models" -db-path="/custom/db" ``` -------------------------------- ### Configure Vector MCP for Claude Desktop Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt JSON configuration snippet for integrating the Vector MCP Go server into the Claude Desktop application settings. ```json { "mcpServers": { "vector-mcp-go": { "command": "/path/to/vector-mcp-go", "args": [], "env": { "PROJECT_ROOT": "/path/to/your/project", "DATA_DIR": "/home/user/.local/share/vector-mcp-go", "ENABLE_LIVE_INDEXING": "true" } } } } ``` -------------------------------- ### Check Project Index Status (Go) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/skills/vector-context/SKILL.md Checks the current indexing status of the project. This is a prerequisite before triggering a new index to avoid redundant operations. ```Go func index_status() { // Implementation to check project index status } ``` -------------------------------- ### Connect to MCP SSE Transport Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Demonstrates how to establish a connection to the MCP server using Server-Sent Events and send tool calls via HTTP POST requests in a browser environment. ```javascript const eventSource = new EventSource('http://localhost:47821/sse'); eventSource.onmessage = (event) => { const message = JSON.parse(event.data); console.log('MCP message:', message); }; fetch('http://localhost:47821/message', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Mcp-Session-Id': sessionId }, body: JSON.stringify({ jsonrpc: '2.0', method: 'tools/call', params: { name: 'search_workspace', arguments: { action: 'vector', query: 'authentication' } }, id: 1 }) }); ``` -------------------------------- ### Manage Context via MCP Tool Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Store, retrieve, or delete architectural context and knowledge items from the vector database. ```json { "tool": "store_context", "arguments": { "text": "All API handlers must validate input using the validation.Validate() function." } } ``` -------------------------------- ### Manage Vector MCP as a Systemd Service Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Configuration and commands to run the Vector MCP Go server as a persistent background service on Linux systems. ```ini [Unit] Description=Vector MCP Go Server After=network.target [Service] Type=simple User=youruser Environment="PROJECT_ROOT=/path/to/project" Environment="DATA_DIR=/home/youruser/.local/share/vector-mcp-go" Environment="ENABLE_LIVE_INDEXING=true" ExecStart=/path/to/vector-mcp-go -daemon Restart=always RestartSec=5 [Install] WantedBy=multi-user.target ``` ```bash sudo systemctl enable vector-mcp.service sudo systemctl start vector-mcp.service sudo systemctl status vector-mcp.service ``` -------------------------------- ### POST /api/context Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Adds manual rules, architectural decisions, or knowledge items to the vector database. ```APIDOC ## POST /api/context ### Description Add manual rules or knowledge to the vector database. ### Method POST ### Endpoint /api/context ### Parameters #### Request Body - **text** (string) - Required - The knowledge or rule text. - **source** (string) - Optional - Origin of the knowledge. - **metadata** (object) - Optional - Additional categorization tags. ### Request Example { "text": "All database queries must use parameterized statements.", "source": "security-guidelines", "metadata": {"category": "security", "priority": "high"} } ### Response #### Success Response (200) - **status** (string) - Success status. - **message** (string) - Confirmation message. #### Response Example { "status": "success", "message": "Context added to Global Brain" } ``` -------------------------------- ### POST /api/tools/call Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Executes any available MCP tool via the REST API interface. ```APIDOC ## POST /api/tools/call ### Description Execute any MCP tool via the REST API. ### Method POST ### Endpoint /api/tools/call ### Parameters #### Request Body - **name** (string) - Required - The name of the tool to execute. - **arguments** (object) - Required - The arguments required by the specific tool. ### Request Example { "name": "search_workspace", "arguments": { "action": "vector", "query": "authentication", "limit": 5 } } ``` -------------------------------- ### Search Codebase Semantically (Go) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/skills/vector-context/SKILL.md Performs a semantic search across the entire codebase using a natural language query. Returns relevant code chunks based on meaning, not just keywords. ```Go func search_codebase(query string, topK int = 5, max_tokens int) { // Implementation for semantic codebase search } ``` -------------------------------- ### Perform Semantic Search via REST API Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Execute hybrid semantic and lexical searches across the indexed codebase using the /api/search endpoint. ```bash curl -X POST http://localhost:47821/api/search \ -H "Content-Type: application/json" \ -d '{ "query": "error handling middleware", "top_k": 5, "docs_only": false }' ``` -------------------------------- ### Find Duplicate Code (Go) Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/skills/vector-context/SKILL.md Identifies and reports sections of code that are duplicated within specified modules or the entire project. Aids in refactoring and reducing redundancy. ```Go func find_duplicate_code(target_path string) { // Implementation to find duplicate code } ``` -------------------------------- ### Modify Workspace via MCP Tool Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Apply patches, create files, run linters, or verify changes within the workspace using the modify_workspace tool. ```json { "tool": "modify_workspace", "arguments": { "action": "apply_patch", "path": "internal/api/server.go", "search": "oldFunctionName", "replace": "newFunctionName" } } ``` -------------------------------- ### Execute MCP Tools via REST API Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Trigger any available MCP tool remotely by sending a request to the /api/tools/call endpoint. ```bash curl -X POST http://localhost:47821/api/tools/call \ -H "Content-Type: application/json" \ -d '{ "name": "search_workspace", "arguments": { "action": "vector", "query": "authentication", "limit": 5 } }' ``` -------------------------------- ### POST /api/search Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Performs a hybrid semantic and lexical search across the indexed codebase to find relevant code chunks. ```APIDOC ## POST /api/search ### Description Performs hybrid semantic and lexical search across the indexed codebase. ### Method POST ### Endpoint /api/search ### Parameters #### Request Body - **query** (string) - Required - The search term or natural language question. - **top_k** (integer) - Optional - Number of results to return. - **docs_only** (boolean) - Optional - Whether to restrict search to documentation files. ### Request Example { "query": "error handling middleware", "top_k": 5, "docs_only": false } ### Response #### Success Response (200) - **id** (string) - Unique identifier for the chunk. - **text** (string) - The code content. - **similarity** (float) - Semantic similarity score. - **metadata** (object) - File path and line information. #### Response Example [ { "id": "chunk_123", "text": "func ErrorMiddleware(next http.Handler) http.Handler {...}", "similarity": 0.89, "metadata": {"path": "internal/api/middleware.go", "start_line": "15", "end_line": "30"} } ] ``` -------------------------------- ### Rune-Safe String Truncation in Go Source: https://github.com/nilesh32236/vector-mcp-go/blob/main/AGENTS.md This pattern ensures that strings are safely truncated to a specific character count without causing multi-byte UTF-8 corruption. It converts the string to a slice of runes before slicing to maintain character integrity. ```go contentStr := originalString r := []rune(contentStr) if len(r) > 10000 { contentStr = string(r[:10000]) + "\n... [Truncated for length]" } ``` -------------------------------- ### MCP SSE Transport Source: https://context7.com/nilesh32236/vector-mcp-go/llms.txt Connect to the MCP server using Server-Sent Events for browser-based clients and send tool calls. ```APIDOC ## MCP SSE Transport Connect to the MCP server using Server-Sent Events for browser-based clients. ### Description This endpoint allows browser-based clients to connect to the MCP server via Server-Sent Events (SSE) to receive real-time messages. It also provides an example of how to send tool calls to the server using a POST request to the `/message` endpoint. ### Method GET (for SSE stream) POST (for sending messages) ### Endpoint - SSE Stream: `http://localhost:47821/sse` - Send Message: `http://localhost:47821/message` ### Parameters #### Request Body (for POST /message) - **jsonrpc** (string) - Required - The JSON-RPC version, typically "2.0". - **method** (string) - Required - The method to call, e.g., "tools/call". - **params** (object) - Required - Parameters for the method. - **name** (string) - Required - The name of the tool to call, e.g., "search_workspace". - **arguments** (object) - Required - Arguments for the tool. - **action** (string) - Required - The action to perform, e.g., "vector". - **query** (string) - Required - The search query. - **id** (integer) - Required - The request ID. #### Headers (for POST /message) - **Content-Type**: `application/json` - **Mcp-Session-Id**: (string) - Required - The session ID for the MCP connection. ### Request Example (POST /message) ```json { "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "search_workspace", "arguments": { "action": "vector", "query": "authentication" } }, "id": 1 } ``` ### Response #### Success Response (200 for SSE stream) - **event.data** (string) - JSON string representing the MCP message. #### Response Example (SSE message) ```json { "message": "MCP message: { ... }" } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.