mirror of
https://github.com/open-webui/mcpo
synced 2025-06-26 18:26:58 +00:00
Merge pull request #32 from open-webui/dev
Some checks are pending
Release / release (push) Waiting to run
Some checks are pending
Release / release (push) Waiting to run
0.0.7
This commit is contained in:
commit
e55975a876
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.0.7] - 2025-04-03
|
||||
|
||||
### Added
|
||||
|
||||
- 🖼️ **Image Content Output Support**: mcpo now gracefully handles image outputs from MCP tools—returning them directly as binary image content so users can render or download visuals instantly, unlocking powerful new use cases like dynamic charts, AI art, and diagnostics through any standard HTTP client or browser.
|
||||
|
||||
## [0.0.6] - 2025-04-02
|
||||
|
||||
### Added
|
||||
|
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "mcpo"
|
||||
version = "0.0.6"
|
||||
version = "0.0.7"
|
||||
description = "A simple, secure MCP-to-OpenAPI proxy server"
|
||||
authors = [
|
||||
{ name = "Timothy Jaeryang Baek", email = "tim@openwebui.com" }
|
||||
|
@ -77,13 +77,22 @@ async def create_dynamic_endpoints(app: FastAPI, api_dependency=None):
|
||||
result = await session.call_tool(endpoint_name, arguments=args)
|
||||
response = []
|
||||
for content in result.content:
|
||||
text = content.text
|
||||
if isinstance(text, str):
|
||||
try:
|
||||
text = json.loads(text)
|
||||
except json.JSONDecodeError:
|
||||
pass
|
||||
response.append(text)
|
||||
if isinstance(content, types.TextContent):
|
||||
text = content.text
|
||||
if isinstance(text, str):
|
||||
try:
|
||||
text = json.loads(text)
|
||||
except json.JSONDecodeError:
|
||||
pass
|
||||
response.append(text)
|
||||
elif isinstance(content, types.ImageContent):
|
||||
image_data = content.data
|
||||
image_data = f"data:{content.mimeType};base64,{image_data}"
|
||||
response.append(image_data)
|
||||
elif isinstance(content, types.EmbeddedResource):
|
||||
# TODO: Handle embedded resources
|
||||
response.append("Embedded resource not supported yet.")
|
||||
|
||||
return response
|
||||
|
||||
return tool_endpoint
|
||||
|
Loading…
Reference in New Issue
Block a user