@pitcher/cli-scripts 3.1.0 → 3.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 +1 -1
- package/dist/src/commands/metadataTemplate.js +3 -2
- package/dist/src/core/pitcherAuth.d.ts +0 -7
- package/dist/src/core/pitcherAuth.js +0 -3
- package/dist/src/mcp/hosted.js +1 -1
- package/dist/src/mcp/index.d.ts +1 -1
- package/dist/src/mcp/index.js +1 -1
- package/dist/src/mcp/server.d.ts +1 -0
- package/dist/src/mcp/server.js +4 -4
- package/dist/src/mcp/tools/metadataTemplate.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -502,7 +502,7 @@ p metadata-template scaffold --out ./schema.json
|
|
|
502
502
|
p metadata-template upsert --instance-id 01... --sections-file ./schema.json --api-key myapikey
|
|
503
503
|
```
|
|
504
504
|
|
|
505
|
-
`upsert` merges the incoming sections by section `label` — a section whose label matches an existing one is replaced, other sections are preserved. It
|
|
505
|
+
`upsert` merges the incoming sections by section `label` — a section whose label matches an existing one is **replaced whole** (fields left out of it are removed), other sections are preserved. It cannot remove a whole section (that's a UI operation). `options` for `select`/`multi-select` fields are `{ label, value }` objects (bare strings are rejected). `upsert` requires an instance- or org-admin key; a non-admin member key is rejected (400 → `VALIDATION`).
|
|
506
506
|
|
|
507
507
|
## To run the `dsr` command:
|
|
508
508
|
|
|
@@ -69,8 +69,9 @@ export async function runMetadataTemplateUpsert(opts, deps = {}) {
|
|
|
69
69
|
const UPSERT_HELP = `
|
|
70
70
|
Upserts the instance's metadata-field schema. POST is an upsert keyed by
|
|
71
71
|
instance that MERGES the incoming sections by section 'label' — a section whose
|
|
72
|
-
label matches an existing one is replaced
|
|
73
|
-
|
|
72
|
+
label matches an existing one is replaced whole (fields left out of it are
|
|
73
|
+
removed), other sections are preserved. It cannot remove a whole section (a
|
|
74
|
+
full-replace / UI operation).
|
|
74
75
|
--instance-id the instance whose schema to upsert (required)
|
|
75
76
|
--sections inline JSON array of sections, OR
|
|
76
77
|
--sections-file path to a JSON file with the sections array (exactly one)
|
|
@@ -28,8 +28,6 @@ export declare function orgSubdomain(domain: string): string;
|
|
|
28
28
|
* in step when a tenant is added.
|
|
29
29
|
*/
|
|
30
30
|
export declare const AUTH0_NATIVE_CLIENT_IDS: Readonly<Record<string, string>>;
|
|
31
|
-
/** The hosted MCP connector's access for an org (`pitcher_organization.settings.mcp.access`, PIT-9768). */
|
|
32
|
-
export type McpAccess = 'off' | 'read_only' | 'full';
|
|
33
31
|
export interface OrgConfig {
|
|
34
32
|
/** The Auth0 CUSTOM domain (`auth0.test-eu.pitcher.com`) — the key into the client-id maps. */
|
|
35
33
|
auth0Domain: string;
|
|
@@ -38,11 +36,6 @@ export interface OrgConfig {
|
|
|
38
36
|
organization: string | null;
|
|
39
37
|
/** `'test' | 'production'`. OPTIONAL upstream: treat unknown as production. */
|
|
40
38
|
environment?: string;
|
|
41
|
-
/**
|
|
42
|
-
* undefined = UNKNOWN: next-core's org lookup failed, or that region's next-core predates the field. Never
|
|
43
|
-
* read it as "off" and never as "on" — the hosted server retries or refuses (`mcp-server` `src/oauth/access.ts`).
|
|
44
|
-
*/
|
|
45
|
-
mcpAccess?: McpAccess;
|
|
46
39
|
}
|
|
47
40
|
export interface Auth0Tokens {
|
|
48
41
|
access_token: string;
|
|
@@ -38,7 +38,6 @@ export const AUTH0_NATIVE_CLIENT_IDS = {
|
|
|
38
38
|
'auth0.test-us.pitcher.com': 'sd6biLE9qGBwUfSzl2uRC1p5JdhKY06N',
|
|
39
39
|
'auth0.us.pitcher.com': 'k6BgMI2Oy26RnyucUsWiL81JOeaufECm',
|
|
40
40
|
};
|
|
41
|
-
const MCP_ACCESS = new Set(['off', 'read_only', 'full']);
|
|
42
41
|
export function createUpstreamError(kind, message) {
|
|
43
42
|
return Object.assign(new Error(message), { isUpstreamError: true, kind });
|
|
44
43
|
}
|
|
@@ -98,8 +97,6 @@ export async function fetchOrgConfig(domain, opts = {}) {
|
|
|
98
97
|
audience: a.audience,
|
|
99
98
|
organization: typeof a.organization === 'string' && a.organization ? a.organization : null,
|
|
100
99
|
environment: typeof json.environment === 'string' ? json.environment : undefined,
|
|
101
|
-
// A value outside the three is a newer next-core than this code: refuse it like "off", not like unknown.
|
|
102
|
-
mcpAccess: typeof json.mcp?.access === 'string' ? (MCP_ACCESS.has(json.mcp.access) ? json.mcp.access : 'off') : undefined,
|
|
103
100
|
};
|
|
104
101
|
}
|
|
105
102
|
async function postJson(url, body, opts) {
|
package/dist/src/mcp/hosted.js
CHANGED
|
@@ -50,7 +50,7 @@ const HOSTED_DESCRIPTIONS = {
|
|
|
50
50
|
pitcher_files_update: 'Update a file by ID (name, folder, access, tags, metadata). sourceUrl replaces/overwrites the file binary; metadata is deep-merged.',
|
|
51
51
|
pitcher_announcements_create: 'Create a wa-announcements appsDB record (title/body, optional media, CTA link, scheduling, group targeting). Requires title and body. Additive.',
|
|
52
52
|
pitcher_dsr_create: 'Create a Digital Sales Room (a canvas share link) and get a clickable link back. Source is a canvas (canvasId) OR files (shareboxFileIds) - exactly one. Optional email/domain gating and a bound landing-page template. Returns the share: id, url (the full link), short_url, and a nested canvas object - there is no full_url field. This endpoint is a GET-OR-CREATE: sharing an already-shared canvas returns the existing link and only updates the fields you pass, so use pitcher_dsr_update to change or remove a value on an existing share. A failed landing bind does not fail the call: it returns the link with a warning - and binding a landing page needs instanceId, without which the bind is skipped with that warning. tags are a ShareBox-only field (they name the canvas the server builds from shareboxFileIds), so non-empty tags together with canvasId are REJECTED rather than silently dropped by the server.',
|
|
53
|
-
pitcher_metadata_template_upsert: "Upsert an instance's metadata-field schema. Merges the incoming sections by section 'label' — a section whose label matches an existing one is
|
|
53
|
+
pitcher_metadata_template_upsert: "Upsert an instance's metadata-field schema. Merges the incoming sections by section 'label' — a section whose label matches an existing one is REPLACED WHOLE (fields left out of it are removed), other sections are preserved. Cannot remove a whole section. To add a field, send the section with all its existing fields plus the new one. Requires an instance- or org-admin role.",
|
|
54
54
|
};
|
|
55
55
|
// Field descriptions that name a stripped key, rewritten for hosted (`tool name → field → text`).
|
|
56
56
|
const HOSTED_FIELD_DESCRIPTIONS = {
|
package/dist/src/mcp/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildServer, type McpRunContext, type BuildServerOptions } from './server.js';
|
|
1
|
+
export { buildServer, PITCHER_ICON, type McpRunContext, type BuildServerOptions } from './server.js';
|
|
2
2
|
export { hostedTools, hostedReadOnlyTools, readOnlyPrompts, LOCAL_ONLY, FILE_KEY, ID_KEY, HOSTED_BUILD_OPTIONS, } from './hosted.js';
|
|
3
3
|
export { allTools } from './registry.js';
|
|
4
4
|
export { allPrompts } from './prompts/registry.js';
|
package/dist/src/mcp/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Public entry `@pitcher/cli-scripts/mcp` — what the hosted MCP server (web/packages/mcp-server) consumes.
|
|
2
|
-
export { buildServer } from './server.js';
|
|
2
|
+
export { buildServer, PITCHER_ICON } from './server.js';
|
|
3
3
|
export { hostedTools, hostedReadOnlyTools, readOnlyPrompts, LOCAL_ONLY, FILE_KEY, ID_KEY, HOSTED_BUILD_OPTIONS, } from './hosted.js';
|
|
4
4
|
export { allTools } from './registry.js';
|
|
5
5
|
export { allPrompts } from './prompts/registry.js';
|
package/dist/src/mcp/server.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Credential } from '../core/credential.js';
|
|
|
3
3
|
import type { ToolDescriptor } from './tools/types.js';
|
|
4
4
|
import type { PromptDescriptor } from './prompts/types.js';
|
|
5
5
|
import type { ResourceDescriptor } from './resources/types.js';
|
|
6
|
+
export declare const PITCHER_ICON = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiI+PHJlY3Qgd2lkdGg9IjUxMiIgaGVpZ2h0PSI1MTIiIHJ4PSIxMTYiIGZpbGw9IiMyOTMzNUMiLz48Y2lyY2xlIGN4PSIzNzIiIGN5PSIxNTAiIHI9IjMwIiBmaWxsPSIjQ0MwMDAwIi8+PHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTE1MCAxMTZoOTZhOTIgOTIgMCAwIDEgMCAxODRoLTUwdjk2aC00NnoiLz48cGF0aCBmaWxsPSIjMjkzMzVDIiBkPSJNMTk2IDE2MHY5Nmg1MGE0OCA0OCAwIDAgMCAwLTk2eiIvPjwvc3ZnPg==";
|
|
6
7
|
/**
|
|
7
8
|
* The per-server request context: who every tool call runs as, and against which origin.
|
|
8
9
|
* Captured at build time — local stdio `p mcp` builds one from the `p login` session; the hosted server
|
package/dist/src/mcp/server.js
CHANGED
|
@@ -18,10 +18,10 @@ const version = (() => {
|
|
|
18
18
|
return '0.0.0';
|
|
19
19
|
}
|
|
20
20
|
})();
|
|
21
|
-
// Connector branding shown by MCP hosts (Claude Desktop, Cursor).
|
|
22
|
-
// data URI so it needs no network/asset resolution: a navy (#29335C) tile with a
|
|
21
|
+
// Connector branding shown by MCP hosts (Claude Desktop, Cursor) and on the hosted server's own pages.
|
|
22
|
+
// Self-contained data URI so it needs no network/asset resolution: a navy (#29335C) tile with a
|
|
23
23
|
// white "P" and the Pitcher-red (#CC0000) accent from the wordmark.
|
|
24
|
-
const
|
|
24
|
+
export const PITCHER_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiI+PHJlY3Qgd2lkdGg9IjUxMiIgaGVpZ2h0PSI1MTIiIHJ4PSIxMTYiIGZpbGw9IiMyOTMzNUMiLz48Y2lyY2xlIGN4PSIzNzIiIGN5PSIxNTAiIHI9IjMwIiBmaWxsPSIjQ0MwMDAwIi8+PHBhdGggZmlsbD0iI2ZmZmZmZiIgZD0iTTE1MCAxMTZoOTZhOTIgOTIgMCAwIDEgMCAxODRoLTUwdjk2aC00NnoiLz48cGF0aCBmaWxsPSIjMjkzMzVDIiBkPSJNMTk2IDE2MHY5Nmg1MGE0OCA0OCAwIDAgMCAwLTk2eiIvPjwvc3ZnPg==';
|
|
25
25
|
// Compact, sanitized error string (no raw stack) — shared by the prompt/resource callbacks.
|
|
26
26
|
function errorText(e) {
|
|
27
27
|
if (isCliError(e))
|
|
@@ -35,7 +35,7 @@ export function buildServer(ctx, tools = allTools, prompts = allPrompts, resourc
|
|
|
35
35
|
title: 'Pitcher',
|
|
36
36
|
description: 'Search, manage, and share Pitcher content, canvases, files, DSRs, and instances.',
|
|
37
37
|
websiteUrl: 'https://www.pitcher.com',
|
|
38
|
-
icons: [{ src:
|
|
38
|
+
icons: [{ src: PITCHER_ICON, mimeType: 'image/svg+xml', sizes: ['any'] }],
|
|
39
39
|
},
|
|
40
40
|
// Surfaced to the host model via InitializeResult.instructions — the analytics answer-rendering
|
|
41
41
|
// policy so a natural-language question gets a right-sized reply (sentence / table / chart /
|
|
@@ -25,8 +25,9 @@ export const metadataTemplateTools = [
|
|
|
25
25
|
name: 'pitcher_metadata_template_upsert',
|
|
26
26
|
title: 'Upsert a metadata template',
|
|
27
27
|
description: "Upsert an instance's metadata-field schema. Merges the incoming sections by section 'label' — a " +
|
|
28
|
-
'section whose label matches an existing one is
|
|
29
|
-
'a section
|
|
28
|
+
'section whose label matches an existing one is REPLACED WHOLE (fields left out of it are removed), other ' +
|
|
29
|
+
'sections are preserved. Cannot remove a whole section. Pass exactly one of sections or sectionsFile. ' +
|
|
30
|
+
'Requires an instance- or org-admin key.',
|
|
30
31
|
inputShape: {
|
|
31
32
|
instanceId: z.string().describe('Instance ID (required)'),
|
|
32
33
|
sections: z.string().optional().describe('Sections JSON array (inline)'),
|