Skip to content

feat: hosted MCP server#3655

Merged
aaravgarg merged 14 commits into
BasedHardware:mainfrom
neooriginal:pre-hosted-mcp
Dec 15, 2025
Merged

feat: hosted MCP server#3655
aaravgarg merged 14 commits into
BasedHardware:mainfrom
neooriginal:pre-hosted-mcp

Conversation

@neooriginal
Copy link
Copy Markdown
Collaborator

compatible with apps like poke.com and chatgpt web.
for apps that require this kind of format:
Bildschirmfoto 2025-12-08 um 12 27 10

This pull request introduces a new "Pre-hosted MCP" section in the developer settings page and adds backend support for a new mcp_sse router. The main goal is to make it easier for developers to connect to a pre-hosted MCP server without requiring Docker, by surfacing the relevant server URL and API key information in the UI, and enabling the backend endpoint.

Frontend Enhancements:

  • Added a "Pre-hosted MCP" section to the developer settings page (developer.dart), allowing users to easily copy the MCP server URL and see instructions for using their MCP API key.
  • Imported the Env class to retrieve the API base URL for the MCP server endpoint.

Backend Integration:

  • Registered the new mcp_sse router in the backend application, making the SSE endpoint available for client connections. [1] [2]

duplicate of #3652

@neooriginal neooriginal mentioned this pull request Dec 8, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a pre-hosted MCP server, which is a great feature for developers. The frontend changes in Dart look good, and the backend integration in Python is mostly solid. However, I've identified a few critical and high-severity issues in the new mcp_sse.py router that should be addressed before this can be safely deployed to production. The most critical issue is the use of in-memory session storage, which will not work correctly in a multi-worker environment. I've also found issues with incorrect JSON-RPC error handling, a security inconsistency in one of the new endpoints, and silent error handling. My review comments provide details and suggestions for fixing these.

Comment thread backend/routers/mcp_sse.py
Comment thread backend/routers/mcp_sse.py
Comment thread backend/routers/mcp_sse.py Outdated
Comment thread backend/routers/mcp_sse.py Outdated
@neooriginal
Copy link
Copy Markdown
Collaborator Author

This PR is ready to be merged. It was fully tested with

  • Poke (https://poke.com) - it could successfully interact with the MCP to tell me details about my memories aswell as tell me what OMI does.
  • ChatGPT (https://chatgpt.com) - same as above

@neooriginal neooriginal requested review from aaravgarg and beastoin and removed request for aaravgarg December 8, 2025 14:07
@neooriginal neooriginal changed the title pre-hosted MCP feat: hosted MCP server Dec 8, 2025
(issues caught by Gemini Code review)
@hugoaap-code
Copy link
Copy Markdown
Collaborator

we need this! used poke.com with limitless pendant mcp server, it was so cool and helpful!

@neooriginal
Copy link
Copy Markdown
Collaborator Author

we need this! used poke.com with limitless pendant mcp server, it was so cool and helpful!

For sure! Hope it will be merged soon

@aaravgarg
Copy link
Copy Markdown
Collaborator

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully introduces a hosted MCP server, adding a new UI section in the developer settings for configuration and a corresponding backend router. The frontend changes in Dart appear solid and provide a good user experience for developers. The backend implementation in mcp_sse.py is comprehensive but has a few critical and high-severity issues that need to be addressed. Specifically, the session management approach is not safe for production, and error handling for invalid client input and request parsing could be improved to be more robust and informative.

router = APIRouter()

# Store active sessions
active_sessions: dict = {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The use of a global dictionary active_sessions for session management is not safe for production environments. When running with multiple worker processes (e.g., using gunicorn), each worker will have its own in-memory copy of this dictionary. This will lead to session data being inconsistent across workers, causing requests to fail if they are routed to a worker that did not create the session. This is a critical issue that will break session handling under load.

To fix this, you should use a shared, persistent store for session management, such as Redis or Memcached. This will ensure that all worker processes share the same session state.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not necessary as there is no need for it to persist

Comment thread backend/routers/mcp_sse.py Outdated
Comment thread backend/routers/mcp_sse.py Outdated
Comment thread backend/routers/mcp_sse.py Outdated
neooriginal and others added 3 commits December 8, 2025 22:13
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@neooriginal
Copy link
Copy Markdown
Collaborator Author

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a hosted MCP server, adding a new UI section in the developer settings for configuration details and a new backend router (mcp_sse) to handle the server logic. The frontend changes look good, providing a clear way for developers to get the necessary connection information. The backend implementation, however, has a critical issue with its session management, which uses an in-memory dictionary that is not suitable for a multi-worker production environment. Additionally, there's an inconsistency in input validation that should be addressed.

Comment thread backend/routers/mcp_sse.py
Comment thread backend/routers/mcp_sse.py Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@aaravgarg aaravgarg requested review from mdmohsin7 and removed request for aaravgarg and beastoin December 9, 2025 09:56
@mdmohsin7
Copy link
Copy Markdown
Member

@neooriginal any demo video or something? Or any example mcp that I can use to test this?

@neooriginal
Copy link
Copy Markdown
Collaborator Author

@neooriginal any demo video or something? Or any example mcp that I can use to test this?

Can't, too much private data. You can use Chatgpt or poke or anything else

@aaravgarg
Copy link
Copy Markdown
Collaborator

what abt oauth in chatgpt, how do u handle that @neooriginal

@aaravgarg
Copy link
Copy Markdown
Collaborator

@neooriginal works with poke, pls tell how it works with chatgpt or attach a connection flow at least with chatgpt which wont reveal any data

once thats done, will merge

@neooriginal
Copy link
Copy Markdown
Collaborator Author

what abt oauth in chatgpt, how do u handle that @neooriginal

Just put any username like "Omi" and as oauth key the API key

@neooriginal
Copy link
Copy Markdown
Collaborator Author

Bildschirmfoto 2025-12-14 um 18 35 24 Bildschirmfoto 2025-12-14 um 18 35 59 Bildschirmfoto 2025-12-14 um 18 36 19

Server URL: https://api.omi.me/v1/mcp/sse
Authentication: OAuth 2.0 Client Credentials
Client ID: omi (or any value)
Client Secret: Your MCP API key (omi_mcp_...)

Hope this helps.

@aaravgarg
Copy link
Copy Markdown
Collaborator

aaravgarg commented Dec 15, 2025

Error fetching OAuth configuration
MCP server https://omi-backend.ngrok.app/v1/mcp/sse does not implement OAuth

error from chatgpt

pls try once urself, idts it works

@aaravgarg
Copy link
Copy Markdown
Collaborator

@neooriginal chatgpt calls these endpoints:

INFO: 52.255.111.27:0 - "POST /v1/mcp/sse HTTP/1.1" 401 Unauthorized
INFO: 52.255.111.19:0 - "GET /.well-known/oauth-protected-resource/v1/mcp/sse HTTP/1.1" 404 Not Found
INFO: 52.255.111.19:0 - "GET /.well-known/oauth-protected-resource HTTP/1.1" 404 Not Found
INFO: 52.255.111.18:0 - "GET /.well-known/oauth-authorization-server/v1/mcp/sse HTTP/1.1" 404 Not Found
INFO: 52.255.111.18:0 - "GET /v1/mcp/sse/.well-known/oauth-authorization-server HTTP/1.1" 404 Not Found
INFO: 52.255.111.18:0 - "GET /.well-known/oauth-authorization-server HTTP/1.1" 404 Not Found
INFO: 52.255.111.18:0 - "GET /.well-known/openid-configuration/v1/mcp/sse HTTP/1.1" 404 Not Found
INFO: 52.255.111.18:0 - "GET /v1/mcp/sse/.well-known/openid-configuration HTTP/1.1" 404 Not Found
INFO: 52.255.111.18:0 - "GET /.well-known/openid-configuration HTTP/1.1" 404 Not Found
INFO: 63.124.68.69:0 - "GET /v1/mcp/sse HTTP/1.1" 401 Unauthorized
INFO: 63.124.68.69:0 - "GET /favicon.ico HTTP/1.1" 404 Not Found

@neooriginal
Copy link
Copy Markdown
Collaborator Author

That's weird, I did try it myself. Probably made a simple change that broke oauth.
Will fix later, sorry

@aaravgarg aaravgarg merged commit c3d5c1f into BasedHardware:main Dec 15, 2025
@neooriginal neooriginal deleted the pre-hosted-mcp branch December 15, 2025 16:16
Glucksberg pushed a commit to Glucksberg/omi-local that referenced this pull request Apr 28, 2026
compatible with apps like poke.com and chatgpt web.
for apps that require this kind of format:
<img width="494" height="563" alt="Bildschirmfoto 2025-12-08 um 12 27
10"
src="https://github.com/user-attachments/assets/30575fc4-96df-42b1-9b14-cef09d353469"
/>


This pull request introduces a new "Pre-hosted MCP" section in the
developer settings page and adds backend support for a new `mcp_sse`
router. The main goal is to make it easier for developers to connect to
a pre-hosted MCP server without requiring Docker, by surfacing the
relevant server URL and API key information in the UI, and enabling the
backend endpoint.

**Frontend Enhancements:**

* Added a "Pre-hosted MCP" section to the developer settings page
(`developer.dart`), allowing users to easily copy the MCP server URL and
see instructions for using their MCP API key.
* Imported the `Env` class to retrieve the API base URL for the MCP
server endpoint.

**Backend Integration:**

* Registered the new `mcp_sse` router in the backend application, making
the SSE endpoint available for client connections.
[[1]](diffhunk://#diff-df5184bf1f67239fcedd4578cd15b7c94f3f765feabd09c5f20b5831bca33903R27)
[[2]](diffhunk://#diff-df5184bf1f67239fcedd4578cd15b7c94f3f765feabd09c5f20b5831bca33903R81)

duplicate of BasedHardware#3652
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants