@syntica/mcp 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,42 @@
1
- # @syntica/mcp
1
+ <p align="center">
2
+ <a href="https://syntica.io">
3
+ <img src="https://syntica.io/logo-icon-light.png" alt="Syntica" width="96" />
4
+ </a>
5
+ </p>
2
6
 
3
- `@syntica/mcp` is the MCP server and Claude Code plugin for **Syntica**, a platform that deploys and runs containerised applications on dedicated cloud infrastructure. It lets you create an application, push code, deploy it to a working HTTPS URL, inspect running services, tail logs and query the application's database — as tool calls from inside Claude Code, without writing infrastructure code, CI configuration or Terraform.
7
+ <h1 align="center">@syntica/mcp</h1>
8
+
9
+ <p align="center"><strong>They know what to build, now they can ship it.</strong></p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@syntica/mcp"><img src="https://img.shields.io/npm/v/%40syntica%2Fmcp" alt="npm version" /></a>
13
+ </p>
14
+
15
+ The MCP server and Claude Code plugin for [**Syntica**](https://syntica.io), the platform that deploys and runs containerised applications on dedicated cloud infrastructure. Create an application, push code, deploy it to a working HTTPS URL, inspect running services, tail logs and query the application's database, all as tool calls from inside your coding agent. No infrastructure code, no CI configuration, no Terraform.
4
16
 
5
17
  You keep using the coding agent you already have. Syntica handles the repository, the machine, the certificate, the domain and the secrets.
6
18
 
19
+ **Works with [Claude Code](https://claude.com/claude-code), Codex, and Copilot CLI.** One MCP server, the same tools in each.
20
+
21
+ [Website](https://syntica.io) · [Getting started](https://syntica.io/docs/getting-started) · [Agent setup guides](https://syntica.io/agents) · [Docs](https://syntica.io/docs) · [Pricing](https://syntica.io/pricing)
22
+
23
+ ---
24
+
25
+ ## Quick start (Claude Code)
26
+
27
+ ```bash
28
+ npx @syntica/mcp setup
29
+ ```
30
+
31
+ Restart Claude Code, then:
32
+
33
+ ```
34
+ /syntica-onboard # sign up or log in, create the application, push the first version
35
+ /syntica-deploy # deploy and get the live URL
36
+ ```
37
+
38
+ That is the whole path from an empty folder to a running HTTPS application. Signing up happens inside the conversation: the onboard skill asks for your name, email and an organisation name, then verifies with a one-time email code. New to Syntica? The [getting started guide](https://syntica.io/docs/getting-started) walks it end to end, no coding experience needed.
39
+
7
40
  ---
8
41
 
9
42
  ## When to use this
@@ -23,8 +56,8 @@ Use something else when you need autoscaling, high availability, multi-region de
23
56
  ## Requirements
24
57
 
25
58
  - **Node.js 18 or later**
26
- - **Claude Code**
27
- - A **Syntica account**. Sign up at [syntica.io](https://syntica.io). The platform is currently in closed beta, so access is granted per organisation.
59
+ - A **coding agent**: Claude Code, Codex, or Copilot CLI
60
+ - A **Syntica account**. Sign up at [syntica.io](https://syntica.io), or let `/syntica-onboard` register you from the conversation. The platform is currently in closed beta, so access is granted per organisation.
28
61
  - Your application needs a **`docker-compose.yml`** at the repository root. If you do not have one, the `/syntica-onboard` skill will scaffold it for you.
29
62
 
30
63
  ---
@@ -57,6 +90,33 @@ owner-only), removes the old `vibetocloud` plugin and marketplace registration,
57
90
  `syntica` plugin in their place. It is safe to run more than once, and does nothing destructive
58
91
  if it finds no old install.
59
92
 
93
+ ### Using Codex or Copilot CLI
94
+
95
+ The same server registers directly in each agent's MCP config, with no plugin wrapper.
96
+
97
+ **Codex** (`~/.codex/config.toml`):
98
+
99
+ ```toml
100
+ [mcp_servers.syntica]
101
+ command = "npx"
102
+ args = ["-y", "@syntica/mcp"]
103
+ ```
104
+
105
+ **Copilot CLI** (`~/.copilot/mcp-config.json`):
106
+
107
+ ```json
108
+ {
109
+ "mcpServers": {
110
+ "syntica": {
111
+ "command": "npx",
112
+ "args": ["-y", "@syntica/mcp"]
113
+ }
114
+ }
115
+ }
116
+ ```
117
+
118
+ The `/syntica-*` slash commands are Claude Code plugin skills and do not exist in these agents. Ask in plain language instead, for example "set me up on Syntica and deploy this application". The agent drives the same tools, signup included. The [agent setup guides](https://syntica.io/agents) cover each agent in detail.
119
+
60
120
  ### Other ways to run it
61
121
 
62
122
  ```bash
@@ -284,6 +344,9 @@ The published package points at the production API by default and needs no confi
284
344
 
285
345
  - Website — [syntica.io](https://syntica.io)
286
346
  - Application — [app.syntica.io](https://app.syntica.io)
347
+ - Getting started — [syntica.io/docs/getting-started](https://syntica.io/docs/getting-started)
348
+ - Agent setup guides — [syntica.io/agents](https://syntica.io/agents)
349
+ - Documentation — [syntica.io/docs](https://syntica.io/docs)
287
350
 
288
351
  ## License
289
352
 
package/dist/index.js CHANGED
@@ -33967,7 +33967,7 @@ var require_service_unavailable_exception = __commonJS({
33967
33967
  exports2.ServiceUnavailableException = void 0;
33968
33968
  var http_status_enum_1 = require_http_status_enum();
33969
33969
  var http_exception_1 = require_http_exception();
33970
- var ServiceUnavailableException4 = class extends http_exception_1.HttpException {
33970
+ var ServiceUnavailableException5 = class extends http_exception_1.HttpException {
33971
33971
  /**
33972
33972
  * Instantiate a `ServiceUnavailableException` Exception.
33973
33973
  *
@@ -33997,7 +33997,7 @@ var require_service_unavailable_exception = __commonJS({
33997
33997
  super(http_exception_1.HttpException.createBody(objectOrError, description, http_status_enum_1.HttpStatus.SERVICE_UNAVAILABLE), http_status_enum_1.HttpStatus.SERVICE_UNAVAILABLE, httpExceptionOptions);
33998
33998
  }
33999
33999
  };
34000
- exports2.ServiceUnavailableException = ServiceUnavailableException4;
34000
+ exports2.ServiceUnavailableException = ServiceUnavailableException5;
34001
34001
  }
34002
34002
  });
34003
34003
 
@@ -34649,7 +34649,7 @@ var require_logger_service = __commonJS({
34649
34649
  day: "2-digit",
34650
34650
  month: "2-digit"
34651
34651
  });
34652
- var Logger4 = Logger_1 = class Logger {
34652
+ var Logger5 = Logger_1 = class Logger {
34653
34653
  constructor(context, options = {}) {
34654
34654
  this.context = context;
34655
34655
  this.options = options;
@@ -34763,10 +34763,10 @@ var require_logger_service = __commonJS({
34763
34763
  return this.localInstanceRef;
34764
34764
  }
34765
34765
  };
34766
- exports2.Logger = Logger4;
34767
- Logger4.logBuffer = new Array();
34768
- Logger4.staticInstanceRef = DEFAULT_LOGGER;
34769
- Logger4.WrapBuffer = (target, propertyKey, descriptor) => {
34766
+ exports2.Logger = Logger5;
34767
+ Logger5.logBuffer = new Array();
34768
+ Logger5.staticInstanceRef = DEFAULT_LOGGER;
34769
+ Logger5.WrapBuffer = (target, propertyKey, descriptor) => {
34770
34770
  const originalFn = descriptor.value;
34771
34771
  descriptor.value = function(...args) {
34772
34772
  if (Logger_1.isBufferAttached) {
@@ -34780,83 +34780,83 @@ var require_logger_service = __commonJS({
34780
34780
  };
34781
34781
  };
34782
34782
  tslib_1.__decorate([
34783
- Logger4.WrapBuffer,
34783
+ Logger5.WrapBuffer,
34784
34784
  tslib_1.__metadata("design:type", Function),
34785
34785
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34786
34786
  tslib_1.__metadata("design:returntype", void 0)
34787
- ], Logger4.prototype, "error", null);
34787
+ ], Logger5.prototype, "error", null);
34788
34788
  tslib_1.__decorate([
34789
- Logger4.WrapBuffer,
34789
+ Logger5.WrapBuffer,
34790
34790
  tslib_1.__metadata("design:type", Function),
34791
34791
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34792
34792
  tslib_1.__metadata("design:returntype", void 0)
34793
- ], Logger4.prototype, "log", null);
34793
+ ], Logger5.prototype, "log", null);
34794
34794
  tslib_1.__decorate([
34795
- Logger4.WrapBuffer,
34795
+ Logger5.WrapBuffer,
34796
34796
  tslib_1.__metadata("design:type", Function),
34797
34797
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34798
34798
  tslib_1.__metadata("design:returntype", void 0)
34799
- ], Logger4.prototype, "warn", null);
34799
+ ], Logger5.prototype, "warn", null);
34800
34800
  tslib_1.__decorate([
34801
- Logger4.WrapBuffer,
34801
+ Logger5.WrapBuffer,
34802
34802
  tslib_1.__metadata("design:type", Function),
34803
34803
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34804
34804
  tslib_1.__metadata("design:returntype", void 0)
34805
- ], Logger4.prototype, "debug", null);
34805
+ ], Logger5.prototype, "debug", null);
34806
34806
  tslib_1.__decorate([
34807
- Logger4.WrapBuffer,
34807
+ Logger5.WrapBuffer,
34808
34808
  tslib_1.__metadata("design:type", Function),
34809
34809
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34810
34810
  tslib_1.__metadata("design:returntype", void 0)
34811
- ], Logger4.prototype, "verbose", null);
34811
+ ], Logger5.prototype, "verbose", null);
34812
34812
  tslib_1.__decorate([
34813
- Logger4.WrapBuffer,
34813
+ Logger5.WrapBuffer,
34814
34814
  tslib_1.__metadata("design:type", Function),
34815
34815
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34816
34816
  tslib_1.__metadata("design:returntype", void 0)
34817
- ], Logger4.prototype, "fatal", null);
34817
+ ], Logger5.prototype, "fatal", null);
34818
34818
  tslib_1.__decorate([
34819
- Logger4.WrapBuffer,
34819
+ Logger5.WrapBuffer,
34820
34820
  tslib_1.__metadata("design:type", Function),
34821
34821
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34822
34822
  tslib_1.__metadata("design:returntype", void 0)
34823
- ], Logger4, "error", null);
34823
+ ], Logger5, "error", null);
34824
34824
  tslib_1.__decorate([
34825
- Logger4.WrapBuffer,
34825
+ Logger5.WrapBuffer,
34826
34826
  tslib_1.__metadata("design:type", Function),
34827
34827
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34828
34828
  tslib_1.__metadata("design:returntype", void 0)
34829
- ], Logger4, "log", null);
34829
+ ], Logger5, "log", null);
34830
34830
  tslib_1.__decorate([
34831
- Logger4.WrapBuffer,
34831
+ Logger5.WrapBuffer,
34832
34832
  tslib_1.__metadata("design:type", Function),
34833
34833
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34834
34834
  tslib_1.__metadata("design:returntype", void 0)
34835
- ], Logger4, "warn", null);
34835
+ ], Logger5, "warn", null);
34836
34836
  tslib_1.__decorate([
34837
- Logger4.WrapBuffer,
34837
+ Logger5.WrapBuffer,
34838
34838
  tslib_1.__metadata("design:type", Function),
34839
34839
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34840
34840
  tslib_1.__metadata("design:returntype", void 0)
34841
- ], Logger4, "debug", null);
34841
+ ], Logger5, "debug", null);
34842
34842
  tslib_1.__decorate([
34843
- Logger4.WrapBuffer,
34843
+ Logger5.WrapBuffer,
34844
34844
  tslib_1.__metadata("design:type", Function),
34845
34845
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34846
34846
  tslib_1.__metadata("design:returntype", void 0)
34847
- ], Logger4, "verbose", null);
34847
+ ], Logger5, "verbose", null);
34848
34848
  tslib_1.__decorate([
34849
- Logger4.WrapBuffer,
34849
+ Logger5.WrapBuffer,
34850
34850
  tslib_1.__metadata("design:type", Function),
34851
34851
  tslib_1.__metadata("design:paramtypes", [Object, Object]),
34852
34852
  tslib_1.__metadata("design:returntype", void 0)
34853
- ], Logger4, "fatal", null);
34854
- exports2.Logger = Logger4 = Logger_1 = tslib_1.__decorate([
34853
+ ], Logger5, "fatal", null);
34854
+ exports2.Logger = Logger5 = Logger_1 = tslib_1.__decorate([
34855
34855
  (0, core_1.Injectable)(),
34856
34856
  tslib_1.__param(0, (0, core_1.Optional)()),
34857
34857
  tslib_1.__param(1, (0, core_1.Optional)()),
34858
34858
  tslib_1.__metadata("design:paramtypes", [String, Object])
34859
- ], Logger4);
34859
+ ], Logger5);
34860
34860
  }
34861
34861
  });
34862
34862
 
@@ -57570,15 +57570,20 @@ var CONNECTORS = [
57570
57570
  name: "Microsoft 365",
57571
57571
  category: "Email",
57572
57572
  tone: "violet",
57573
- blurb: `"Send mail as a shared mailbox in a customer's Microsoft 365 tenant.\\`,
57573
+ blurb: "Send mail as a shared mailbox in a customer\u2019s Microsoft 365 tenant.",
57574
57574
  long: "Sends mail through Microsoft Graph using an app registration in the customer's own Entra tenant, so the sending domain, its reputation and the mailbox all stay with them. The application receives four variables at deploy time and calls Graph directly \u2014 two HTTPS requests, no dependency, in any language. Because the registration is theirs, leaving the platform costs nothing: the same variables set anywhere else keep the mail flowing. Pair it with an ApplicationAccessPolicy so the registration can only send as the one shared mailbox, never as anyone in the tenant.",
57575
57575
  vars: ["GRAPH_TENANT_ID", "GRAPH_CLIENT_ID", "GRAPH_CLIENT_SECRET", "MAIL_FROM"],
57576
57576
  steps: [
57577
- "Create a service account or application in the vendor console.",
57578
- "Grant it only the scopes this connector lists \u2014 nothing wider.",
57579
- "Generate a key and hand it to the platform once; it is never shown again."
57577
+ "Create an app registration in the customer's Entra tenant.",
57578
+ "Grant it the Mail.Send application permission and admin consent, nothing wider.",
57579
+ "Add an ApplicationAccessPolicy so it can send only as the one shared mailbox, never as anyone else in the tenant. The platform cannot do this for you, and does not check it.",
57580
+ "Generate a client secret and hand it to the platform once; it is never shown again."
57580
57581
  ],
57581
- docsUrl: "https://learn.microsoft.com/graph/api/user-sendmail"
57582
+ docsUrl: "https://learn.microsoft.com/graph/api/user-sendmail",
57583
+ attestation: {
57584
+ label: "An ApplicationAccessPolicy limits this registration to the one mailbox",
57585
+ detail: "Without it, a registration holding Mail.Send can send as any mailbox in the tenant. The policy lives in your tenant, so the platform cannot create it or check that it exists."
57586
+ }
57582
57587
  },
57583
57588
  {
57584
57589
  id: "smtp",
@@ -57686,10 +57691,86 @@ var CONNECTORS = [
57686
57691
  "Generate a key and hand it to the platform once; it is never shown again."
57687
57692
  ],
57688
57693
  docsUrl: "https://docs.stripe.com/api"
57694
+ },
57695
+ {
57696
+ id: "supabase",
57697
+ name: "Supabase",
57698
+ category: "Database",
57699
+ tone: "green",
57700
+ blurb: "Postgres, auth and storage from a customer\u2019s Supabase project.",
57701
+ long: "Connects an application to a Supabase project the customer owns \u2014 the Postgres database, its auto-generated REST API, auth and storage. Three variables: the project URL, the anon key the browser may hold, and the service_role key that bypasses Row Level Security and must only ever be read server-side. The project stays the customer's, on their own Supabase account and billing, so leaving the platform costs nothing: the same three variables set anywhere else keep the app running. This is also the natural landing place for an app built elsewhere against Supabase \u2014 point it at the same project and the data never moves.",
57702
+ vars: ["SUPABASE_URL", "SUPABASE_ANON_KEY", "SUPABASE_SERVICE_ROLE_KEY"],
57703
+ steps: [
57704
+ "Create or open the project in the customer's own Supabase account \u2014 never one owned by an individual consultant.",
57705
+ "Copy the project URL and the anon (publishable) key from the project's API settings.",
57706
+ "Copy the service_role (secret) key. It bypasses Row Level Security, so it belongs only in this platform and the customer's password manager \u2014 never in a repository or a browser.",
57707
+ "Enable Row Level Security on every table the application exposes. The anon key is only as safe as the policies behind it."
57708
+ ],
57709
+ docsUrl: "https://supabase.com/docs/guides/api",
57710
+ attestation: {
57711
+ label: "Row Level Security is enabled on every table the anon key can reach",
57712
+ detail: "The anon key is designed to be public, so it is only as safe as the policies behind it: without RLS, anyone holding it can read and write every exposed table through the auto-generated API. RLS lives in the customer's Supabase project, so the platform cannot enable it or check that it is on."
57713
+ }
57714
+ },
57715
+ {
57716
+ id: "google-gemini",
57717
+ name: "Google Gemini",
57718
+ category: "AI",
57719
+ tone: "blue",
57720
+ blurb: "Gemini models through the customer\u2019s own Google AI key.",
57721
+ long: "Calls Gemini through an API key the customer owns, created in Google AI Studio on their own Google account and billing. One variable: the key, injected server-side at deploy time, so it never reaches a repository or a browser. This is also where an app built against a hosted AI gateway lands. Point the same calls at the Gemini API with a key the customer holds, and the feature keeps working with no platform in the middle. Usage is billed by Google on the customer's account: set a spend limit in the console before the first deploy, not after the first invoice.",
57722
+ vars: ["GEMINI_API_KEY"],
57723
+ steps: [
57724
+ "Create an API key in Google AI Studio, on the customer's own Google account, never a consultant's personal one.",
57725
+ "Set a spend limit on the project in the Google console. Usage lands on the customer's bill, not the platform's.",
57726
+ "Hand the key to the platform once. It is never shown again."
57727
+ ],
57728
+ docsUrl: "https://ai.google.dev/gemini-api/docs"
57729
+ },
57730
+ {
57731
+ id: "openai",
57732
+ name: "OpenAI",
57733
+ category: "AI",
57734
+ tone: "green",
57735
+ blurb: "GPT models through the customer\u2019s own OpenAI key.",
57736
+ long: "Calls the OpenAI API with a key the customer owns. One variable, injected server-side at deploy time, so the key never reaches a repository or a browser, and never a client bundle, where a pasted key is public within the hour. Create the key in a project of its own so it can be revoked without touching anything else, and give it the least permission that works: a key that calls models does not need to manage the account. Usage is billed by OpenAI on the customer's account: set a monthly budget in the console before the first deploy.",
57737
+ vars: ["OPENAI_API_KEY"],
57738
+ steps: [
57739
+ "Create a project for the application on the customer's OpenAI account, so its key can be revoked on its own.",
57740
+ "Create an API key in that project, with the least permission that works.",
57741
+ "Set a monthly budget on the project. Usage lands on the customer's bill, not the platform's.",
57742
+ "Hand the key to the platform once. It is never shown again."
57743
+ ],
57744
+ docsUrl: "https://platform.openai.com/docs/api-reference"
57745
+ },
57746
+ {
57747
+ id: "anthropic",
57748
+ name: "Anthropic Claude",
57749
+ category: "AI",
57750
+ tone: "apricot",
57751
+ blurb: "Claude models through the customer\u2019s own Anthropic key.",
57752
+ long: "Calls Claude with an API key the customer owns, created in the Anthropic Console on their own account and billing. One variable, injected server-side at deploy time, so the key never reaches a repository or a browser. Claude may also be the model behind the coding agent that built the application, but this key is a different thing: it is the application's own runtime access, spending the customer's budget, so it belongs in a workspace of its own with a spend limit of its own. Usage is billed by Anthropic on the customer's account.",
57753
+ vars: ["ANTHROPIC_API_KEY"],
57754
+ steps: [
57755
+ "Create a workspace for the application on the customer's Anthropic account, so its spend and limits stand alone.",
57756
+ "Create an API key in that workspace and set a monthly spend limit.",
57757
+ "Hand the key to the platform once. It is never shown again."
57758
+ ],
57759
+ docsUrl: "https://docs.claude.com/en/api/overview"
57689
57760
  }
57690
57761
  ];
57691
57762
  var CONNECTOR_CATEGORIES = Array.from(new Set(CONNECTORS.map((c) => c.category)));
57692
57763
 
57764
+ // libs/shared/src/entitlements/catalog.ts
57765
+ var MB = 1024 * 1024;
57766
+ var LOG_TIER_LIMITS = {
57767
+ free: { retentionDays: 3, dailyBytes: 100 * MB },
57768
+ basic: { retentionDays: 7, dailyBytes: 500 * MB },
57769
+ standard: { retentionDays: 30, dailyBytes: 1024 * MB },
57770
+ advanced: { retentionDays: 90, dailyBytes: 2048 * MB }
57771
+ };
57772
+ var FREE_LIMITS = { retentionDays: 3, dailyBytes: 100 * MB };
57773
+
57693
57774
  // libs/shared/src/controllers/health.controller.ts
57694
57775
  var import_common2 = __toESM(require_common2());
57695
57776
 
@@ -57717,7 +57798,7 @@ HealthController = __decorateClass([
57717
57798
  ], HealthController);
57718
57799
 
57719
57800
  // libs/shared/src/guards/validate-request.guard.ts
57720
- var import_common4 = __toESM(require_common2());
57801
+ var import_common5 = __toESM(require_common2());
57721
57802
  var import_jsonwebtoken = __toESM(require_jsonwebtoken());
57722
57803
 
57723
57804
  // libs/shared/src/utils/auth-public-key.ts
@@ -57813,25 +57894,96 @@ function mayBeStaleKey(err) {
57813
57894
  return !["jwt malformed", "jwt must be provided", "invalid token", "jwt signature is required"].includes(message);
57814
57895
  }
57815
57896
 
57897
+ // libs/shared/src/utils/revocation-cache.ts
57898
+ var import_common4 = __toESM(require_common2());
57899
+ var RevocationCache = class _RevocationCache {
57900
+ constructor() {
57901
+ this.answers = /* @__PURE__ */ new Map();
57902
+ }
57903
+ static {
57904
+ this.logger = new import_common4.Logger(_RevocationCache.name);
57905
+ }
57906
+ static {
57907
+ /** How long an answer is trusted, reachable or not. */
57908
+ this.TTL_MS = 6e4;
57909
+ }
57910
+ /**
57911
+ * @param jti the token's id, already taken from a signature-verified token
57912
+ * @param token the token itself — introspection authenticates with it, so no
57913
+ * service needs an internal key or a Redis connection to ask
57914
+ */
57915
+ async isRevoked(jti, token) {
57916
+ const cached2 = this.answers.get(jti);
57917
+ const age = cached2 ? Date.now() - cached2.fetchedAtMs : Infinity;
57918
+ if (cached2 && age < _RevocationCache.TTL_MS) {
57919
+ return cached2.revoked;
57920
+ }
57921
+ const authServiceUrl = process.env["AUTH_SERVICE_URL"] ?? "";
57922
+ if (authServiceUrl === "") {
57923
+ _RevocationCache.logger.error("AUTH_SERVICE_URL is not set \u2014 cannot check whether a token has been revoked");
57924
+ throw new import_common4.ServiceUnavailableException("Cannot verify the session right now");
57925
+ }
57926
+ try {
57927
+ const res = await fetch(`${authServiceUrl}/auth/introspect`, {
57928
+ method: "POST",
57929
+ headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" }
57930
+ });
57931
+ if (!res.ok) {
57932
+ if (res.status === 401) {
57933
+ this.answers.set(jti, { revoked: true, fetchedAtMs: Date.now() });
57934
+ return true;
57935
+ }
57936
+ throw new Error(`introspect returned ${String(res.status)}`);
57937
+ }
57938
+ const body = await res.json();
57939
+ const revoked = body.data?.revoked === true;
57940
+ this.answers.set(jti, { revoked, fetchedAtMs: Date.now() });
57941
+ this.evictStale();
57942
+ return revoked;
57943
+ } catch (err) {
57944
+ const staleness = cached2 ? ` \u2014 cached answer is ${String(Math.round(age / 1e3))}s old` : " \u2014 nothing cached";
57945
+ _RevocationCache.logger.warn(
57946
+ `revocation check failed (${err instanceof Error ? err.message : String(err)})${staleness}`
57947
+ );
57948
+ throw new import_common4.ServiceUnavailableException("Cannot verify the session right now");
57949
+ }
57950
+ }
57951
+ evictStale() {
57952
+ const cutoff = Date.now() - _RevocationCache.TTL_MS;
57953
+ for (const [key, entry] of this.answers) {
57954
+ if (entry.fetchedAtMs < cutoff) {
57955
+ this.answers.delete(key);
57956
+ }
57957
+ }
57958
+ }
57959
+ };
57960
+
57816
57961
  // libs/shared/src/guards/validate-request.guard.ts
57817
57962
  var ValidateRequestGuard = class {
57818
57963
  constructor() {
57819
57964
  this.publicKeyCache = new AuthPublicKeyCache();
57965
+ this.revocationCache = new RevocationCache();
57820
57966
  }
57821
57967
  async canActivate(context) {
57822
57968
  const req = context.switchToHttp().getRequest();
57823
57969
  const authHeader = req.headers.authorization;
57824
57970
  if (authHeader?.startsWith("Bearer ")) {
57825
57971
  const token = authHeader.slice(7);
57972
+ let auth;
57826
57973
  try {
57827
- req.auth = await this.verifyWithRetry(token);
57828
- return true;
57974
+ auth = await this.verifyWithRetry(token);
57829
57975
  } catch (err) {
57830
- if (err instanceof import_common4.HttpException && err.getStatus() === 503) {
57976
+ if (err instanceof import_common5.HttpException && err.getStatus() === 503) {
57831
57977
  throw err;
57832
57978
  }
57833
- throw new import_common4.UnauthorizedException("Invalid or expired token");
57979
+ throw new import_common5.UnauthorizedException("Invalid or expired token");
57834
57980
  }
57981
+ const jti = auth.kind === "user" ? auth.payload["jti"] : void 0;
57982
+ if (typeof jti === "string" && await this.revocationCache.isRevoked(jti, token)) {
57983
+ throw new import_common5.UnauthorizedException("Token has been revoked");
57984
+ }
57985
+ req.auth = auth;
57986
+ return true;
57835
57987
  }
57836
57988
  const internalServiceKey = process.env["INTERNAL_SERVICE_KEY"];
57837
57989
  const sentKey = req.headers["x-internal-secret"] ?? req.headers["x-service-key"];
@@ -57839,7 +57991,7 @@ var ValidateRequestGuard = class {
57839
57991
  req.auth = { kind: "internal" };
57840
57992
  return true;
57841
57993
  }
57842
- throw new import_common4.UnauthorizedException("Missing or invalid Authorization header");
57994
+ throw new import_common5.UnauthorizedException("Missing or invalid Authorization header");
57843
57995
  }
57844
57996
  /** Verify with the cached key, then once more with a force-refetched key (a
57845
57997
  * stale key after an auth-service keypair change is the common false negative). */
@@ -57859,11 +58011,11 @@ var ValidateRequestGuard = class {
57859
58011
  }
57860
58012
  };
57861
58013
  ValidateRequestGuard = __decorateClass([
57862
- (0, import_common4.Injectable)()
58014
+ (0, import_common5.Injectable)()
57863
58015
  ], ValidateRequestGuard);
57864
58016
 
57865
58017
  // libs/shared/src/guards/admin.guard.ts
57866
- var import_common5 = __toESM(require_common2());
58018
+ var import_common6 = __toESM(require_common2());
57867
58019
  var import_jsonwebtoken2 = __toESM(require_jsonwebtoken());
57868
58020
  var AdminGuard = class {
57869
58021
  constructor() {
@@ -57878,13 +58030,13 @@ var AdminGuard = class {
57878
58030
  try {
57879
58031
  payload = await this.verifyWithRetry(token);
57880
58032
  } catch {
57881
- throw new import_common5.UnauthorizedException("Invalid or expired token");
58033
+ throw new import_common6.UnauthorizedException("Invalid or expired token");
57882
58034
  }
57883
58035
  if (payload.service === true) {
57884
58036
  return true;
57885
58037
  }
57886
58038
  if (payload.role !== "super_admin") {
57887
- throw new import_common5.ForbiddenException("Admin access required");
58039
+ throw new import_common6.ForbiddenException("Admin access required");
57888
58040
  }
57889
58041
  return true;
57890
58042
  }
@@ -57893,7 +58045,7 @@ var AdminGuard = class {
57893
58045
  if (internalServiceKey && serviceKey === internalServiceKey) {
57894
58046
  return true;
57895
58047
  }
57896
- throw new import_common5.UnauthorizedException("Missing or invalid Authorization header");
58048
+ throw new import_common6.UnauthorizedException("Missing or invalid Authorization header");
57897
58049
  }
57898
58050
  /** Verify with the cached key, then once more with a force-refetched key, so a
57899
58051
  * keypair change on auth-service self-heals instead of 401'ing until restart. */
@@ -57909,7 +58061,7 @@ var AdminGuard = class {
57909
58061
  }
57910
58062
  };
57911
58063
  AdminGuard = __decorateClass([
57912
- (0, import_common5.Injectable)()
58064
+ (0, import_common6.Injectable)()
57913
58065
  ], AdminGuard);
57914
58066
 
57915
58067
  // libs/shared/src/utils/jwt-lifetime.ts
@@ -57940,10 +58092,10 @@ function isTokenDueForRefresh(token, nowMs = Date.now()) {
57940
58092
  }
57941
58093
 
57942
58094
  // libs/shared/src/agent-policy/assert.ts
57943
- var import_common6 = __toESM(require_common2());
58095
+ var import_common7 = __toESM(require_common2());
57944
58096
 
57945
58097
  // libs/shared/src/agent-policy/enforce.ts
57946
- var import_common7 = __toESM(require_common2());
58098
+ var import_common8 = __toESM(require_common2());
57947
58099
 
57948
58100
  // libs/shared/src/clients/authClient.ts
57949
58101
  var AuthClient = class {
@@ -57988,6 +58140,39 @@ var AuthClient = class {
57988
58140
  return false;
57989
58141
  }
57990
58142
  }
58143
+ /**
58144
+ * Refuse every token this person already holds (#939).
58145
+ *
58146
+ * For withdrawing access, which `revoke` cannot express: nobody is holding a
58147
+ * departed member's tokens, so there is no id to deny. Fail-soft like
58148
+ * `revoke` — a blocked user must stay blocked even if this call does not
58149
+ * land, and the gateway's own check still refuses them within its cache
58150
+ * window.
58151
+ */
58152
+ async revokeUser(userId, serviceKey) {
58153
+ return this.postInternal("revoke-user", { userId }, serviceKey);
58154
+ }
58155
+ /**
58156
+ * Refuse every token scoped to this organisation (#939).
58157
+ *
58158
+ * Org, not user: a member who also belongs to another org keeps that org's
58159
+ * tokens. Destroying those too is the mistake #633 was filed for.
58160
+ */
58161
+ async revokeOrg(orgId, serviceKey) {
58162
+ return this.postInternal("revoke-org", { orgId }, serviceKey);
58163
+ }
58164
+ async postInternal(path, body, serviceKey) {
58165
+ try {
58166
+ const res = await fetch(`${this.baseUrl}/auth/${path}`, {
58167
+ method: "POST",
58168
+ headers: { "Content-Type": "application/json", "x-internal-secret": serviceKey },
58169
+ body: JSON.stringify(body)
58170
+ });
58171
+ return res.ok;
58172
+ } catch {
58173
+ return false;
58174
+ }
58175
+ }
57991
58176
  /** Re-scope the caller's token to `orgId` (must be one of their memberships). */
57992
58177
  async selectOrg(options) {
57993
58178
  try {
@@ -58372,6 +58557,12 @@ var ApplicationClient = class {
58372
58557
  const json = await res.json();
58373
58558
  return json.data ?? [];
58374
58559
  }
58560
+ /**
58561
+ * Throws rather than returning null on failure: the backend distinguishes a
58562
+ * name held by a trashed application from a storage limit from an invalid
58563
+ * name, and collapsing all of them into `null` left the only caller guessing
58564
+ * — it blamed the subscription for every one of them.
58565
+ */
58375
58566
  async createApplication(options) {
58376
58567
  const res = await fetch(`${this.baseUrl}/applications`, {
58377
58568
  method: "POST",
@@ -58379,9 +58570,17 @@ var ApplicationClient = class {
58379
58570
  body: JSON.stringify(options)
58380
58571
  });
58381
58572
  if (!res.ok) {
58382
- return null;
58573
+ const body = await res.json().catch(() => ({}));
58574
+ throw new UpstreamRequestError(
58575
+ "APP_CREATE_FAILED",
58576
+ body.error ?? body.message ?? `Request failed with status ${String(res.status)}`,
58577
+ res.status
58578
+ );
58383
58579
  }
58384
58580
  const json = await res.json();
58581
+ if (json.data === null) {
58582
+ throw new UpstreamRequestError("APP_CREATE_FAILED", "Application was not created", res.status);
58583
+ }
58385
58584
  return json.data;
58386
58585
  }
58387
58586
  async getApplication(id) {
@@ -58709,17 +58908,17 @@ var AccountClient = class {
58709
58908
  };
58710
58909
 
58711
58910
  // libs/shared/src/utils/validate-identifier.ts
58712
- var import_common8 = __toESM(require_common2());
58911
+ var import_common9 = __toESM(require_common2());
58713
58912
 
58714
58913
  // libs/shared/src/utils/environment.ts
58715
58914
  var ENVIRONMENT_NAMES = ["dev", "staging", "production"];
58716
58915
 
58717
58916
  // libs/shared/src/utils/org-ownership.ts
58718
- var import_common9 = __toESM(require_common2());
58917
+ var import_common10 = __toESM(require_common2());
58719
58918
 
58720
58919
  // libs/shared/src/utils/rate-limit.ts
58721
- var import_common10 = __toESM(require_common2());
58722
- var logger = new import_common10.Logger("RateLimiter");
58920
+ var import_common11 = __toESM(require_common2());
58921
+ var logger = new import_common11.Logger("RateLimiter");
58723
58922
 
58724
58923
  // libs/shared/src/utils/session-store.ts
58725
58924
  var import_crypto4 = require("crypto");
@@ -58877,6 +59076,79 @@ var NOTIFICATION_TYPES = {
58877
59076
  body: (x) => `A payment of ${v(x, "amount")} failed. Update your payment method to avoid suspension.`,
58878
59077
  target: invoicesTarget
58879
59078
  },
59079
+ // The check could not reach the application twice in a row. Free on every
59080
+ // plan: a platform that knows an application is unreachable and does not
59081
+ // mention it is worse than one that never looked.
59082
+ "app.unreachable": {
59083
+ key: "app.unreachable",
59084
+ category: "deploy",
59085
+ severity: "error",
59086
+ audience: "members",
59087
+ inAppDefault: true,
59088
+ emailDefault: true,
59089
+ emailTemplateId: "app-unreachable",
59090
+ title: (x) => `${v(x, "appName")} is not responding`,
59091
+ body: (x) => `${v(x, "appName")} (${v(x, "environment")}) did not answer two checks in a row: ${v(x, "detail")}. A sleeping environment is never reported this way, so this is the application itself.`,
59092
+ target: () => null
59093
+ },
59094
+ // A log-based alert rule tripped. One type for every rule rather than one
59095
+ // per key: the rule already words itself, and a per-key type would mean a
59096
+ // registry entry and an email template for each new rule.
59097
+ //
59098
+ // Email is off by default — a rule with a low threshold can trip often, and
59099
+ // an inbox is the wrong place for that. Slack, Teams and webhooks carry the
59100
+ // urgent path; this is the record.
59101
+ "app.alert_rule": {
59102
+ key: "app.alert_rule",
59103
+ category: "deploy",
59104
+ severity: "warning",
59105
+ audience: "members",
59106
+ inAppDefault: true,
59107
+ emailDefault: false,
59108
+ emailTemplateId: null,
59109
+ title: (x) => `${v(x, "appName")}: ${v(x, "ruleLabel")}`,
59110
+ body: (x) => `${v(x, "detail")} on ${v(x, "environment")}.`,
59111
+ target: () => null
59112
+ },
59113
+ "app.recovered": {
59114
+ key: "app.recovered",
59115
+ category: "deploy",
59116
+ severity: "success",
59117
+ audience: "members",
59118
+ inAppDefault: true,
59119
+ emailDefault: true,
59120
+ emailTemplateId: "app-recovered",
59121
+ title: (x) => `${v(x, "appName")} is responding again`,
59122
+ body: (x) => `${v(x, "appName")} (${v(x, "environment")}) is answering again after ${v(x, "downFor")}.`,
59123
+ target: () => null
59124
+ },
59125
+ // The application has shipped most of, or all of, what its log tier allows
59126
+ // today. Worth saying out loud: passing the cap stops RETENTION, and a user
59127
+ // who does not know that reads the gap as lost logs rather than a limit.
59128
+ "usage.logs.nearing": {
59129
+ key: "usage.logs.nearing",
59130
+ category: "usage",
59131
+ severity: "warning",
59132
+ audience: "members",
59133
+ inAppDefault: true,
59134
+ emailDefault: false,
59135
+ emailTemplateId: null,
59136
+ title: (x) => `${v(x, "appId")} is near its daily log allowance`,
59137
+ body: (x) => `${v(x, "appId")} (${v(x, "environment")}) has used most of today's log allowance. Past it, new logs are not retained until tomorrow \u2014 the live tail keeps working either way.`,
59138
+ target: () => null
59139
+ },
59140
+ "usage.logs.reached": {
59141
+ key: "usage.logs.reached",
59142
+ category: "usage",
59143
+ severity: "warning",
59144
+ audience: "members",
59145
+ inAppDefault: true,
59146
+ emailDefault: false,
59147
+ emailTemplateId: null,
59148
+ title: (x) => `${v(x, "appId")} reached its daily log allowance`,
59149
+ body: (x) => `${v(x, "appId")} (${v(x, "environment")}) has used today's log allowance, so new logs are not retained until tomorrow. The live tail is unaffected. If this happens often the application is probably logging in a loop, or the tier is too small for it.`,
59150
+ target: () => null
59151
+ },
58880
59152
  // Owner/admin confirmation that the org is scheduled for deletion, with the window.
58881
59153
  "org.erasure.scheduled": {
58882
59154
  key: "org.erasure.scheduled",
@@ -59081,6 +59353,9 @@ var tools = [
59081
59353
  function authHeaders(token) {
59082
59354
  return { Authorization: `Bearer ${token}`, "Content-Type": "application/json" };
59083
59355
  }
59356
+ function ok(data) {
59357
+ return { content: [{ type: "text", text: JSON.stringify({ success: true, data, error: null }) }] };
59358
+ }
59084
59359
  function notAuthenticatedResult() {
59085
59360
  return fail({ status: 401, message: "Please sign in first. Use org_request_otp and org_verify_otp to authenticate." });
59086
59361
  }
@@ -59319,9 +59594,20 @@ async function handleAppCreate(args) {
59319
59594
  orgId: args["orgId"],
59320
59595
  ...args["templateId"] !== void 0 ? { templateId: args["templateId"] } : {}
59321
59596
  };
59322
- const app = await appClient(token).createApplication(createOptions);
59323
- if (!app) {
59324
- return fail({ code: "APP_CREATE_FAILED", message: "Failed to create application.", hint: "Usually a plan limit (check org_get_subscription) or an invalid name (lowercase letters, numbers, hyphens only)." });
59597
+ let app;
59598
+ try {
59599
+ app = await appClient(token).createApplication(createOptions);
59600
+ } catch (err) {
59601
+ if (err instanceof UpstreamRequestError) {
59602
+ const planLimited = /plan allows|upgrade/i.test(err.message);
59603
+ return fail({
59604
+ ...err.status !== void 0 ? { status: err.status } : {},
59605
+ code: "APP_CREATE_FAILED",
59606
+ message: err.message,
59607
+ ...planLimited ? { hint: "This is a plan limit \u2014 check the subscription with org_get_subscription." } : {}
59608
+ });
59609
+ }
59610
+ throw err;
59325
59611
  }
59326
59612
  const billing = await describeApplicationCharge(createOptions.orgId, token);
59327
59613
  return {
@@ -59365,8 +59651,8 @@ var appDeleteTool = {
59365
59651
  };
59366
59652
  async function handleAppDelete(args) {
59367
59653
  const id = args["applicationId"];
59368
- const ok3 = await appClient(args["token"]).deleteApplication(id);
59369
- if (!ok3) {
59654
+ const ok2 = await appClient(args["token"]).deleteApplication(id);
59655
+ if (!ok2) {
59370
59656
  return fail({ code: "APP_DELETE_FAILED", message: `Could not delete application ${id}.`, hint: "Check the application ID and that you own it. It may already be deleted." });
59371
59657
  }
59372
59658
  return {
@@ -60475,15 +60761,9 @@ var tools11 = [
60475
60761
  ];
60476
60762
 
60477
60763
  // apps/mcp-server/src/tools/node-tiers.ts
60478
- function authHeaders2(token) {
60479
- return { "Content-Type": "application/json", Authorization: `Bearer ${token}` };
60480
- }
60481
- function ok(data) {
60482
- return { content: [{ type: "text", text: JSON.stringify({ success: true, data, error: null }) }] };
60483
- }
60484
60764
  async function getJson(url, token) {
60485
60765
  try {
60486
- const res = await fetch(url, { headers: authHeaders2(token) });
60766
+ const res = await fetch(url, { headers: authHeaders(token) });
60487
60767
  if (!res.ok) {
60488
60768
  return null;
60489
60769
  }
@@ -60589,7 +60869,7 @@ async function handleAppSetNodeTier(args) {
60589
60869
  try {
60590
60870
  res = await fetch(`${config2.services.applicationServiceUrl}/applications/${encodeURIComponent(applicationId)}/nodes`, {
60591
60871
  method: "POST",
60592
- headers: authHeaders2(token),
60872
+ headers: authHeaders(token),
60593
60873
  body: JSON.stringify({ environment, nodeTierId, regionId })
60594
60874
  });
60595
60875
  } catch (err) {
@@ -60989,13 +61269,137 @@ async function handleAppServiceLogs(args) {
60989
61269
  isError: !res.ok
60990
61270
  };
60991
61271
  }
61272
+ var appSearchLogsTool = {
61273
+ name: "app_search_logs",
61274
+ description: `Search an application's RETAINED logs \u2014 including logs from containers that have since restarted, and from nodes that are stopped. Use this rather than app_service_logs when investigating something that already happened: "what did it say at 3am", "has this error appeared before", "what changed after the deploy". Matches a substring by default, or a regular expression with regex: true. Returns newest first.`,
61275
+ annotations: { readOnlyHint: true, destructiveHint: false },
61276
+ inputSchema: {
61277
+ type: "object",
61278
+ properties: {
61279
+ token: { type: "string", description: "JWT session token from org_verify_otp" },
61280
+ applicationId: { type: "string", description: "The application UUID" },
61281
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Environment to search" },
61282
+ query: { type: "string", description: "Substring to match, or a regular expression when regex is true. Omit to return everything in the window." },
61283
+ regex: { type: "boolean", description: "Treat query as a regular expression" },
61284
+ service: { type: "string", description: "Limit to one compose service" },
61285
+ minutes: { type: "number", description: "How far back to search, in minutes. Defaults to 60." },
61286
+ limit: { type: "number", description: "Maximum lines to return, up to 1000. Defaults to 200." }
61287
+ },
61288
+ required: ["token", "applicationId", "environment"]
61289
+ }
61290
+ };
61291
+ var appRecentErrorsTool = {
61292
+ name: "app_recent_errors",
61293
+ description: "The most recent error lines from an application environment, across every service, from retained logs. Use this first when a user reports something is broken, when a deploy has just gone out, or before claiming an application is healthy. Matches common error markers (error, exception, fatal, traceback, unhandled) case-insensitively.",
61294
+ annotations: { readOnlyHint: true, destructiveHint: false },
61295
+ inputSchema: {
61296
+ type: "object",
61297
+ properties: {
61298
+ token: { type: "string", description: "JWT session token from org_verify_otp" },
61299
+ applicationId: { type: "string", description: "The application UUID" },
61300
+ environment: { type: "string", enum: [...ENVIRONMENT_NAMES], description: "Environment to inspect" },
61301
+ minutes: { type: "number", description: "How far back to look, in minutes. Defaults to 60." }
61302
+ },
61303
+ required: ["token", "applicationId", "environment"]
61304
+ }
61305
+ };
61306
+ var ERROR_PATTERN = "(?i)(error|exception|fatal|traceback|unhandled|panic:)";
61307
+ async function searchRetained(args, overrides = {}) {
61308
+ const token = args["token"];
61309
+ if (!token) {
61310
+ return notAuthenticatedResult();
61311
+ }
61312
+ const applicationId = args["applicationId"];
61313
+ const environment = args["environment"];
61314
+ const app = await resolveApp2(applicationId, token);
61315
+ if (!app) {
61316
+ return appNotFoundResult(applicationId);
61317
+ }
61318
+ const minutes = typeof args["minutes"] === "number" ? args["minutes"] : 60;
61319
+ const to = Date.now();
61320
+ const from = to - Math.max(1, minutes) * 6e4;
61321
+ const params = new URLSearchParams({ from: String(from), to: String(to) });
61322
+ const query = overrides.query ?? (typeof args["query"] === "string" ? args["query"] : "");
61323
+ if (query !== "") {
61324
+ params.set("q", query);
61325
+ }
61326
+ if ((overrides.regex ?? args["regex"]) === true) {
61327
+ params.set("regex", "true");
61328
+ }
61329
+ if (typeof args["service"] === "string" && args["service"] !== "") {
61330
+ params.set("service", args["service"]);
61331
+ }
61332
+ if (typeof args["limit"] === "number") {
61333
+ params.set("limit", String(args["limit"]));
61334
+ }
61335
+ const url = agentUrl2(app.orgId, app.id, environment, `/logs/search?${params.toString()}`);
61336
+ const res = await fetch(url, { headers: authHeaders(token) });
61337
+ const json = await res.json();
61338
+ if (!res.ok) {
61339
+ return { content: [{ type: "text", text: `Error: ${json.error ?? res.statusText}` }], isError: true };
61340
+ }
61341
+ const hits = json.data?.hits ?? [];
61342
+ if (hits.length === 0) {
61343
+ return {
61344
+ content: [{
61345
+ type: "text",
61346
+ text: `No matching lines in the last ${String(minutes)} minutes. Retained logs only reach back as far as this application's retention window, so an older event may simply be gone.`
61347
+ }]
61348
+ };
61349
+ }
61350
+ const rendered = hits.map((h) => `${new Date(h.ts).toISOString()} [${h.service}] ${h.line}`).join("\n");
61351
+ return {
61352
+ content: [
61353
+ { type: "text", text: JSON.stringify({ matches: hits.length, truncated: json.data?.truncated ?? false }) },
61354
+ { type: "text", text: untrustedBlock(rendered, "retained container logs") }
61355
+ ]
61356
+ };
61357
+ }
61358
+ async function handleAppSearchLogs(args) {
61359
+ return searchRetained(args);
61360
+ }
61361
+ async function handleAppRecentErrors(args) {
61362
+ return searchRetained(args, { query: ERROR_PATTERN, regex: true });
61363
+ }
61364
+ var appHealthTool = {
61365
+ name: "app_health",
61366
+ description: `What the platform's uptime check last saw for each of an application's environments: up, down, asleep or unknown, since when, and the last error. Use before claiming an application is healthy, and when a user says "it is broken" \u2014 an environment reported asleep was stopped deliberately to save money and is not an outage.`,
61367
+ annotations: { readOnlyHint: true, destructiveHint: false },
61368
+ inputSchema: {
61369
+ type: "object",
61370
+ properties: {
61371
+ token: { type: "string", description: "JWT session token from org_verify_otp" },
61372
+ applicationId: { type: "string", description: "The application UUID" }
61373
+ },
61374
+ required: ["token", "applicationId"]
61375
+ }
61376
+ };
61377
+ async function handleAppHealth(args) {
61378
+ const token = args["token"];
61379
+ if (!token) {
61380
+ return notAuthenticatedResult();
61381
+ }
61382
+ const applicationId = args["applicationId"];
61383
+ const res = await fetch(
61384
+ `${config2.services.applicationServiceUrl}/applications/${encodeURIComponent(applicationId)}/health`,
61385
+ { headers: authHeaders(token) }
61386
+ );
61387
+ const json = await res.json();
61388
+ if (!res.ok) {
61389
+ return { content: [{ type: "text", text: `Error: ${json.error ?? res.statusText}` }], isError: true };
61390
+ }
61391
+ return { content: [{ type: "text", text: JSON.stringify(json.data, null, 2) }] };
61392
+ }
60992
61393
  var tools15 = [
60993
61394
  { definition: appServicesListTool, handle: handleAppServicesList },
60994
61395
  { definition: appServiceStartTool, handle: handleAppServiceStart },
60995
61396
  { definition: appServiceStopTool, handle: handleAppServiceStop },
60996
61397
  { definition: appServiceRestartTool, handle: handleAppServiceRestart },
60997
61398
  { definition: appServiceLogsTool, handle: handleAppServiceLogs },
60998
- { definition: appServiceTailLogsTool, handle: handleAppServiceTailLogs }
61399
+ { definition: appServiceTailLogsTool, handle: handleAppServiceTailLogs },
61400
+ { definition: appSearchLogsTool, handle: handleAppSearchLogs },
61401
+ { definition: appRecentErrorsTool, handle: handleAppRecentErrors },
61402
+ { definition: appHealthTool, handle: handleAppHealth }
60999
61403
  ];
61000
61404
 
61001
61405
  // apps/mcp-server/src/tools/templates.ts
@@ -61055,8 +61459,8 @@ async function handleOrgApplyTemplate(args) {
61055
61459
  if (!appId || !templateId) {
61056
61460
  return fail({ status: 400, message: "appId and templateId are required." });
61057
61461
  }
61058
- const ok3 = await appClient2(token).applyTemplate(appId, templateId);
61059
- if (!ok3) {
61462
+ const ok2 = await appClient2(token).applyTemplate(appId, templateId);
61463
+ if (!ok2) {
61060
61464
  return fail({ code: "TEMPLATE_APPLY_FAILED", message: "Failed to apply template.", hint: "Check that the application ID and template ID are correct." });
61061
61465
  }
61062
61466
  return {
@@ -61072,9 +61476,6 @@ var tools16 = [
61072
61476
  function appClient3(token) {
61073
61477
  return new ApplicationClient(config2.services.applicationServiceUrl, token);
61074
61478
  }
61075
- function ok2(data) {
61076
- return { content: [{ type: "text", text: JSON.stringify({ success: true, data, error: null }) }] };
61077
- }
61078
61479
  var appSetUpstreamTool = {
61079
61480
  name: "app_set_upstream",
61080
61481
  description: "Point an application at a git repository you host yourself, using a remote repository connection you have already created. Create that connection first with org_add_git_connection, and find its id with org_list_git_connections \u2014 the credential lives on the connection, so this call takes only the repository path within its host and the branch. WARNING: this is destructive to the platform-hosted repository. On the next deploy the platform force-fetches your repository over its mirror, so any commit that exists only in the platform-hosted repository is lost. Afterwards pushes to it are refused and templates can no longer be applied \u2014 push to your own repository instead. Returns the list of branches found in the repository.",
@@ -61124,7 +61525,7 @@ async function handleAppSetUpstream(args) {
61124
61525
  }
61125
61526
  try {
61126
61527
  const result = await appClient3(token).setUpstream(applicationId, { connectionId, path, branch });
61127
- return ok2(result);
61528
+ return ok(result);
61128
61529
  } catch (err) {
61129
61530
  if (err instanceof UpstreamRequestError) {
61130
61531
  return fail(upstreamFailureDetail(err));
@@ -61210,7 +61611,7 @@ async function handleOrgAddGitConnection(args) {
61210
61611
  ...args["username"] !== void 0 ? { username: args["username"] } : {},
61211
61612
  ...args["accessToken"] !== void 0 ? { token: args["accessToken"] } : {}
61212
61613
  });
61213
- return ok2(connection);
61614
+ return ok(connection);
61214
61615
  } catch (err) {
61215
61616
  if (err instanceof UpstreamRequestError) {
61216
61617
  return fail(upstreamFailureDetail(err));
@@ -61244,7 +61645,7 @@ async function handleAppClearUpstream(args) {
61244
61645
  if (!okResult) {
61245
61646
  return fail({ code: "NOT_FOUND", message: "Could not clear the upstream for that application.", hint: "Check the applicationId with app_list." });
61246
61647
  }
61247
- return ok2(null);
61648
+ return ok(null);
61248
61649
  }
61249
61650
  var orgListGitConnectionsTool = {
61250
61651
  name: "org_list_git_connections",
@@ -61269,7 +61670,7 @@ async function handleOrgListGitConnections(args) {
61269
61670
  return fail({ code: "INVALID_INPUT", message: "orgId is required", hint: "Use the orgId from org_verify_otp." });
61270
61671
  }
61271
61672
  const connections = await appClient3(token).listGitConnections(orgId);
61272
- return ok2(connections);
61673
+ return ok(connections);
61273
61674
  }
61274
61675
  var tools17 = [
61275
61676
  { definition: appSetUpstreamTool, handle: handleAppSetUpstream },
package/package.json CHANGED
@@ -1,11 +1,22 @@
1
1
  {
2
2
  "name": "@syntica/mcp",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Claude Code MCP server and skills for deploying applications on Syntica",
5
+ "mcpName": "io.syntica/mcp",
5
6
  "bin": {
6
7
  "syntica-mcp": "./dist/index.js"
7
8
  },
8
9
  "homepage": "https://syntica.io",
10
+ "keywords": [
11
+ "mcp",
12
+ "mcp-server",
13
+ "model-context-protocol",
14
+ "claude-code",
15
+ "deployment",
16
+ "docker-compose",
17
+ "paas",
18
+ "syntica"
19
+ ],
9
20
  "files": [
10
21
  "dist/",
11
22
  "skills/"
@@ -68,8 +68,14 @@ Two that are worth knowing:
68
68
  on 465, STARTTLS otherwise.
69
69
 
70
70
  Send, post or authenticate only as the identity the connection carries
71
- (`MAIL_FROM`, the granted channel, the granted site). Anything else is rejected by
72
- the vendor, or scoped away by the platform.
71
+ (`MAIL_FROM`, the granted channel, the granted site). Pin it: read the identity
72
+ from the injected variable, never from user input or a request parameter.
73
+
74
+ **The platform does not enforce this for you.** A Microsoft 365 app registration
75
+ can send as any mailbox in the tenant unless the organisation has added an
76
+ `ApplicationAccessPolicy`, and the platform neither creates nor verifies one. If
77
+ the code you are writing needs to act as anything other than the injected
78
+ identity, stop and raise it with the user rather than implementing it.
73
79
 
74
80
  ## Step 4 — Fail loudly when the variables are absent
75
81
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: syntica-debug
3
- description: Diagnose a deployed application on Syntica — list running services with status and resource use, tail logs, restart a service. Use when an app deployed to Syntica is down, erroring, returning 500s, crash-looping or behaving unexpectedly, or when the user asks to check logs or restart a service.
3
+ description: Diagnose a deployed application on Syntica — list running services with status and resource use, search retained logs and read errors from after a crash or restart, tail live output, restart a service. Use when an app deployed to Syntica is down, erroring, returning 500s, crash-looping or behaving unexpectedly, or when the user asks to check logs or restart a service.
4
4
  ---
5
5
 
6
6
  # Syntica Debug
@@ -62,9 +62,29 @@ If there are multiple services, ask: "Which service would you like to debug? (<l
62
62
 
63
63
  ---
64
64
 
65
- ## Step 4 — Tail logs
65
+ ## Step 4 — Read the logs
66
66
 
67
- Call `app_service_tail_logs` with:
67
+ **Start with `app_recent_errors`** unless the user is watching something happen
68
+ right now. It searches *retained* logs across every service, so it works when the
69
+ container has restarted since, and when the node is stopped — which is exactly
70
+ the state an application is in the morning after it broke.
71
+
72
+ ```json
73
+ {
74
+ "token": "<token>",
75
+ "applicationId": "<appId>",
76
+ "environment": "<environment>",
77
+ "minutes": 60
78
+ }
79
+ ```
80
+
81
+ Widen `minutes` if nothing comes back, and use `app_search_logs` when you know
82
+ what you are looking for — a route, an order id, a message from a stack trace.
83
+ Retention only reaches back as far as this application's window, so "nothing
84
+ found" can mean the event is older than the window rather than that it never
85
+ happened. Say which you mean.
86
+
87
+ Then, to follow what is happening **now**, call `app_service_tail_logs` with:
68
88
  ```json
69
89
  {
70
90
  "token": "<token>",