[特殊字符]颠覆MCP!Open WebUI新技术mcpo横空出世!支持ollama!轻松支持各种MCP Server!Cline+Claude3.7轻松开发论文检索MCP Server!

[特殊字符]颠覆MCP!Open WebUI新技术mcpo横空出世!支持ollama!轻松支持各种MCP Server!Cline+Claude3.7轻松开发论文检索MCP Server!

🔥🔥🔥本篇笔记所对应的视频:🚀颠覆MCP!Open WebUI新技术mcpo横空出世!支持ollama!轻松支持各种MCP Server!Cline+Claude3.7轻松开发MCP服务_哔哩哔哩_bilibili

Open WebUI 的 MCPo 项目:将 MCP 工具无缝集成到 OpenAPI 的创新解决方案

随着人工智能工具和模型的快速发展,如何高效、安全地将这些工具集成到标准化的 API 接口中成为了开发者面临的重要挑战。Open WebUI 的 MCPo 项目(Model Context Protocol-to-OpenAPI Proxy Server)正是为了解决这一问题而设计的。本文将带您深入了解 MCPo 的功能、优势及其对开发者生态的影响。


什么是 MCPo?

MCPo 是一个简单、可靠的代理服务器,能够将任何基于 MCP 协议的工具转换为兼容 OpenAPI 的 HTTP 服务器。它通过标准化 RESTful API 接口,让复杂的工具变得易于使用,并支持与大语言模型(LLM)代理和应用程序的无缝交互。

核心功能:

  • 即时兼容性:支持 OpenAPI 工具、SDK 和用户界面,无需额外配置。
  • 安全性与稳定性:采用标准化的 HTTPS 传输协议,支持 JWT 和 API 密钥认证。
  • 自动生成文档:无需手动配置,自动生成交互式 Swagger UI 文档。
  • 纯 HTTP 支持:无需额外的套接字或胶合代码,简化开发流程。

MCPo 的工作原理

MCPo 的核心在于其代理功能,它能够动态发现 MCP 工具并生成 REST API 端点,同时提供人性化的 OpenAPI 文档。以下是其典型工作流程:

  1. 自动生成 API 文档,访问地址为 http://localhost:8000/docs
  2. 用户可以直接调用生成的 API 端点,通过 HTTP 客户端或其他工具进行交互。

启动 MCPo 服务器,例如: 或通过 Python:

uvx mcpo --port 8000 -- your_mcp_server_command 
pip install mcpo mcpo --port 8000 -- your_mcp_server_command 

此外,MCPo 支持通过配置文件管理多个 MCP 工具,使不同工具可以通过唯一路由访问。例如:

