Skip to content

Commit b4d9aa0

Browse files
authored
fix: ship one hosted mcp server in every plugin (#264)
1 parent cecbcc6 commit b4d9aa0

7 files changed

Lines changed: 25 additions & 31 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Then install the plugin for your agent (Claude Code, Codex, Cursor, or Antigravi
3333

3434
## Self-host
3535

36-
Self-hosting is free under AGPL-3.0. You can run the Piyaz server yourself and point the plugin's `piyaz-local` server at it. You need [Bun](https://bun.sh) and [Docker](https://docs.docker.com/get-docker/) for PostgreSQL. Full setup and upgrade steps are in the [self-host guide](https://docs.piyaz.ai/docs/self-hosting/run-locally).
36+
Self-hosting is free under AGPL-3.0. You can run the Piyaz server yourself and register an MCP server in your editor that points at it. You need [Bun](https://bun.sh) and [Docker](https://docs.docker.com/get-docker/) for PostgreSQL. Full setup and upgrade steps are in the [self-host guide](https://docs.piyaz.ai/docs/self-hosting/run-locally).
3737

3838
---
3939

components/home/GetStartedModal.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,38 @@ const HOSTED_CLI_INSTALLS: readonly CliInstall[] = [
5050
},
5151
];
5252

53+
/**
54+
* Every plugin ships one MCP server pointing at the hosted app. Each self-host
55+
* note therefore registers a second server against the reader's own instance
56+
* rather than editing the plugin's bundled config, which lives in a
57+
* version-scoped cache the next plugin update overwrites.
58+
*/
5359
const SELF_HOST_CLI_INSTALLS: readonly CliInstall[] = [
5460
{
5561
name: "Claude Code",
5662
install:
57-
"claude plugin marketplace add ./plugins/claude-code\nclaude plugin install piyaz@piyaz-local",
63+
"claude plugin marketplace add ./plugins/claude-code\nclaude plugin install piyaz@piyaz-local\nclaude mcp add -s user --transport http piyaz-self-hosted http://localhost:3000/api/mcp",
5864
setupNote:
59-
"Authenticate with /mcp, select piyaz-local, and complete the browser sign-in against http://localhost:3000.",
65+
"Run /mcp, select piyaz-self-hosted, and complete the browser sign-in against your own instance.",
6066
},
6167
{
6268
name: "Codex",
63-
install: "codex plugin marketplace add ./plugins",
69+
install:
70+
"codex plugin marketplace add ./plugins\ncodex mcp add piyaz-self-hosted --url http://localhost:3000/api/mcp",
6471
setupNote:
65-
"Run /plugin, search for piyaz, install, then restart Codex. Select piyaz-local for http://localhost:3000/api/mcp.",
72+
"Run /plugin, install Piyaz, restart Codex, then authenticate against piyaz-self-hosted.",
6673
},
6774
{
6875
name: "Antigravity",
6976
install: "cp -r ./plugins/antigravity ~/.gemini/config/plugins/piyaz",
7077
setupNote:
71-
"Run /mcp, select piyaz-local, Authenticate, and complete the browser sign-in against http://localhost:3000.",
78+
'Add {"piyaz-self-hosted": {"serverUrl": "http://localhost:3000/api/mcp"}} to mcpServers in ~/.gemini/config/mcp_config.json, then run /mcp and Authenticate.',
7279
},
7380
{
7481
name: "Cursor",
7582
install: 'ln -s "$(pwd)/plugins/cursor" ~/.cursor/plugins/local/piyaz',
7683
setupNote:
77-
"Restart Cursor. The MCP server and skills load automatically; piyaz-local points at http://localhost:3000/api/mcp.",
84+
'Add {"piyaz-self-hosted": {"url": "http://localhost:3000/api/mcp"}} to mcpServers in ~/.cursor/mcp.json, then restart Cursor.',
7885
},
7986
];
8087

plugins/antigravity/mcp_config.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"mcpServers": {
33
"piyaz": {
44
"serverUrl": "https://app.piyaz.ai/api/mcp"
5-
},
6-
"piyaz-local": {
7-
"serverUrl": "http://localhost:3000/api/mcp"
85
}
96
}
107
}

plugins/claude-code/.mcp.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
"mcpServers": {
33
"piyaz": {
44
"type": "http",
5-
"url": "${PIYAZ_URL:-https://app.piyaz.ai}/api/mcp"
6-
},
7-
"piyaz-local": {
8-
"type": "http",
9-
"url": "http://localhost:3000/api/mcp"
5+
"url": "https://app.piyaz.ai/api/mcp"
106
}
117
}
128
}

plugins/codex/.mcp.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
"piyaz": {
44
"type": "http",
55
"url": "https://app.piyaz.ai/api/mcp"
6-
},
7-
"piyaz-local": {
8-
"type": "http",
9-
"url": "http://localhost:3000/api/mcp"
106
}
117
}
128
}

plugins/cursor/mcp.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"mcpServers": {
33
"piyaz": {
44
"url": "https://app.piyaz.ai/api/mcp"
5-
},
6-
"piyaz-local": {
7-
"url": "http://localhost:3000/api/mcp"
85
}
96
}
107
}

tests/plugins/manifests.test.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ test("Antigravity plugin marker exists and is named piyaz", () => {
5454
expect(p.name).toBe("piyaz");
5555
});
5656

57-
test("Antigravity mcp_config uses serverUrl (never url/httpUrl) for both servers", () => {
57+
test("Antigravity mcp_config uses serverUrl (never url/httpUrl)", () => {
5858
const cfg = readJson("plugins/antigravity/mcp_config.json");
5959
const hosted = cfg.mcpServers.piyaz;
60-
const local = cfg.mcpServers["piyaz-local"];
6160
expect(hosted.serverUrl).toContain("app.piyaz.ai");
6261
expect(hosted.url).toBeUndefined();
6362
expect(hosted.httpUrl).toBeUndefined();
64-
expect(local.serverUrl).toContain("localhost:3000");
6563
});
6664

6765
test("Antigravity bundles every shared skill", () => {
@@ -81,16 +79,19 @@ test("Antigravity bundles every shared skill", () => {
8179
}
8280
});
8381

82+
/**
83+
* Every brand ships exactly one MCP server, the hosted one. A bundled
84+
* localhost server is dead config for hosted users and surfaces as a
85+
* connection error against a server they never run.
86+
*/
8487
test.each([
8588
"plugins/claude-code/.mcp.json",
8689
"plugins/codex/.mcp.json",
8790
"plugins/cursor/mcp.json",
88-
])("%s declares hosted piyaz + local piyaz-local", (path) => {
91+
"plugins/antigravity/mcp_config.json",
92+
])("%s declares exactly one hosted piyaz server", (path) => {
8993
const cfg = readJson(path);
90-
expect(cfg.mcpServers.piyaz).toBeDefined();
91-
expect(cfg.mcpServers["piyaz-local"]).toBeDefined();
94+
expect(Object.keys(cfg.mcpServers)).toEqual(["piyaz"]);
9295
expect(JSON.stringify(cfg.mcpServers.piyaz)).toContain("app.piyaz.ai");
93-
expect(JSON.stringify(cfg.mcpServers["piyaz-local"])).toContain(
94-
"localhost:3000",
95-
);
96+
expect(JSON.stringify(cfg)).not.toContain("localhost");
9697
});

0 commit comments

Comments
 (0)