Skip to content
Back to search

llm-mcp-rag

LLM + MCP + RAG = Magic

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/kelvinqiu802--llm-mcp-rag/badge.svg)](/listings/kelvinqiu802--llm-mcp-rag)

HTML

<a href="/listings/kelvinqiu802--llm-mcp-rag"><img src="/api/listings/kelvinqiu802--llm-mcp-rag/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 122 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # LLM + MCP + RAG
  2. ## 目标
  3. - **Augmented LLM** (Chat + MCP + RAG)
  4. - 不依赖框架
  5. - LangChain, LlamaIndex, CrewAI, AutoGen
  6. - **MCP**
  7. - 支持配置多个MCP Serves
  8. - **RAG** 极度简化板
  9. - 从知识中检索出有关信息,注入到上下文
  10. - **任务**
  11. - 阅读网页 → 整理一份总结 → 保存到文件
  12. - 本地文档 → 查询相关资料 → 注入上下文
  13. ## **The augmented LLM**
  14. - [Building Effective Agents](https://www.anthropic.com/engineering/building-effective-agents)
  15. ![image.png](./images/image.png)
  16. ```mermaid
  17. classDiagram
  18. class Agent {
  19. +init()
  20. +close()
  21. +invoke(prompt: string)
  22. -mcpClients: MCPClient[]
  23. -llm: ChatOpenAI
  24. -model: string
  25. -systemPrompt: string
  26. -context: string
  27. }
  28. class ChatOpenAI {
  29. +chat(prompt?: string)
  30. +appendToolResult(toolCallId: string, toolOutput: string)
  31. -llm: OpenAI
  32. -model: string
  33. -messages: OpenAI.Chat.ChatCompletionMessageParam[]
  34. -tools: Tool[]
  35. }
  36. class EmbeddingRetriever {
  37. +embedDocument(document: string)
  38. +embedQuery(query: string)
  39. +retrieve(query: string, topK: number)
  40. -embeddingModel: string
  41. -vectorStore: VectorStore
  42. }
  43. class MCPClient {
  44. +init()
  45. +close()
  46. +getTools()
  47. +callTool(name: string, params: Record<string, any>)
  48. -mcp: Client
  49. -command: string
  50. -args: string[]
  51. -transport: StdioClientTransport
  52. -tools: Tool[]
  53. }
  54. class VectorStore {
  55. +addEmbedding(embedding: number[], document: string)
  56. +search(queryEmbedding: number[], topK: number)
  57. -vectorStore: VectorStoreItem[]
  58. }
  59. class VectorStoreItem {
  60. -embedding: number[]
  61. -document: string
  62. }
  63. Agent --> MCPClient : uses
  64. Agent --> ChatOpenAI : interacts with
  65. ChatOpenAI --> ToolCall : manages
  66. EmbeddingRetriever --> VectorStore : uses
  67. VectorStore --> VectorStoreItem : contains
  68. ```
  69. ## **依赖**
  70. ```bash
  71. git clone git@github.com:KelvinQiu802/ts-node-esm-template.git
  72. pnpm install
  73. pnpm add dotenv openai @modelcontextprotocol/sdk chalk**
  74. ```
  75. ## LLM
  76. - [OpenAI API](https://platform.openai.com/docs/api-reference/chat)
  77. ## MCP
  78. - [MCP 架构](https://modelcontextprotocol.io/docs/concepts/architecture)
  79. - [MCP Client](https://modelcontextprotocol.io/quickstart/client)
  80. - [Fetch MCP](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch)
  81. - [Filesystem MCP](https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem)
  82. ## RAG
  83. - [Retrieval Augmented Generation](https://scriv.ai/guides/retrieval-augmented-generation-overview/)
  84. - 译文: https://www.yuque.com/serviceup/misc/cn-retrieval-augmented-generation-overview
  85. - 各种Loaders: https://python.langchain.com/docs/integrations/document_loaders/
  86. - [硅基流动](https://cloud.siliconflow.cn/models)
  87. - 邀请码: **x771DtAF**
  88. - [json数据](https://jsonplaceholder.typicode.com/)
  89. ## 向量
  90. - 维度
  91. - 模长
  92. - 点乘 Dot Product
  93. - 对应位置元素的积,求和
  94. - 余弦相似度 cos
  95. - 1 → 方向完全一致
  96. - 0 → 垂直
  97. - -1 → 完全想法
  98. ![image.png](./images/image1.png)
  99. ![image.png](./images/image2.png)
  100. ![image.png](./images/image3.png)
  101. ![image.png](./images/image4.png)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.