LangChain Demo
БесплатноНе проверенEnables grounding AI responses in a local document corpus by exposing MCP tools to list, search, and summarize documents, and generating answers using OpenAI.
Описание
Enables grounding AI responses in a local document corpus by exposing MCP tools to list, search, and summarize documents, and generating answers using OpenAI.
README
This repository demonstrates a small Model Context Protocol style workflow in Python.
It shows how to:
- expose reusable tools through MCP
- keep a local document corpus in the repo
- retrieve grounded context from those documents
- generate a short OpenAI-backed answer from the retrieved context
- run the same project as a CLI for quick checks
What’s Inside
- MCP tools for listing, searching, and summarizing local documents
- a CLI mode for quick smoke testing
- a small local knowledge base in
docs/ - a test suite for non-network logic
- project docs that cover architecture, configuration, testing, and security
Setup
cd C:\Projects\MCP
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
pip install -r requirements-dev.txt
Copy-Item .env.example .env
Set OPENAI_API_KEY in your environment or .env.
Run
python app.py
The demo starts a local MCP server on stdin/stdout for tool use by default and also provides a CLI mode for quick testing.
To run the HTTP transport instead:
python app.py --transport streamable-http
Architecture
flowchart LR
User[User or Client] --> MCP[MCP Server]
MCP --> Docs[(Local Markdown Docs)]
MCP --> List[list_docs]
MCP --> Search[search_docs]
MCP --> Summary[summarize_docs]
User --> CLI[CLI Question]
CLI --> Retriever[Document Scoring]
Retriever --> Context[Top Matching Context]
Context --> LLM[OpenAI Chat Model]
LLM --> Answer[Grounded Answer]
Request Flow
- A client or CLI user asks a question.
- The project loads the local documents from
docs/. - The document scorer ranks the best matches.
- The selected context is passed to OpenAI with a grounding instruction.
- The response is returned with the retrieved source set.
Project Structure
app.py: MCP server and CLI entry pointdocs/: architecture, configuration, security, and sample knowledgetests/: unit tests for non-network logicrequirements.txt: runtime dependenciesrequirements-dev.txt: test dependencies.env.example: required environment variables
Configuration
Required:
OPENAI_API_KEY
Optional:
OPENAI_MODEL: defaults togpt-4o-miniMCP_HOST: defaults to127.0.0.1MCP_PORT: defaults to8000MCP_TRANSPORT: defaults tostdio
Run Modes
CLI mode
python app.py --cli "What does this demo project do?"
MCP stdio mode
python app.py
MCP HTTP mode
python app.py --transport streamable-http
Transport Modes
stdio: default and best for local agent connectionsstreamable-http: useful when a client connects over HTTPsse: available for compatibility with older MCP clients
Testing
python -m pytest
The unit tests cover scoring and preview logic without network access. The CLI mode can be used for a live smoke test when OPENAI_API_KEY is set.
Security
Do not commit .env, logs, caches, or API keys. This project uses the same OPENAI_API_KEY environment variable as the earlier AI projects.
If a secret ever appears in a commit or pushed log, rotate it immediately and rewrite the affected history before treating the repo as clean.
Troubleshooting
- If
OPENAI_API_KEYis missing, the CLI will stop before calling the API. - If the MCP SDK is not installed, install dependencies from
requirements.txt. - If a client needs HTTP, use
--transport streamable-httpand the configured host and port. - If the GitHub About box still looks empty, set the repository description, website, and topics in GitHub settings. README content does not populate that panel automatically.
Установка LangChain Demo
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/shafeequealipt-dotcom/LangChain-MCPFAQ
LangChain Demo MCP бесплатный?
Да, LangChain Demo MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для LangChain Demo?
Нет, LangChain Demo работает без API-ключей и переменных окружения.
LangChain Demo — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить LangChain Demo в Claude Desktop, Claude Code или Cursor?
Открой LangChain Demo на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare LangChain Demo with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
