Skip to content

Commit 35bed66

Browse files
cliffhallclaude
andcommitted
feat(everything): light and dark themed icons on every primitive
Attach a light/dark icon pair (SEP-973) to the server info and to every tool, prompt, resource and resource template, one pair per kind, defined once in server/icons.ts as inline SVG data: URIs. Both eras see them: initialize and server/discover, and each list. Closes #3131 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 446be48 commit 35bed66

40 files changed

Lines changed: 319 additions & 8 deletions

‎.changeset/everything-icons.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-everything": minor
3+
---
4+
5+
Add light- and dark-themed icons (SEP-973) to the server info and to every tool, prompt, resource and resource template, in both protocol eras.

‎src/everything/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ This MCP server attempts to exercise all the features of the MCP protocol. It is
1313

1414
A complete list of the registered MCP primitives and other protocol features demonstrated can be found in the [Server Features](docs/features.md) document.
1515

16+
The server info and every tool, prompt, resource and resource template carry a pair of [icons](docs/features.md#icons), one for a light theme and one for a dark theme, so a client can show the variant that suits its own background.
17+
1618
The `get-env` tool returns the server's environment variables, but masks the value of any credential-like name (a `KEY`, `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL`, `AUTH` or `COOKIE` segment, such as `OPENAI_API_KEY`) as `"<redacted>"`. To see every value unmasked while debugging, start the server with `GET_ENV_INCLUDE_SECRETS=1` (or `true`). Leave it unset otherwise: with it set, every credential in the server's environment reaches the model's context.
1719

1820
## Protocol versions

‎src/everything/__tests__/harness.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,18 @@ export async function connectRaw(capabilities: Json): Promise<RawSession> {
269269
},
270270
};
271271
}
272+
273+
/**
274+
* A list's entries without their `icons`, for a snapshot of the rest. The
275+
* icons are long `data:` URIs, one pair per primitive kind, and icons.test.ts
276+
* asserts on them for every list in both eras.
277+
*/
278+
export function withoutIcons<T extends { icons?: unknown }>(
279+
entries: T[],
280+
): Omit<T, "icons">[] {
281+
return entries.map((entry) => {
282+
const rest: Omit<T, "icons"> & { icons?: unknown } = { ...entry };
283+
delete rest.icons;
284+
return rest;
285+
});
286+
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
/**
2+
* Icons with light and dark themes (SEP-973, #3131), as each era's client
3+
* sees them.
4+
*
5+
* The server attaches one light/dark icon pair per primitive kind
6+
* (server/icons.ts). These tests read what crosses the wire, in both
7+
* protocol eras: `serverInfo` from `initialize` (2025-era) or
8+
* `server/discover` (2026-07-28), and every entry of `tools/list`,
9+
* `prompts/list`, `resources/list` and `resources/templates/list`. Each
10+
* must carry a "light" and a "dark" icon, and each icon must be a scalable
11+
* SVG `data:` URI that decodes to an SVG document.
12+
*/
13+
import { afterEach, describe, expect, it } from "vitest";
14+
import type { Icon } from "@modelcontextprotocol/client";
15+
import {
16+
ALL_CAPABILITIES,
17+
connect,
18+
connectModern,
19+
connectRaw,
20+
MODERN_CAPABILITIES,
21+
type RawSession,
22+
type Session,
23+
} from "./harness.js";
24+
import {
25+
PROMPT_ICONS,
26+
RESOURCE_ICONS,
27+
RESOURCE_TEMPLATE_ICONS,
28+
SERVER_ICONS,
29+
TOOL_ICONS,
30+
} from "../server/icons.js";
31+
32+
let session: Session | undefined;
33+
let raw: RawSession | undefined;
34+
35+
afterEach(async () => {
36+
await session?.close();
37+
await raw?.close();
38+
session = undefined;
39+
raw = undefined;
40+
});
41+
42+
const SVG_DATA_URI = "data:image/svg+xml;base64,";
43+
44+
/** Assert that `icons` is a themed pair of decodable SVG icons. */
45+
function expectThemedPair(icons: Icon[] | undefined): void {
46+
expect(icons).toBeDefined();
47+
const themes = (icons ?? []).map((icon) => icon.theme).sort();
48+
expect(themes).toEqual(["dark", "light"]);
49+
for (const icon of icons ?? []) {
50+
expect(icon.mimeType).toBe("image/svg+xml");
51+
expect(icon.sizes).toEqual(["any"]);
52+
expect(icon.src.startsWith(SVG_DATA_URI)).toBe(true);
53+
const svg = Buffer.from(
54+
icon.src.slice(SVG_DATA_URI.length),
55+
"base64",
56+
).toString("utf8");
57+
expect(svg).toMatch(/^<svg xmlns="http:\/\/www\.w3\.org\/2000\/svg"/);
58+
expect(svg).toMatch(/<\/svg>$/);
59+
}
60+
// The two variants are drawn differently, not one image labelled twice.
61+
expect(icons?.[0]?.src).not.toBe(icons?.[1]?.src);
62+
}
63+
64+
describe("the icon sets", () => {
65+
it("gives every primitive kind its own light/dark pair", () => {
66+
const sets = [
67+
SERVER_ICONS,
68+
TOOL_ICONS,
69+
PROMPT_ICONS,
70+
RESOURCE_ICONS,
71+
RESOURCE_TEMPLATE_ICONS,
72+
];
73+
for (const set of sets) expectThemedPair(set);
74+
const lightSources = new Set(
75+
sets.map((set) => set.find((icon) => icon.theme === "light")?.src),
76+
);
77+
expect(lightSources.size).toBe(sets.length);
78+
});
79+
});
80+
81+
describe.each([
82+
{
83+
era: "2025-era",
84+
open: () => connect({ capabilities: ALL_CAPABILITIES }),
85+
},
86+
{
87+
era: "2026-07-28",
88+
open: () => connectModern({ capabilities: MODERN_CAPABILITIES }),
89+
},
90+
])("icons on the $era surface", ({ open }) => {
91+
it("puts the server's pair on serverInfo", async () => {
92+
session = await open();
93+
const info = session.client.getServerVersion();
94+
expect(info?.icons).toEqual(SERVER_ICONS);
95+
expectThemedPair(info?.icons);
96+
});
97+
98+
it("puts the tool pair on every tool", async () => {
99+
session = await open();
100+
const { tools } = await session.client.listTools();
101+
expect(tools.length).toBeGreaterThan(0);
102+
for (const tool of tools) expect(tool.icons).toEqual(TOOL_ICONS);
103+
});
104+
105+
it("puts the prompt pair on every prompt", async () => {
106+
session = await open();
107+
const { prompts } = await session.client.listPrompts();
108+
expect(prompts.length).toBeGreaterThan(0);
109+
for (const prompt of prompts) expect(prompt.icons).toEqual(PROMPT_ICONS);
110+
});
111+
112+
it("puts the resource pair on every listed resource", async () => {
113+
session = await open();
114+
const { resources } = await session.client.listResources();
115+
expect(resources.length).toBeGreaterThan(0);
116+
for (const resource of resources) {
117+
expect(resource.icons).toEqual(RESOURCE_ICONS);
118+
}
119+
});
120+
121+
it("puts the template pair on every resource template", async () => {
122+
session = await open();
123+
const { resourceTemplates } = await session.client.listResourceTemplates();
124+
expect(resourceTemplates.length).toBeGreaterThan(0);
125+
for (const template of resourceTemplates) {
126+
expect(template.icons).toEqual(RESOURCE_TEMPLATE_ICONS);
127+
}
128+
});
129+
});
130+
131+
describe("icons on the raw 2026-07-28 wire", () => {
132+
it("carries the server's pair in server/discover's serverInfo", async () => {
133+
raw = await connectRaw({});
134+
const discover = await raw.result("server/discover");
135+
expect(discover).toMatchObject({
136+
_meta: {
137+
"io.modelcontextprotocol/serverInfo": { icons: SERVER_ICONS },
138+
},
139+
});
140+
});
141+
});

‎src/everything/__tests__/surface.test.ts‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
connect,
1414
ofMethod,
1515
type Session,
16+
withoutIcons,
1617
} from "./harness.js";
1718

