ArgoMCP
德语 | 英语 | 西班牙语 | 法语 | 日语 | 韩语 | 葡萄牙语 | 俄语 | 中文
🚀 介绍
ArgoMCP展示了模型上下文协议(MCP)如何与智能代理相结合,以拓展其超出核心语言模型的能力。通过将代理连接到文件系统、网页抓取器和内存模块等工具,该项目展示了代理如何以模块化和上下文感知的方式检索、处理和生成知识。
✨ 特点
以模型上下文协议(MCP)为中心的设计:该系统围绕模型上下文协议(MCP)构建,确保通信标准化和互操作性。
📂 项目结构
.
├── LICENSE
├── README.md
├── examples
│ ├── demo1.py
│ ├── demo2.py
│ └── demo3.py
├── knowledge
│ ├── user_1.md
│ ├── user_10.md
│ ├── user_2.md
│ ├── user_3.md
│ ├── user_4.md
│ ├── user_5.md
│ ├── user_6.md
│ ├── user_7.md
│ ├── user_8.md
│ └── user_9.md
├── logs
├── output
│ └── antonette.md
├── requirements.txt
├── pyproject.toml
├── run.sh
├── src
│ ├── argomcp
│ │ ├── agent
│ │ │ └── Agent.py
│ │ ├── llm
│ │ │ ├── ChatDoubao.py
│ │ │ └─ ChatOpenAI.py
│ │ ├── mcp
│ │ │ └─── MCPClient.py
│ │ ├── rag
│ │ │ ├── EmbeddingRetriver.py
│ │ │ └─ VectorStore.py
│ │ └── utils
│ │ └── logTitle.pyclassDiagram
class Agent {
+init()
+close()
+invoke(prompt: string)
-mcpClients: MCPClient[]
-llm: ChatOpenAI
-model: string
-systemPrompt: string
-context: string
}
class ChatOpenAI {
+chat(prompt?: string)
+appendToolResult(toolCallId: string, toolOutput: string)
-llm: OpenAI
-model: string
-messages: OpenAI.Chat.ChatCompletionMessageParam[]
-tools: Tool[]
}
class EmbeddingRetriever {
+embedDocument(document: string)
+embedQuery(query: string)
+retrieve(query: string, topK: number)
-embeddingModel: string
-vectorStore: VectorStore
}
class MCPClient {
+init()
+close()
+getTools()
+callTool(name: string, params: Record)
-mcp: Client
-command: string
-args: string[]
-transport: StdioClientTransport
-tools: Tool[]
}
class VectorStore {
+addEmbedding(embedding: number[], document: string)
+search(queryEmbedding: number[], topK: number)
-vectorStore: VectorStoreItem[]
}
class VectorStoreItem {
-embedding: number[]
-document: string
}
Agent --> MCPClient : uses
Agent --> ChatOpenAI : interacts with
ChatOpenAI --> ToolCall : manages
EmbeddingRetriever --> VectorStore : uses
VectorStore --> VectorStoreItem : contains⚡ 快速入门
克隆仓库
git clone https://github.com/BV003/ArgoMCP.git
cd ArgoMCP创建并激活虚拟环境。我们建议使用conda进行依赖管理。
conda create -n argomcp python=3.10 -y
conda activate argomcp安装依赖项
pip install -r requirements.txt
pip install -e .在项目根目录下创建一个.env文件,并添加您的API密钥(例如,OpenAI或其他大型语言模型提供商)。您也可以使用其他模型,只需在/llm目录下实现相应的类即可。
OPENAI_API_KEY=your_api_key_here //openai
ARK_API_KEY=your_api_key_here //doubao
EMBEDDING_MODEL=all-MiniLM-L6-v2
githubtoken=your_api_key_here //for demo2
NOTION_API_KEY=your_api_key_here //for demo3
NOTION_PAGE_ID=your_page_id_here🧪 演示
演示1
使用fileMCP搜索本地的knowledge/目录(其中包含10个.md用户文件),检索与Chelsey Dietrich相关的内容,生成一段简短的个人简介+故事,并将结果保存回仓库中,格式为Markdown文件。
./run.sh
# or
python examples/demo1.py结果将被放置在 output/antonette.md 文件中
演示2
- 已经实现了GitHub MCP Agent的网页应用程序接口,允许用户通过自然语言查询GitHub仓库信息。
在运行之前,请确保已安装并启动了 Docker。
streamlit run examples/demo2.py演示3
- 一个基于终端的交互式Notion助手,它通过MCP工具直接操作Notion页面,同时利用GPT理解自然语言指令并生成相应的操作。
python examples/demo3.py结果
Notion MCP Agent is ready! Start chatting with your Notion pages.
Type 'exit' or 'quit' to end the conversation.
🤖 You : what can you do
INFO Successfully created table 'agno_sessions'
┏━ Message ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ what can you do ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━ Response (5.9s) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ I can help you interact with your Notion pages in various ways. Here are some of the things I can do: ┃
┃ ┃
┃ 1 Read Page Content: Retrieve and display the content of your Notion pages. ┃
┃ 2 Search Information: Search for specific information within your Notion workspace. ┃
┃ 3 Add or Update Content: Insert new content or update existing content, including creating lists, tables, and other Notion blocks. ┃
┃ 4 Page Management: Create new pages, update page properties, and manage page icons and covers. ┃
┃ 5 Block Management: Retrieve, update, or delete specific blocks within a page. ┃
┃ 6 Database Management: Query, update, or retrieve database information. ┃
┃ 7 Commenting: Add comments to specific blocks or pages and retrieve existing comments. ┃
┃ 8 Explain Page Structure: Provide information on how your page is structured. ┃
┃ ┃
┃ If you have any specific tasks you'd like assistance with, feel free to ask! ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
🤖 You : Explain Page Structure
┏━ Message ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ Explain Page Structure ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━ Tool Calls ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ • API-retrieve-a-page(page_id=200fe1fbb5e7800a93d8fdea8c4013c6) ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━ Response (9.8s) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ ┃
┃ The structure of a Notion page involves several elements that help organize and display content effectively. Here's a breakdown of the page structure based on the current ┃
┃ page with ID 2: ┃
┃ ┃
┃ 1 Basic Information: ┃
┃ • Page ID: Unique identifier for the page. ┃
┃ • Created Time: When the page was created. ┃
┃ • Last Edited Time: The most recent time the page was modified. ┃
┃ 2 User Information: ┃
┃ • Created By: The user who created the page. ┃
┃ • Last Edited By: The user who last edited the page. ┃
┃ 3 Visual Elements: ┃
┃ • Icon: An emoji used as an icon, in this case, "🔥". ┃
┃ • Cover Image: No cover image has been set for this page. ┃
┃ • Parent Type: This page is part of the overall workspace. ┃
┃ 4 Properties: ┃
┃ • Title: The title of the page, which is "身体". ┃
┃ 5 URLs: ┃
┃ • Page URL: The direct link to access the page is here. ┃
┃ ┃
┃ Each page can include content blocks like text, images, tables, lists, and more. These blocks can be arranged and customized to suit the needs and preferences of the user. ┃
┃ You can further append, update, and delete content as needed to organize your information effectively. ┃
┃ ┃
┃ Is there anything specific you would like to explore or modify in this page? ┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛🤝 贡献
我们欢迎投稿!无论是:
- 错误修复
- 新功能
- 文档改进
- 翻译
请:
- 先检查现有问题
- 打开一个问题来讨论重大变更
- 提交包含清晰描述的拉取请求(PRs)
🔥 适合初学者
这是一个独立的教育项目,旨在用于学习和实践。
如果你是开源新手:
- 别担心!这个项目对初学者很友好
- 你可以从小事做起(更新README文件,添加注释,修复小错误)
- 你可以在这个项目的基础上进行开发,对其进行定制,甚至可以将其作为你课程作业或个人练习项目的一部分。🤪
🎉 许可证
这个项目遵循MIT许可证授权——详见 许可证 详情请参阅文件。
