nimblebrain-synapse (Python)
The server half of the Synapse cross-host UI framework. Pairs with the
@nimblebrain/synapse client (connectUI / window.SynapseUI).
pip install nimblebrain-synapse # or: uv add nimblebrain-synapse
One SynapseUI declaration wires a self-contained HTML component into every host
bridge a Synapse app renders in — ChatGPT (OpenAI Apps SDK), Claude (MCP
Apps), and the NimbleBrain runtime — replacing the per-app hand-rolled shim.
It is an MCP extension (SEP-2133): hand the instance to MCPServer and it
contributes its resources and its result binding.
from mcp.server.mcpserver import MCPServer
from nimblebrain_synapse import SynapseUI
report_ui = SynapseUI(
uri="ui://bassethound/report",
template=load_template(), # data-free HTML (carries the SDK + data markers)
preferred_size=("100%", "auto"),
)
report_ui.bind("analyze_domain", should_render=lambda d: "domain" in d)
mcp = MCPServer("bassethound", extensions=[report_ui])
@mcp.tool(meta=report_ui.tool_meta(invoking="Picking up the scent…", invoked="Dossier ready"))
async def analyze_domain(domain: str) -> Dossier:
...
Passing the instance in extensions= serves the host-facing ui:// resources
(data-free) and installs the tools/call interceptor. tool_meta on the tool
descriptor carries the binding pointers (openai/outputTemplate for ChatGPT,
ui.resourceUri for SEP-1865 hosts). bind names a tool whose result carries the
binding: by default the interceptor mirrors the ChatGPT openai/outputTemplate
pointer into the result _meta, so a standard host renders the contributed
component from structuredContent with no UI HTML in the result content. Pass
embed_resource=True to also bake the legacy mcp-ui embedded copy (dossier in a
<script>) into the content — off by default so that audience: ["user"] HTML
can't leak into a client that won't render it. Plain MCP clients ignore the _meta
and still read structuredContent.
bind may be called before or after the server is constructed; the resources are
built at construction, so a SynapseUI is fully formed before MCPServer reads it.
Template contract
The template is data-free HTML that carries two markers:
<!--__SYNAPSE_SDK__-->— replaced with the inlined client SDK<script>.<script type="application/json" id="synapse-ui-data">/*__SYNAPSE_DATA__*/</script>— the data slot;render_html(data)substitutes the escaped payload here (the served copy leaves the marker, so the client readsnulland falls back to the host's push).
SynapseUI._safe_json escapes the payload for <script> embedding (the XSS
defense) — framework-owned and on by default.
Relationship to the SDK's own MCP Apps extension
SynapseUI advertises the spec's MCP Apps identifier, io.modelcontextprotocol/ui
— that is the extension it implements, and the ChatGPT dialect rides alongside in
_meta keys the spec does not claim. So a server uses SynapseUI instead of
mcp.server.apps.Apps, not next to it: two extensions cannot share an identifier,
and Apps serves only text/html;profile=mcp-app, so it cannot carry the
skybridge resource that makes the component render in ChatGPT.
One consequence: one SynapseUI per server. A second instance fails at server
construction with Extension 'io.modelcontextprotocol/ui' is already registered.
Client SDK asset
nimblebrain_synapse/_assets/synapse-ui.iife.js is the vendored client IIFE
(window.SynapseUI), regenerated from the JS build
(dist/synapse-ui.iife.global.js) and inlined at register time so a component
is fully self-contained (CSP-safe, no CDN). CI fails on drift from the build.
nimblebrain_synapse.__client_version__ records which @nimblebrain/synapse release the
bundled IIFE was built from.
Versioning & compatibility
nimblebrain-synapse (PyPI) versions independently of @nimblebrain/synapse (npm).
They change for different reasons at different cadences — the server descriptor is
thin and stable; the JS client evolves with host adapters and theming — so they do
not share a version number. The exact client build a given release bundles is
recorded in nimblebrain_synapse.__client_version__ (and, per release, in the
CHANGELOG);
CI keeps it equal to the sibling package.json at HEAD.
What both halves share is the wire protocol — the ui:// resource MIMEs, the
_meta dialects, and the data-element contract:
- ext-apps
2026-01-26 - MCP Apps (SEP-1865)
- OpenAI Apps SDK
MCP SDK compatibility
This package requires mcp 2.x (mcp>=2.0.0,<3) and does not run on 1.x. It is
built on two things that exist only in 2.x: the SEP-2133 extension interface
(mcp.server.extension.Extension), and mcp.server.apps for the MCP Apps
identifier and MIME. On 1.x the equivalent of intercept_tool_call did not exist,
and this package reached into FastMCP's private handler registry to get one — so
there is no shape that serves both majors, and the range is a single major rather
than a span.
The upper bound is deliberate. mcp 2.0 reached fresh installs of this package
through an uncapped >= floor and broke them, which is what the cap prevents from
happening again at 3.0.
Releases publish on a nimblebrain-synapse-v* tag (distinct from the npm v* tags).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nimblebrain_synapse-0.6.0.tar.gz.
File metadata
- Download URL: nimblebrain_synapse-0.6.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
496c2c6d9393d90dfc9609e0a52c7e68bc0dddf2c3d95bf1be98000ab75934ad
|
|
| MD5 |
345ea85e716cdbf8f02b5528a901b1b9
|
|
| BLAKE2b-256 |
49ba846e19845dcf18fefdf76740306bca02620ffe6fa9a4feb425b99b2930a4
|
Provenance
The following attestation bundles were made for nimblebrain_synapse-0.6.0.tar.gz:
Publisher:
publish-python.yml on NimbleBrainInc/synapse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nimblebrain_synapse-0.6.0.tar.gz -
Subject digest:
496c2c6d9393d90dfc9609e0a52c7e68bc0dddf2c3d95bf1be98000ab75934ad - Sigstore transparency entry: 2762468529
- Sigstore integration time:
-
Permalink:
NimbleBrainInc/synapse@24ff3f0251dbd9e9d1d5fa8f189b30dd967b13dc -
Branch / Tag:
refs/tags/nimblebrain-synapse-v0.6.0 - Owner: https://github.com/NimbleBrainInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@24ff3f0251dbd9e9d1d5fa8f189b30dd967b13dc -
Trigger Event:
push
-
Statement type:
File details
Details for the file nimblebrain_synapse-0.6.0-py3-none-any.whl.
File metadata
- Download URL: nimblebrain_synapse-0.6.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c4f098c6f73bb86ea9067e660976b505c8eef534a165f0fcf1f28808edb7883
|
|
| MD5 |
d06a2742a8bde26317b46073b0e3b5c4
|
|
| BLAKE2b-256 |
58efb9a1f26c6cfbebea22bf69db67747c14e6f9b27b101dbf8f59f5539b2d4a
|
Provenance
The following attestation bundles were made for nimblebrain_synapse-0.6.0-py3-none-any.whl:
Publisher:
publish-python.yml on NimbleBrainInc/synapse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nimblebrain_synapse-0.6.0-py3-none-any.whl -
Subject digest:
1c4f098c6f73bb86ea9067e660976b505c8eef534a165f0fcf1f28808edb7883 - Sigstore transparency entry: 2762468548
- Sigstore integration time:
-
Permalink:
NimbleBrainInc/synapse@24ff3f0251dbd9e9d1d5fa8f189b30dd967b13dc -
Branch / Tag:
refs/tags/nimblebrain-synapse-v0.6.0 - Owner: https://github.com/NimbleBrainInc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@24ff3f0251dbd9e9d1d5fa8f189b30dd967b13dc -
Trigger Event:
push
-
Statement type: