Skip to main content

LangConnect Client: GUI interface for managing knowledge bases and connected to RAG service

Project description

LangConnect Client

Next.js React TypeScript Python FastAPI PostgreSQL

A GUI Interface for Vector Database Management

frontend

๐Ÿ“‹ Table of Contents

๐ŸŽฏ Overview

LangConnect Client is a modern, Next.js-based GUI interface for managing vector databases powered by PostgreSQL with pgvector extension. It provides an intuitive web interface for document management, vector search capabilities, and seamless integration with AI assistants through the Model Context Protocol (MCP).

This project was inspired by langchain-ai/langconnect.

โœจ Main Features

๐Ÿ“š Collection Management

  • CRUD operations with custom metadata support
  • Real-time statistics and bulk operations

๐Ÿ“„ Document Management

  • Multi-format support (PDF, TXT, MD, DOCX, HTML)
  • Automatic text extraction and chunking
  • Drag-and-drop batch upload

๐Ÿ” Advanced Search

  • Semantic: Vector similarity search with OpenAI embeddings
  • Keyword: PostgreSQL full-text search
  • Hybrid: Combined search with configurable weights

๐Ÿ” Authentication

  • Supabase JWT authentication with automatic token refresh
  • Role-based access control
  • Secure refresh token management with NextAuth.js

๐Ÿค– MCP Integration

  • 9+ tools for AI assistants (Claude, Cursor)
  • stdio and SSE transport support

๐ŸŽจ Modern UI

  • Next.js with Tailwind CSS
  • Dark/Light themes, Multi-language (EN/KO)

๐Ÿ—๏ธ Architecture

Overall Architecture

Authentication Flow

The authentication system implements a secure token refresh mechanism:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Browser   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚   NextAuth   โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ Supabase  โ”‚
โ”‚             โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚   (JWT)      โ”‚โ—€โ”€โ”€โ”€โ”€โ”‚   Auth    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚                      โ”‚
     โ”‚ httpOnly cookie     โ”‚ refresh token
     โ”‚ (encrypted JWT)     โ”‚ stored in JWT
     โ”‚                      โ”‚
     โ–ผ                      โ–ผ
 Only accessToken      Auto refresh when
 exposed to client     accessToken expires

Key Security Features:

  • Refresh tokens are never exposed to the client
  • Automatic token refresh when access token expires
  • Token rotation on each refresh for enhanced security
  • Encrypted JWT storage in httpOnly cookies

๐Ÿš€ Getting Started

Quick Start

# Clone and setup
git clone https://github.com/teddynote-lab/langconnect-client.git
cd langconnect-client
cp .env.example .env

# Edit .env with your credentials, then:
make build   # Build Docker images
make up      # Start all services

Create MCP configuration

make mcp

Stop services

make down

Prerequisites

  • Docker and Docker Compose
  • Node.js 20+ (for MCP inspector)
  • Python 3.11+ with UV package manager
  • Supabase account

Installation

  1. Clone the repository

    git clone https://github.com/teddynote-lab/langconnect-client.git
    cd langconnect-client
    
  2. Set up environment variables

    cp .env.example .env
    
  3. Configure Supabase

    a. Create a new project at supabase.com

    b. Get your API credentials:

    • Go to Project Settings โ†’ API
    • Copy the URL and anon public key

    c. Update .env file:

    SUPABASE_URL=https://your-project.supabase.co
    SUPABASE_KEY=your-anon-public-key
    
  4. Build the application

    make build
    

Running the Application

  1. Start all services

    make up
    
  2. Access the services

  3. Stop services

    make down
    
  4. View logs

    make logs
    

๐Ÿค– MCP Integration

Automated Setup

  1. Generate MCP configuration

    make mcp
    

    This command will:

    • Prompt for your Supabase credentials
    • Automatically obtain an access token
    • Update .env with the token
    • Generate mcpserver/mcp_config.json
  2. Integration with AI Assistants

    For Claude Desktop:

    • Copy the contents of mcpserver/mcp_config.json
    • Paste into Claude Desktop's MCP settings

    For Cursor:

    • Copy the MCP configuration
    • Add to Cursor's settings under MCP integrations

Available MCP Tools

  • search_documents - Perform semantic/keyword/hybrid search
  • list_collections - List all collections
  • get_collection - Get collection details
  • create_collection - Create new collection
  • delete_collection - Delete collection
  • list_documents - List documents in collection
  • add_documents - Add text documents
  • delete_document - Delete documents
  • get_health_status - Check API health
  • multi_query - Generate multiple search queries from a single question

Sample RAG Prompt

Here is a sample RAG prompt that can be used in Claude Desktop.

You are a question-answer assistant based on given document.
You must use MCP tool(`langconnect-rag-mcp`) to answer the question.

#Search Configuration:
- Target Collection: (user's request, default value: RAG)
- Search Type: hybrid(preferred)
- Search Limit: 5(default)

#Search Guidelines:
Follow the guidelines step-by-step to find the answer.
1. Use `list_collections` to list up collections and find right **Collection ID** for user's request.
2. Use `multi_query` to generate at least 3 sub-questions which are related to original user's request.
3. Search all queries generated from previous step(`multi_query`) and find useful documents from collection.
4. Use searched documents to answer the question.

---

## Format:
(answer to the question)

**Source**
- [1] (Source and page numbers)
- [2] (Source and page numbers)
- ...

---

[Note]
- Answer in same language as user's request
- Append sources that you've referenced at the very end of your answer.
- If you can't find your answer from <search_results>, just say you can't find any relevant source to answer the question without any narrative sentences.

Running MCP SSE Server

Quick Start with Script

# Use the convenient launcher script
./run_mcp_sse.sh

This script will:

  • Check if all requirements are met (uv, .env file)
  • Verify API server is running
  • Start the MCP SSE server with automatic authentication

Manual Start

# Or run directly
uv run python mcpserver/mcp_sse_server.py

The server now includes automatic authentication:

  • Tests existing token validity on startup
  • Prompts for login if token is expired or missing
  • Automatically updates .env with new token
  • Starts the SSE server on port 8765

Testing MCP Integration

# Test with MCP Inspector
npx @modelcontextprotocol/inspector

In the Inspector:

  1. Select "SSE" as transport type
  2. Enter http://localhost:8765/sse as URL
  3. Connect and test the available tools

๐Ÿ”ง Environment Variables

Variable Description Required
OPENAI_API_KEY OpenAI API key for embeddings Yes
SUPABASE_URL Supabase project URL Yes
SUPABASE_KEY Supabase anon public key Yes
NEXTAUTH_SECRET NextAuth.js secret key Yes
NEXTAUTH_URL NextAuth URL (default: http://localhost:3000) Yes
NEXT_PUBLIC_API_URL Public API URL for frontend Yes
POSTGRES_HOST PostgreSQL host (default: postgres) No
POSTGRES_PORT PostgreSQL port (default: 5432) No
POSTGRES_USER PostgreSQL user (default: teddynote) No
POSTGRES_PASSWORD PostgreSQL password No
POSTGRES_DB PostgreSQL database name No
SSE_PORT MCP SSE server port (default: 8765) No

๐Ÿ‘ฅ Contributors

Teddy Lee
Teddy Lee

๐Ÿ 
fbwndrud
fbwndrud

๐Ÿ 
jikime
jikime

๐Ÿ’ป ๐Ÿ’ช
Key Contributions
  • Next-Connect-UI Development
Community

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Made with โค๏ธ by TeddyNote LAB

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_teddynote_lab_langconnect_client-0.0.1.tar.gz.

File metadata

  • Download URL: iflow_mcp_teddynote_lab_langconnect_client-0.0.1.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_teddynote_lab_langconnect_client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 462858916a88e3a110e2d1d76d4cf04fd6ac528dae50c2d1ed93f9173e453075
MD5 b623c2f7c41fdd5ad9684852868c1df5
BLAKE2b-256 4993f6f3f58f1ddc2fa36bf54475be074bf8ada1aa35bb55f4abf21bfea42daf

See more details on using hashes here.

File details

Details for the file iflow_mcp_teddynote_lab_langconnect_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_teddynote_lab_langconnect_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_teddynote_lab_langconnect_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 689ca34147e81363d5a7c60bf38b9f142d08de2ecba07f12912946e5380bacd2
MD5 28049e731ceb5f0bbd3dbd8500497d5d
BLAKE2b-256 f7aa3cb33c0904afb21531d5428a4be9671971c470f35b23c8a4d800e2ab2ac9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page