Skip to content

Commit dd647d7

Browse files
authored
feat(landing): markdown negotiation, API catalog, WebMCP (anomalyco#1492)
Adds three agent-readiness features on openworklabs.com: - Markdown content negotiation: middleware serves hand-authored markdown twins for /, /pricing, /enterprise, /den, /download, and /trust when Accept: text/markdown outranks text/html. Sets Content-Type: text/markdown; charset=utf-8, Vary: Accept, and an X-Markdown-Tokens estimate. Browsers still get HTML by default. - API catalog (RFC 9727): /.well-known/api-catalog returns an application/linkset+json document pointing at api.openworklabs.com's openapi.json, /docs/api-reference, /health, and llms.txt. Advertised from the home page via the Link header. - WebMCP: a client component calls navigator.modelContext.provideContext on mount with four tools — navigate_to, open_enterprise_contact, get_pricing_summary, and get_download_links. Submit-style mutations are intentionally excluded; agents navigate users to forms instead of posting on their behalf.
1 parent bd54614 commit dd647d7

7 files changed

Lines changed: 486 additions & 2 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
export const dynamic = "force-static"
2+
3+
const linkset = {
4+
linkset: [
5+
{
6+
anchor: "https://api.openworklabs.com",
7+
"service-desc": [
8+
{
9+
href: "https://api.openworklabs.com/openapi.json",
10+
type: "application/vnd.oai.openapi+json;version=3.1",
11+
title: "OpenWork Den API — OpenAPI 3.1 document",
12+
},
13+
],
14+
"service-doc": [
15+
{
16+
href: "https://openworklabs.com/docs/api-reference",
17+
type: "text/html",
18+
title: "OpenWork Den API — human documentation",
19+
},
20+
],
21+
status: [
22+
{
23+
href: "https://api.openworklabs.com/health",
24+
type: "application/json",
25+
title: "OpenWork Den API — health endpoint",
26+
},
27+
],
28+
"service-meta": [
29+
{
30+
href: "https://openworklabs.com/llms.txt",
31+
type: "text/plain",
32+
title: "OpenWork llms.txt — agent-facing site guide",
33+
},
34+
],
35+
},
36+
],
37+
}
38+
39+
export function GET() {
40+
return new Response(JSON.stringify(linkset, null, 2), {
41+
status: 200,
42+
headers: {
43+
"Content-Type": "application/linkset+json",
44+
"Cache-Control": "public, max-age=3600",
45+
"Access-Control-Allow-Origin": "*",
46+
},
47+
})
48+
}

‎ee/apps/landing/app/layout.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import "./globals.css";
22
import { Inter, JetBrains_Mono } from "next/font/google";
33
import Script from "next/script";
44
import { BotIdClient } from "botid/client";
5+
import { WebMcpProvider } from "../components/webmcp-provider";
56

67
const inter = Inter({
78
subsets: ["latin"],
@@ -60,6 +61,7 @@ export default function RootLayout({
6061
/>
6162
</head>
6263
<body className="overflow-x-hidden antialiased">
64+
<WebMcpProvider />
6365
{children}
6466
</body>
6567
</html>
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
"use client"
2+
3+
import { useEffect } from "react"
4+
5+
type ModelContext = {
6+
provideContext: (context: { tools: Tool[] }) => void | Promise<void>
7+
}
8+
9+
type Tool = {
10+
name: string
11+
description: string
12+
inputSchema: Record<string, unknown>
13+
execute: (args: Record<string, unknown>) => unknown | Promise<unknown>
14+
}
15+
16+
const destinations: Record<string, string> = {
17+
home: "/",
18+
download: "/download",
19+
pricing: "/pricing",
20+
enterprise: "/enterprise",
21+
den: "/den",
22+
docs: "/docs",
23+
trust: "/trust",
24+
feedback: "/feedback",
25+
}
26+
27+
const pricingSummary = {
28+
plans: [
29+
{
30+
id: "solo",
31+
name: "Solo",
32+
price: "$0",
33+
cadence: "free forever",
34+
highlights: [
35+
"Open-source desktop app",
36+
"macOS, Windows, Linux downloads",
37+
"Bring your own provider keys",
38+
],
39+
cta: { label: "Download", href: "/download" },
40+
},
41+
{
42+
id: "team-starter",
43+
name: "Team Starter",
44+
price: "$50",
45+
cadence: "per month",
46+
highlights: [
47+
"5 seats included",
48+
"API access",
49+
"Skill Hub Manager",
50+
"Bring your own LLM keys, distributed to your team",
51+
],
52+
cta: { label: "Start team plan", href: "https://app.openworklabs.com/checkout" },
53+
},
54+
{
55+
id: "enterprise",
56+
name: "Enterprise",
57+
price: "custom",
58+
cadence: "contact us",
59+
highlights: [
60+
"Enterprise rollout support",
61+
"Deployment guidance",
62+
"Custom commercial terms",
63+
],
64+
cta: { label: "Talk to us", href: "/enterprise#book" },
65+
},
66+
],
67+
notes: "Prices exclude taxes.",
68+
}
69+
70+
const downloadLinks = {
71+
page: "https://openworklabs.com/download",
72+
githubReleases: "https://github.com/different-ai/openwork/releases/latest",
73+
platforms: {
74+
macos: {
75+
page: "https://openworklabs.com/download#macos",
76+
note: "Apple Silicon (.dmg) and Intel (.dmg) builds resolved from the latest GitHub release.",
77+
},
78+
windows: {
79+
page: "https://openworklabs.com/download#windows",
80+
note: "x64 MSI installer resolved from the latest GitHub release.",
81+
},
82+
linux: {
83+
page: "https://openworklabs.com/download#linux",
84+
aur: "yay -S openwork",
85+
note: "AUR plus .deb and .rpm packages for x64 and arm64.",
86+
},
87+
},
88+
}
89+
90+
const tools: Tool[] = [
91+
{
92+
name: "navigate_to",
93+
description:
94+
"Navigate the current tab to a key section of openworklabs.com. Use this when the user expresses intent to view pricing, download, enterprise, den (cloud), docs, trust, or feedback.",
95+
inputSchema: {
96+
type: "object",
97+
properties: {
98+
destination: {
99+
type: "string",
100+
enum: Object.keys(destinations),
101+
description: "The named section to navigate to.",
102+
},
103+
},
104+
required: ["destination"],
105+
additionalProperties: false,
106+
},
107+
execute: async (args) => {
108+
const key = String(args.destination ?? "")
109+
const href = destinations[key]
110+
if (!href) {
111+
return { ok: false, error: `unknown destination: ${key}` }
112+
}
113+
if (typeof window !== "undefined") {
114+
window.location.assign(href)
115+
}
116+
return { ok: true, href }
117+
},
118+
},
119+
{
120+
name: "open_enterprise_contact",
121+
description:
122+
"Navigate to the Enterprise page and scroll to the book-a-call section. Use this when the user wants to talk to sales or needs SSO, audit, or procurement support.",
123+
inputSchema: {
124+
type: "object",
125+
properties: {},
126+
additionalProperties: false,
127+
},
128+
execute: async () => {
129+
if (typeof window !== "undefined") {
130+
window.location.assign("/enterprise#book")
131+
}
132+
return { ok: true, href: "/enterprise#book" }
133+
},
134+
},
135+
{
136+
name: "get_pricing_summary",
137+
description:
138+
"Return OpenWork's pricing tiers, what each includes, and the CTA destination. Read-only; does not navigate.",
139+
inputSchema: {
140+
type: "object",
141+
properties: {},
142+
additionalProperties: false,
143+
},
144+
execute: async () => pricingSummary,
145+
},
146+
{
147+
name: "get_download_links",
148+
description:
149+
"Return the canonical download page URLs per platform plus the GitHub releases URL. Use this to tell the user where to get the desktop app. Read-only; does not navigate.",
150+
inputSchema: {
151+
type: "object",
152+
properties: {},
153+
additionalProperties: false,
154+
},
155+
execute: async () => downloadLinks,
156+
},
157+
]
158+
159+
export function WebMcpProvider() {
160+
useEffect(() => {
161+
const nav = typeof navigator === "undefined" ? null : (navigator as Navigator & { modelContext?: ModelContext })
162+
const modelContext = nav?.modelContext
163+
if (!modelContext || typeof modelContext.provideContext !== "function") return
164+
165+
try {
166+
const result = modelContext.provideContext({ tools })
167+
if (result && typeof (result as Promise<unknown>).catch === "function") {
168+
;(result as Promise<unknown>).catch(() => {})
169+
}
170+
} catch {
171+
// Silently ignore: WebMCP is best-effort.
172+
}
173+
}, [])
174+
175+
return null
176+
}

0 commit comments

Comments
 (0)