feat(app): the Connect page's Claude desktop app row writes a one-click extension (P15 C1)

Claude's desktop extension format is the MCP Bundle: a .mcpb zip with a
manifest.json (manifest 0.3, github.com/anthropics/mcpb). The row's
button makes the company's agent key if there is none and writes
Documents/Wanderbooks/Extensions/wanderbooks-<id>.mcpb: a manifest whose
server is a binary running this program's own stable path as
mcp --book <id>, the 512 px icon and a short README as the entry point.
The package carries no program (the one executable is the installed
one), no key and no path of the data root. The page then says in plain
words where in Claude to pick the file and to keep Wanderbooks open, and
offers to show the file. The manifest is checked against Anthropic's
published schema (a test fixture) and its required fields. The blessed
Connect page pictures change by exactly the new row. The program's
version is now one value set by main for every platform, not only Unix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 15:31:21 -07:00
1 parent 479d3a5c5e
commit 2bc442f795
15 files changed
+1039 -21

No files matched your search

+81
View File
@@ -424,6 +424,9 @@ pub struct State {
new_address_asked: bool,
/// The address was just copied (the time, for the word "Copied").
copied_at: Option<f64>,
/// The folder the Claude desktop extension was written in, once it
/// was (set by the job that made it).
extension_folder: Arc<std::sync::Mutex<Option<String>>>,
}
/// The two lines an assistant set up by hand needs.
@@ -807,6 +810,7 @@ impl State {
want = Some(w);
}
}
self.desktop_row(ui, status, book, &owner, busy, &mut want);
another_row(ui, status, book, &owner, &commands, busy, &mut want);
if let Some((what, keep, work)) = want {
self.start(ui, jobs, what, &keep, work);
@@ -842,6 +846,83 @@ impl State {
});
}
/// The "Claude desktop app" row (WB-pkg-5): one button that writes the
/// one-click extension, and the steps that follow, in plain words.
fn desktop_row(
&mut self,
ui: &mut Ui,
status: &Status,
book: &str,
owner: &Option<Arc<dyn Owner>>,
busy: bool,
want: &mut Want,
) {
let p = pal(ui.ctx());
let made = self
.extension_folder
.lock()
.map(|f| f.clone())
.unwrap_or_default();
Frame::new()
.fill(p.surface)
.stroke(Stroke::new(1.0, p.border))
.corner_radius(CornerRadius::same(8))
.inner_margin(Margin::symmetric(12, 10))
.show(ui, |ui| {
ui.set_width(ui.available_width());
ui.horizontal(|ui| {
ui.label(RichText::new("Claude desktop app").font(theme::semibold(14.5)));
ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
if let Some(owner) = owner
&& ui
.add_enabled(!busy, egui::Button::new("Make the Claude extension"))
.on_hover_text(
"Writes one file you open in the Claude desktop app to add these books",
)
.clicked()
{
let (o, b, company) =
(owner.clone(), book.to_string(), status.company.clone());
let folder = self.extension_folder.clone();
*want = Some((
"Claude desktop extension".to_string(),
"Making the Claude desktop extension".to_string(),
Box::new(move || {
o.claude_desktop_extension(&b, &company).map(|made| {
if let Ok(mut f) = folder.lock() {
*f = Some(made.folder.clone());
}
format!(
"made {}. Next: open the Claude desktop app, go to Settings, then Extensions, then Advanced settings, choose Install Extension, and pick that file (or just open the file). Keep Wanderbooks open while you use Claude.",
made.file
)
})
}),
));
}
});
});
ui.add_space(4.0);
ui.label(
RichText::new(
"Adds these books to the Claude app on this computer with one file, so you type nothing.",
)
.font(theme::regular(13.0))
.color(p.muted),
);
if let Some(folder) = made {
ui.add_space(4.0);
if ui
.button(format!("{} Show the file", icon::FOLDER_OPEN))
.clicked()
{
crate::export::open(std::path::Path::new(&folder));
}
}
});
ui.add_space(6.0);
}
/// "Connections": every key to these books, who is connected on it,
/// what it may do, when it last did anything, and Revoke.
fn connections(
+19
View File
@@ -412,6 +412,16 @@ pub trait Owner: Send + Sync {
fn command_line(&self, _words: &[&str]) -> Result<String, String> {
Err("not here".into())
}
/// The Claude desktop extension for the company `book` (shown as
/// `company`): the one-click package written where a person can open it,
/// the key made first if there was none. Blocks.
fn claude_desktop_extension(
&self,
_book: &str,
_company: &str,
) -> Result<ExtensionMade, String> {
Err("not here".into())
}
/// The key an assistant needs to reach the company `book` exists (made
/// now if it did not), able to read, draft and post but not to see the
/// access record: `Ok(true)` when it was made now. It never replaces a
@@ -476,6 +486,15 @@ pub trait Owner: Send + Sync {
}
}
/// The Claude desktop extension the Connect page made (WB-pkg-5).
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct ExtensionMade {
/// The package file, in full.
pub file: String,
/// The folder it is in.
pub folder: String,
}
/// The owner the program gave the viewer, for every company's view that
/// isn't given one of its own. It is the program's (one per process, as
/// the program is one), not a company's: each view takes a handle to it