genai-lab
Uses OpenAI for generating embeddings and text completions, powering semantic search and RAG answer generation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@genai-labsearch notes for design principles"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GenAI Lab
GenAI Lab is a TypeScript playground for building controlled GenAI workflows with:
Retrieval-Augmented Generation (RAG) over a local knowledge base
LangGraph-based agent planning and routing
MCP (Model Context Protocol) tools/resources/prompts
bounded, safe fallback behavior
It is intentionally compact so the mechanics stay inspectable end-to-end.
Neat project description
GenAI Lab demonstrates a practical pattern for safe AI agents: it separates decision (LLM-planned routing) from execution (typed nodes for retrieval, drafting, answering, and finalization), and exposes the same core capabilities through a direct CLI and an MCP server interface.
Related MCP server: ragi
What the project includes
agentflow (LangGraph)plans a response path based on a user request
retrieves notes when needed
drafts a message or answers a question from retrieved context
retries retrieval once when first pass yields insufficient context
returns deterministic fallback responses when appropriate
RAG utilities
local semantic search over notes using OpenAI embeddings
source-grounded answers with
[note_x]citations
MCP surface
search_notestoolanswer_from_notestoolnotes://allresourcerag_answer_promptprompt template
Repository layout
lib/
agent/
agent-state.ts # LangGraph state schema
mini-agent.ts # LangGraph graph + nodes + routing
embedding.ts # Embedding helpers
knowledge-base.ts # In-memory note dataset
rag-types.ts # Shared RAG types
retrieve-context.ts # Retrieval filtering/threshold flow
rag-answer.ts # Standalone RAG answer generation
semantic-search.ts # Embedding + cosine similarity search
vector-utils.ts # Cosine similarity implementation
mcp/
server.ts # MCP server + tools/resources/prompts
client-test.ts # Script to test server tools/resources/prompts
llm-client-test.ts # Script showing LLM tool selection via MCP
scripts/
agent.ts # Run the LangGraph mini agent
rag.ts # Run standalone RAG answer flow
semantic-search.ts # Run semantic search directlySetup
Requirements:
Node.js 18+
pnpm
pnpm installCreate .env.local at the repository root:
OPENAI_API_KEY=your_openai_api_keyBoth completion and embedding calls use OpenAI:
gpt-4.1-minifor planning/answering/draftingtext-embedding-3-smallfor semantic search
Usage
Run the mini agent
pnpm agent "Can you explain why retrieval should happen before generation?"Output includes the full final state and finalResponse.
Run standalone RAG
pnpm rag "Why do long chats become more expensive?"Run semantic search
pnpm semantic-search "backend tool execution"Start MCP server
pnpm mcp:serverRuns over stdio and exposes tools/resources/prompts defined in mcp/server.ts.
MCP integration checks
pnpm mcp:test # raw tool/resource/prompt client checks
pnpm mcp:llm # LLM-driven MCP tool-calling demoHow the agent flow works
Planner (
planner): maps request intent into an execution plan (retrieve_notes,answer_question,draft_message,final_response).Retrieve (
retrieveNotes): runs similarity retrieval when required.Draft/Answer (
draftMessage/answerQuestion):drafts a Slack-style message
or answers using only retrieved notes, with citations
Retry policy:
if first retrieval is empty and this is the first attempt, retry once with a broader query and lower threshold
Finalize (
finalize): returns drafted output, RAG answer, retrieved context, or a bounded fallback.
The state machine is intentionally explicit and inspectable:
START -> planner
├─> retrieveNotes -> answerQuestion -> finalize
├─> retrieveNotes -> draftMessage -> finalize
├─> draftMessage -> finalize
└─> finalizeDesign principles implemented
Controlled output quality: tool use and response style are constrained by explicit system prompts.
No side-effect leakage: the planner only decides plan, all actions are backend nodes.
Source grounding: answers can cite only known sources (
[note_#]).Bounded behavior: retries are limited and unsupported requests take a safe fallback path.
Notes on MCP and agent parity
The LangGraph flow and MCP tools use the same underlying retrieval/RAG primitives:
semantic search logic lives in
lib/semantic-search.tsanswer generation logic lives in
lib/rag-answer.tsnote store is shared in
lib/knowledge-base.ts
This allows you to compare:
in-repo agent orchestration (
pnpm agent)direct function style RAG (
pnpm rag)tool-based orchestration (
pnpm mcp:llm)
Future improvements
Persist notes in a real vector database
Add chunking and richer document metadata
Add confidence thresholds + eval snapshots
Add contract tests for planner routing and retrieval fallback
Quality checklist
pnpm typecheckvalidates strict TypeScript compilation.pnpm formatformats all files with Prettier.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA simple server implementing the Model Context Protocol (MCP) that exposes personal tools like note-taking for compatible MCP clients or agents.Last updated21,967MIT
- AlicenseAqualityBmaintenanceLocal-first RAG indexing and semantic search MCP server. Enables document retrieval and context-aware queries using local embedding models.Last updated325MIT
- Alicense-qualityDmaintenanceMCP server that provides standardized tools for querying and retrieving notes from Joplin personal knowledge manager through its API, enabling AI assistants to access and reference personal notes contextually.Last updated9MIT
- Alicense-qualityBmaintenanceMCP server for AI agents to read, write, and organize notes in a local-first, human-in-the-loop note-taking app.Last updated181MIT
Related MCP Connectors
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Gamoventure1175/genai-lab'
If you have feedback or need assistance with the MCP directory API, please join our Discord server