{ "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] }, "time": { "command": "uvx", "args": ["mcp-server-time", "--local-timezone=America/New_York"] } } } 

最新功能更新

根据项目最新发布的更新日志,MCPo 引入了以下新特性:

  • 图像内容支持:现在可以直接处理 MCP 工具生成的图像内容,并以二进制格式返回给用户,用于动态图表、AI艺术等场景。
  • CLI API 密钥认证:通过 -api-key 参数轻松保护端点,适用于公共或多代理部署。
  • 灵活的跨域访问控制(CORS):新增 -cors-allow-origins 参数,为前端应用和远程 UI 集成提供支持,同时保持安全性。

为什么选择 MCPo?

相比原生 MCP 协议,MCPo 提供了显著优势:

  • 用户友好的接口:不需要学习新的协议,仅需熟悉 HTTP REST 接口即可操作。
  • 即插即用的集成能力:兼容数千种现有工具和服务。
  • 强大的文档支持:自动维护准确且易用的文档。
  • 安全与稳定性保障:基于成熟框架(如 FastAPI),确保高性能和长久支持。

社区反馈与未来发展

MCPo 项目已在 GitHub 和 Reddit 社区中引发广泛讨论。开发者对其易用性和强大的功能表示认可,同时也提出了改进建议,例如增加 SSL 支持和更灵活的配置选项。

随着人工智能工具需求的增长,MCPo 有望成为连接 AI 工具与标准化接口的重要桥梁,为开发者提供更高效、更安全的解决方案。


🚀安装ollama

Ollama

🚀在ollama中安装模型

ollama run gemma3 

🚀安装mcpo

# 安装mcpo pip install mcpo mcpo --port 8000 --api-key "top-secret" -- your_mcp_server_command # 启动时间mcp server uvx mcpo --port 8000 --api-key "top-secret" -- uvx mcp-server-time --local-timezone=America/New_York # 启动fetch mcp server uvx mcpo --port 8000 -- uvx mcp-server-fetch # 查看文档: <http://localhost:8000/docs> <http://localhost:8000/openapi.json> # 使用配置文件启动 mcpo --config /path/to/config.json # 配置文件示例: { "mcpServers": { "memory": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-memory"] }, "time": { "command": "uvx", "args": ["mcp-server-time", "--local-timezone=America/New_York"] } } } 

🚀安装Open WebUI

# pip 安装 pip install -U open-webui # 启动 open-webui serve # 源代码安装 git clone -b v0.6.0 <https://github.com/open-webui/open-webui.git> cd open-webui/ cp -RPp .env.example .env npm i npm run build cd ./backend pip install -r requirements.txt -U # 启动 bash start.sh 

🚀测试通过MCPO调用MCP Fetch server

import requests import json def fetch_webpage(url, max_length=10000, start_index=0, raw=False): """ Fetch content from a URL using the MCP Fetch server. Args: url (str): The URL to fetch max_length (int): Maximum number of characters to return start_index (int): Start content from this character index raw (bool): Get raw HTML content without markdown conversion Returns: dict: The response from the server containing the fetched content """ try: # Make a POST request to the fetch endpoint response = requests.post( "<http://localhost:8000/fetch>", json={ "url": url, "max_length": max_length, "start_index": start_index, "raw": raw } ) # Ensure the request was successful response.raise_for_status() # Parse the response return response.json() except Exception as e: return {"error": str(e)} # Example usage if __name__ == "__main__": # Fetch the specific URL you requested target_url = "<https://www.aivi.fyi/aiagents/RooCode-Gemini2.5Pro-OpenAIAgentsSDK>" result = fetch_webpage(target_url) print(result) 

Read more

SpringBoot整合Junit与Mybatis实战

SpringBoot整合Junit与Mybatis实战

前言:前面我们学习完了SpringBoot的相关基础知识,以及多环境配置等等,下面我们基于SpringBoot,如何提高开发的效率,注重于代码的业务逻辑,整合Junit和Mybatis。整合就是把复杂的技术细节封装起来,让我们能专注于业务本身。就像我们不需要懂发动机原理也能开车一样。 整合Junit: 实际上我们仅仅是创建了一个SpringBoot项目,然后在测试类中测试。这样看起来似乎没有整合,正所谓“没有所谓的岁月静好,只是有人在为你负重前行”为我们负重前行的实际上是SpringBoot的自动配置功能。 spring-boot-starter-test 当我们创建 Spring Boot 项目时(无论是通过 start.spring.io 还是 IDEA 的 Spring Initializr),pom.xml 中会自动添加这个依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>

By Ne0inhk
Spring boot 4 搞懂 Spring Boot 核心启动流程

Spring boot 4 搞懂 Spring Boot 核心启动流程

本文根据Spring boot 3/4的源代码,针对Spring Boot 核心启动流程进行了总结梳理。 Spring Boot 3/4 的启动核心在于自动化配置与事件驱动。它通过SpringApplication.run()入口,利用 spring.factories、AutoConfiguration、SPI、AOT等加载扩展点。流程历经环境准备、容器刷新(含自动配置与条件化装配)、内嵌Web服务器启动,最后通过 Runner 回调完成就绪,全程由事件发布-监听机制串联。 准备【Run 方法执行前】 即执行SpringApplication的构造函数 1. 入口推断:通过WebApplicationType.deduceFromClasspath()推断 * 如果有 Reactive 相关包,推断为 响应式应用 * 如果没有Servlet相关包,推断为普通应用 * 其它情况,推断为 WEB应用 2. 加载工厂配置:

By Ne0inhk
山东大学《Web数据管理》期末复习宝典【万字解析!】

山东大学《Web数据管理》期末复习宝典【万字解析!】

🌈 个人主页:十二月的猫-ZEEKLOG博客 🔥 系列专栏:🏀山东大学期末速通专用_十二月的猫的博客-ZEEKLOG博客 💪🏻 十二月的寒冬阻挡不了春天的脚步,十二点的黑夜遮蔽不住黎明的曙光  目录 1. 第二章 网络爬虫 1.1 爬虫基础知识 1.2 爬虫分类 1.3 开源工具 Nutch 2. 第三章 网页分析 2.1 正则表达式 2.2 DOM模型 2.3 Beautiful Soup工具 2.4 Scrapy框架 2.5 不同爬虫工具比较 2.6 元搜索引擎 3. 第四章 爬虫与网站的博弈 3.1 Robot协议 3.

By Ne0inhk