1819
let session: Session | undefined;
@@ -754,13 +755,12 @@ describe("prompts/list", () => {
754755
it("lists the four prompts with their arguments", async () => {
755756
session = await connect();
756757
const { prompts } = await session.client.listPrompts();
757-
expect(prompts).toMatchInlineSnapshot(`
758+
expect(withoutIcons(prompts)).toMatchInlineSnapshot(`
758759
[
759760
{
760761
"_meta": undefined,
761762
"arguments": undefined,
762763
"description": "A prompt with no arguments",
763-
"icons": undefined,
764764
"name": "simple-prompt",
765765
"title": "Simple Prompt",
766766
},
@@ -779,7 +779,6 @@ describe("prompts/list", () => {
779779
},
780780
],
781781
"description": "A prompt with two arguments, one required and one optional",
782-
"icons": undefined,
783782
"name": "args-prompt",
784783
"title": "Arguments Prompt",
785784
},
@@ -798,7 +797,6 @@ describe("prompts/list", () => {
798797
},
799798
],
800799
"description": "First argument choice narrows values for second argument.",
801-
"icons": undefined,
802800
"name": "completable-prompt",
803801
"title": "Team Management",
804802
},
@@ -817,7 +815,6 @@ describe("prompts/list", () => {
817815
},
818816
],
819817
"description": "A prompt that includes an embedded resource reference",
820-
"icons": undefined,
821818
"name": "resource-prompt",
822819
"title": "Resource Prompt",
823820
},
@@ -830,7 +827,7 @@ describe("resources/list and resources/templates/list", () => {
830827
it("lists one static resource per file in docs/", async () => {
831828
session = await connect();
832829
const { resources } = await session.client.listResources();
833-
expect(resources).toMatchInlineSnapshot(`
830+
expect(withoutIcons(resources)).toMatchInlineSnapshot(`
834831
[
835832
{
836833
"description": "Static document file exposed from /docs: architecture.md",
@@ -881,7 +878,7 @@ describe("resources/list and resources/templates/list", () => {
881878
it("lists the dynamic text and blob templates", async () => {
882879
session = await connect();
883880
const { resourceTemplates } = await session.client.listResourceTemplates();
884-
expect(resourceTemplates).toMatchInlineSnapshot(`
881+
expect(withoutIcons(resourceTemplates)).toMatchInlineSnapshot(`
885882
[
886883
{
887884
"description": "Plaintext dynamic resource fabricated from the {resourceId} variable, which must be an integer.",

‎src/everything/docs/features.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ A read of a resource that does not exist (an unknown URI, a template id that is
7979
- **2025-era**: clients subscribe and unsubscribe to resource URIs with `resources/subscribe` and `resources/unsubscribe`. `toggle-subscriber-updates` starts or stops a per-connection interval that emits `notifications/resources/updated { uri }` for the URIs that connection subscribed to, and `trigger-resource-update` sends one on demand. List changes arrive unsolicited.
8080
- Each client's subscriptions belong to the server instance serving its connection, so concurrent clients are independent.
8181

82+
## Icons
83+
84+
**Both.** The server demonstrates icons with light and dark themes (SEP-973). Its `serverInfo` (in `initialize` and in `server/discover`) and every entry of `tools/list`, `prompts/list`, `resources/list` and `resources/templates/list` carry an `icons` array of two scalable SVG icons, one with `theme: "light"` (drawn for a light background) and one with `theme: "dark"`. Each kind has its own glyph: a server rack, a wrench for tools, a speech bubble for prompts, a document for resources, and a document with braces for templates. The icons are inline `data:` URIs, so a client fetches nothing; they are defined in `server/icons.ts`.
85+
8286
## Logging
8387

8488
Logging is deprecated as of 2026-07-28 (SEP-2577) and remains available on both eras.

‎src/everything/docs/structure.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ src/everything
3636
├── server
3737
│ ├── index.ts
3838
│ ├── context.ts
39+
│ ├── icons.ts
3940
│ ├── logging.ts
4041
│ ├── roots.ts
4142
│ └── tasks.ts
@@ -152,6 +153,8 @@ src/everything
152153
- Exposes `{ server, cleanup }` to the chosen transport. Cleanup stops any running intervals in the server when the connection ends.
153154
- `context.ts`
154155
- The per-instance context features receive: the era, the change publisher, the 2025-era subscriptions and a cleanup registry.
156+
- `icons.ts`
157+
- The light- and dark-themed icon pairs (SEP-973) attached to the server info and to every tool, prompt, resource and resource template, one pair per kind, as inline SVG `data:` URIs.
155158
- `logging.ts`
156159
- Implements simulated logging (2025 era). Periodically sends randomized log messages at various levels to the connected client. Started/stopped on demand via a dedicated tool.
157160
- `roots.ts`

‎src/everything/prompts/args.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { z } from "zod";
22
import { McpServer } from "@modelcontextprotocol/server";
3+
import { PROMPT_ICONS } from "../server/icons.js";
34

45
/**
56
* Register a prompt with arguments
@@ -20,6 +21,7 @@ export const registerArgumentsPrompt = (server: McpServer) => {
2021
"args-prompt",
2122
{
2223
title: "Arguments Prompt",
24+
icons: PROMPT_ICONS,
2325
description: "A prompt with two arguments, one required and one optional",
2426
argsSchema: promptArgsSchema,
2527
},

‎src/everything/prompts/completions.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { z } from "zod";
22
import { McpServer, completable } from "@modelcontextprotocol/server";
3+
import { PROMPT_ICONS } from "../server/icons.js";
34

45
/**
56
* Register a prompt with completable arguments
@@ -45,6 +46,7 @@ export const registerPromptWithCompletions = (server: McpServer) => {
4546
"completable-prompt",
4647
{
4748
title: "Team Management",
49+
icons: PROMPT_ICONS,
4850
description: "First argument choice narrows values for second argument.",
4951
argsSchema: promptArgsSchema,
5052
},

‎src/everything/prompts/resource.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
RESOURCE_TYPE_TEXT,
1414
RESOURCE_TYPES,
1515
} from "../resources/templates.js";
16+
import { PROMPT_ICONS } from "../server/icons.js";
1617

1718
/**
1819
* Register a prompt with an embedded resource reference
@@ -33,6 +34,7 @@ export const registerEmbeddedResourcePrompt = (server: McpServer) => {
3334
"resource-prompt",
3435
{
3536
title: "Resource Prompt",
37+
icons: PROMPT_ICONS,
3638
description: "A prompt that includes an embedded resource reference",
3739
argsSchema: promptArgsSchema,
3840
},

0 commit comments

Comments
 (0)