@notus-os/mcp 0.1.16 → 0.1.20
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 +3 -0
- package/dist/bin/notusos-mcp.js +252 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@ Claude Code and remote MCP clients as an interface to notusOS. Published to npm;
|
|
|
5
5
|
Admins get the full tool surface. Non-admin notusOS team members get read-only tools for their assigned clients; write workflows stay in notusOS.
|
|
6
6
|
|
|
7
7
|
Full documentation lives at [www.notusos.com/documentation](https://www.notusos.com/documentation).
|
|
8
|
+
For the private Luca Wetzel workflow that creates scheduled Content Engine posts
|
|
9
|
+
from structured call-breakdown packages, see
|
|
10
|
+
[create_content_engine_post_package](https://www.notusos.com/documentation/create-content-engine-post-package).
|
|
8
11
|
|
|
9
12
|
## Quick start
|
|
10
13
|
|
package/dist/bin/notusos-mcp.js
CHANGED
|
@@ -18807,7 +18807,7 @@ async function safeErrorMessage(res) {
|
|
|
18807
18807
|
return "";
|
|
18808
18808
|
}
|
|
18809
18809
|
}
|
|
18810
|
-
var import_undici, MAX_RETRIES, RETRY_BASE_MS, AGENT_OPTIONS, ApiClient;
|
|
18810
|
+
var import_undici, MAX_RETRIES, RETRY_BASE_MS, READ_ONLY_MUTATION_PATHS, AGENT_OPTIONS, ApiClient;
|
|
18811
18811
|
var init_api_client = __esm({
|
|
18812
18812
|
"src/api-client/index.ts"() {
|
|
18813
18813
|
"use strict";
|
|
@@ -18816,6 +18816,9 @@ var init_api_client = __esm({
|
|
|
18816
18816
|
init_errors();
|
|
18817
18817
|
MAX_RETRIES = 2;
|
|
18818
18818
|
RETRY_BASE_MS = 400;
|
|
18819
|
+
READ_ONLY_MUTATION_PATHS = /* @__PURE__ */ new Set([
|
|
18820
|
+
"/api/mcp/content-engine-post-packages"
|
|
18821
|
+
]);
|
|
18819
18822
|
AGENT_OPTIONS = {
|
|
18820
18823
|
keepAliveTimeout: 1e3,
|
|
18821
18824
|
keepAliveMaxTimeout: 5e3
|
|
@@ -18856,7 +18859,7 @@ var init_api_client = __esm({
|
|
|
18856
18859
|
return this.request("GET", path, opts);
|
|
18857
18860
|
}
|
|
18858
18861
|
post(path, opts = {}) {
|
|
18859
|
-
this.assertCanMutate();
|
|
18862
|
+
this.assertCanMutate(path);
|
|
18860
18863
|
return this.request("POST", path, { ...opts, mutation: opts.mutation ?? true });
|
|
18861
18864
|
}
|
|
18862
18865
|
patch(path, opts = {}) {
|
|
@@ -18871,8 +18874,8 @@ var init_api_client = __esm({
|
|
|
18871
18874
|
this.assertCanMutate();
|
|
18872
18875
|
return this.request("DELETE", path, { ...opts, mutation: opts.mutation ?? true });
|
|
18873
18876
|
}
|
|
18874
|
-
assertCanMutate() {
|
|
18875
|
-
if (this.accessMode === "read_only") {
|
|
18877
|
+
assertCanMutate(path) {
|
|
18878
|
+
if (this.accessMode === "read_only" && !READ_ONLY_MUTATION_PATHS.has(path ?? "")) {
|
|
18876
18879
|
throw new ApiError(
|
|
18877
18880
|
"FORBIDDEN",
|
|
18878
18881
|
403,
|
|
@@ -39668,7 +39671,7 @@ var init_resources = __esm({
|
|
|
39668
39671
|
listResourcesSchema = external_exports.object({ ...clientTarget });
|
|
39669
39672
|
list_resources = {
|
|
39670
39673
|
name: "list_resources",
|
|
39671
|
-
description: "All strategy docs, brand guides, and content pillars enabled in a client's library. Returns id, name, resource_type,
|
|
39674
|
+
description: "All strategy docs, brand guides, and content pillars enabled in a client's library. Returns id, name, resource_type, enabled, timestamps. Use get_resource with an id to fetch the content body.",
|
|
39672
39675
|
inputSchema: listResourcesSchema,
|
|
39673
39676
|
handler: async (args, ctx) => {
|
|
39674
39677
|
return ctx.api.get("/api/resources", { clientContext: toClientContext(args) });
|
|
@@ -40146,9 +40149,10 @@ var init_comments = __esm({
|
|
|
40146
40149
|
// src/tools/content-engine.ts
|
|
40147
40150
|
var content_engine_exports = {};
|
|
40148
40151
|
__export(content_engine_exports, {
|
|
40152
|
+
create_content_engine_post_package: () => create_content_engine_post_package,
|
|
40149
40153
|
get_content_engine: () => get_content_engine
|
|
40150
40154
|
});
|
|
40151
|
-
var getContentEngineSchema, get_content_engine;
|
|
40155
|
+
var getContentEngineSchema, pillarSchema, visualStatusSchema, ideaMediaSchema, createContentEnginePostPackageSchema, get_content_engine, create_content_engine_post_package;
|
|
40152
40156
|
var init_content_engine = __esm({
|
|
40153
40157
|
"src/tools/content-engine.ts"() {
|
|
40154
40158
|
"use strict";
|
|
@@ -40156,6 +40160,93 @@ var init_content_engine = __esm({
|
|
|
40156
40160
|
init_tools();
|
|
40157
40161
|
init_shared();
|
|
40158
40162
|
getContentEngineSchema = external_exports.object({ ...clientTarget });
|
|
40163
|
+
pillarSchema = external_exports.enum(["aspirational", "insightful", "personal", "tactical"]);
|
|
40164
|
+
visualStatusSchema = external_exports.enum([
|
|
40165
|
+
"needs_visual",
|
|
40166
|
+
"visual_in_progress",
|
|
40167
|
+
"visual_review",
|
|
40168
|
+
"visual_revision",
|
|
40169
|
+
"visual_approved"
|
|
40170
|
+
]);
|
|
40171
|
+
ideaMediaSchema = external_exports.object({
|
|
40172
|
+
type: external_exports.enum(["image", "video"]),
|
|
40173
|
+
url: external_exports.string().url(),
|
|
40174
|
+
path: external_exports.string().min(1),
|
|
40175
|
+
fileName: external_exports.string().min(1),
|
|
40176
|
+
fileSize: external_exports.number().nonnegative(),
|
|
40177
|
+
mimeType: external_exports.string().min(1),
|
|
40178
|
+
uploadedAt: external_exports.string().optional()
|
|
40179
|
+
}).strict();
|
|
40180
|
+
createContentEnginePostPackageSchema = external_exports.object({
|
|
40181
|
+
...clientTarget,
|
|
40182
|
+
contentPiece: external_exports.object({
|
|
40183
|
+
title: external_exports.string().min(1).max(200),
|
|
40184
|
+
ideaText: external_exports.string().min(1).max(2e4),
|
|
40185
|
+
ideaExcerpt: external_exports.string().min(1).max(2e3),
|
|
40186
|
+
pillar: pillarSchema,
|
|
40187
|
+
status: external_exports.literal("scheduled"),
|
|
40188
|
+
visualStatus: visualStatusSchema,
|
|
40189
|
+
source: external_exports.object({
|
|
40190
|
+
contentSourceId: external_exports.string().uuid().nullable(),
|
|
40191
|
+
ideaIndex: external_exports.number().int().min(0).nullable(),
|
|
40192
|
+
origin: external_exports.literal("mcp_call_breakdown")
|
|
40193
|
+
}).strict()
|
|
40194
|
+
}).strict(),
|
|
40195
|
+
post: external_exports.object({
|
|
40196
|
+
body: external_exports.string().min(1).max(2e4),
|
|
40197
|
+
sourceType: external_exports.literal("manual"),
|
|
40198
|
+
format: external_exports.enum(["text", "image", "video"]),
|
|
40199
|
+
media: external_exports.object({
|
|
40200
|
+
imageUrls: external_exports.array(external_exports.string().url()).max(20),
|
|
40201
|
+
videoUrl: external_exports.string().url().nullable(),
|
|
40202
|
+
ideaMedia: external_exports.array(ideaMediaSchema).max(20)
|
|
40203
|
+
}).strict(),
|
|
40204
|
+
qualityMetadata: external_exports.object({
|
|
40205
|
+
hook: external_exports.string().min(1).max(1e3),
|
|
40206
|
+
angle: external_exports.string().min(1).max(1e3),
|
|
40207
|
+
targetAudience: external_exports.string().min(1).max(1e3),
|
|
40208
|
+
cta: external_exports.string().max(1e3).nullable(),
|
|
40209
|
+
notes: external_exports.string().max(2e3).nullable()
|
|
40210
|
+
}).strict()
|
|
40211
|
+
}).strict(),
|
|
40212
|
+
schedule: external_exports.object({
|
|
40213
|
+
publishDate: external_exports.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
40214
|
+
calendarStatus: external_exports.literal("scheduled"),
|
|
40215
|
+
publishToLinkedIn: external_exports.literal(false)
|
|
40216
|
+
}).strict(),
|
|
40217
|
+
dryRun: external_exports.boolean().optional()
|
|
40218
|
+
}).strict().superRefine((value, ctx) => {
|
|
40219
|
+
if (value.post.format === "text") {
|
|
40220
|
+
if (value.post.media.imageUrls.length > 0 || value.post.media.videoUrl || value.post.media.ideaMedia.length > 0) {
|
|
40221
|
+
ctx.addIssue({
|
|
40222
|
+
code: external_exports.ZodIssueCode.custom,
|
|
40223
|
+
path: ["post", "media"],
|
|
40224
|
+
message: "Text posts must not include media."
|
|
40225
|
+
});
|
|
40226
|
+
}
|
|
40227
|
+
}
|
|
40228
|
+
if (value.post.format === "image" && value.post.media.videoUrl) {
|
|
40229
|
+
ctx.addIssue({
|
|
40230
|
+
code: external_exports.ZodIssueCode.custom,
|
|
40231
|
+
path: ["post", "media", "videoUrl"],
|
|
40232
|
+
message: "Image posts cannot include videoUrl."
|
|
40233
|
+
});
|
|
40234
|
+
}
|
|
40235
|
+
if (value.post.format === "video" && value.post.media.imageUrls.length > 0) {
|
|
40236
|
+
ctx.addIssue({
|
|
40237
|
+
code: external_exports.ZodIssueCode.custom,
|
|
40238
|
+
path: ["post", "media", "imageUrls"],
|
|
40239
|
+
message: "Video posts cannot include imageUrls."
|
|
40240
|
+
});
|
|
40241
|
+
}
|
|
40242
|
+
if (value.contentPiece.source.contentSourceId === null && value.contentPiece.source.ideaIndex !== null) {
|
|
40243
|
+
ctx.addIssue({
|
|
40244
|
+
code: external_exports.ZodIssueCode.custom,
|
|
40245
|
+
path: ["contentPiece", "source", "ideaIndex"],
|
|
40246
|
+
message: "ideaIndex requires contentSourceId."
|
|
40247
|
+
});
|
|
40248
|
+
}
|
|
40249
|
+
});
|
|
40159
40250
|
get_content_engine = {
|
|
40160
40251
|
name: "get_content_engine",
|
|
40161
40252
|
description: "DFY content-engine view for a client: sources \u2192 extracted ideas \u2192 content pieces \u2192 drafts \u2192 published. Matches the /content-engine page.",
|
|
@@ -40166,7 +40257,19 @@ var init_content_engine = __esm({
|
|
|
40166
40257
|
});
|
|
40167
40258
|
}
|
|
40168
40259
|
};
|
|
40169
|
-
|
|
40260
|
+
create_content_engine_post_package = {
|
|
40261
|
+
name: "create_content_engine_post_package",
|
|
40262
|
+
description: `Luca Wetzel-only workflow: create a scheduled Content Engine post package from a call breakdown. Requires a strict nested JSON package and writes server-derived content_pieces, conversations, posts, calendar, and post-workspace state. Use dryRun=true first to inspect derived internal rows. Required shape: { clientUserId, clientOrganizationId, appMode?, contentPiece: { title, ideaText, ideaExcerpt, pillar: aspirational|insightful|personal|tactical, status: "scheduled", visualStatus, source: { contentSourceId, ideaIndex, origin: "mcp_call_breakdown" } }, post: { body, sourceType: "manual", format: text|image|video, media: { imageUrls, videoUrl, ideaMedia }, qualityMetadata: { hook, angle, targetAudience, cta, notes } }, schedule: { publishDate: "YYYY-MM-DD", calendarStatus: "scheduled", publishToLinkedIn: false }, dryRun? }. Do not provide source_metadata, image_suggestion, suggestion_segments, deleted_at, timestamps, LinkedIn publish internals, or workspace IDs; the server derives them.`,
|
|
40263
|
+
inputSchema: createContentEnginePostPackageSchema,
|
|
40264
|
+
handler: async (args, ctx) => {
|
|
40265
|
+
const { clientUserId, clientOrganizationId, appMode, ...body } = args;
|
|
40266
|
+
return ctx.api.post("/api/mcp/content-engine-post-packages", {
|
|
40267
|
+
body,
|
|
40268
|
+
clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
|
|
40269
|
+
});
|
|
40270
|
+
}
|
|
40271
|
+
};
|
|
40272
|
+
registerTools(get_content_engine, create_content_engine_post_package);
|
|
40170
40273
|
}
|
|
40171
40274
|
});
|
|
40172
40275
|
|
|
@@ -40736,6 +40839,7 @@ var init_feedback = __esm({
|
|
|
40736
40839
|
var analytics_deep_exports = {};
|
|
40737
40840
|
__export(analytics_deep_exports, {
|
|
40738
40841
|
get_analytics_deep_dive: () => get_analytics_deep_dive,
|
|
40842
|
+
get_analytics_posts: () => get_analytics_posts,
|
|
40739
40843
|
get_icp_contacts: () => get_icp_contacts,
|
|
40740
40844
|
get_icp_post_engagement: () => get_icp_post_engagement,
|
|
40741
40845
|
get_linkedin_analytics: () => get_linkedin_analytics,
|
|
@@ -40744,7 +40848,27 @@ __export(analytics_deep_exports, {
|
|
|
40744
40848
|
sync_icp_contacts: () => sync_icp_contacts,
|
|
40745
40849
|
sync_icp_contacts_all: () => sync_icp_contacts_all
|
|
40746
40850
|
});
|
|
40747
|
-
|
|
40851
|
+
function compactAnalyticsPostsResponse(response) {
|
|
40852
|
+
if (!response || typeof response !== "object") return response;
|
|
40853
|
+
const record2 = response;
|
|
40854
|
+
if (!Array.isArray(record2.posts)) return response;
|
|
40855
|
+
return {
|
|
40856
|
+
...record2,
|
|
40857
|
+
posts: record2.posts.map((post) => {
|
|
40858
|
+
if (!post || typeof post !== "object") return post;
|
|
40859
|
+
const postRecord = post;
|
|
40860
|
+
const text = postRecord.text;
|
|
40861
|
+
if (typeof text !== "string" || text.length <= MCP_POST_TEXT_PREVIEW_CHARS) {
|
|
40862
|
+
return post;
|
|
40863
|
+
}
|
|
40864
|
+
return {
|
|
40865
|
+
...postRecord,
|
|
40866
|
+
text: `${text.slice(0, MCP_POST_TEXT_PREVIEW_CHARS)}...TRUNCATED_TEXT(${text.length} chars)`
|
|
40867
|
+
};
|
|
40868
|
+
})
|
|
40869
|
+
};
|
|
40870
|
+
}
|
|
40871
|
+
var getAnalyticsDeepDiveSchema, get_analytics_deep_dive, getAnalyticsPostsSchema, MCP_POST_TEXT_PREVIEW_CHARS, get_analytics_posts, getLinkedinAnalyticsSchema, get_linkedin_analytics, getIcpContactsSchema, get_icp_contacts, syncIcpContactsSchema, sync_icp_contacts, syncIcpContactsAllSchema, sync_icp_contacts_all, listGojiberryCampaignsSchema, list_gojiberry_campaigns, setGojiberryCampaignSchema, set_gojiberry_campaign, getIcpPostSchema, get_icp_post_engagement;
|
|
40748
40872
|
var init_analytics_deep = __esm({
|
|
40749
40873
|
"src/tools/analytics-deep.ts"() {
|
|
40750
40874
|
"use strict";
|
|
@@ -40781,6 +40905,48 @@ var init_analytics_deep = __esm({
|
|
|
40781
40905
|
return Object.fromEntries(entries);
|
|
40782
40906
|
}
|
|
40783
40907
|
};
|
|
40908
|
+
getAnalyticsPostsSchema = external_exports.object({
|
|
40909
|
+
...clientTarget,
|
|
40910
|
+
days: external_exports.number().int().min(1).max(730).optional(),
|
|
40911
|
+
startDate: external_exports.string().optional(),
|
|
40912
|
+
endDate: external_exports.string().optional(),
|
|
40913
|
+
page: external_exports.number().int().min(1).optional(),
|
|
40914
|
+
limit: external_exports.number().int().min(1).max(25).optional(),
|
|
40915
|
+
sortBy: external_exports.enum(["posted_at", "score", "impressions", "likes", "comments", "reposts"]).optional()
|
|
40916
|
+
});
|
|
40917
|
+
MCP_POST_TEXT_PREVIEW_CHARS = 1200;
|
|
40918
|
+
get_analytics_posts = {
|
|
40919
|
+
name: "get_analytics_posts",
|
|
40920
|
+
description: "Paginated LinkedIn analytics posts for a client. Returns up to 25 posts per call with metrics, text preview, Shield-style score fields, total, page, has_more, and next_page. Use this instead of get_analytics_deep_dive when you need more than the first compacted post preview, such as a six-month post export.",
|
|
40921
|
+
inputSchema: getAnalyticsPostsSchema,
|
|
40922
|
+
handler: async (args, ctx) => {
|
|
40923
|
+
const {
|
|
40924
|
+
clientUserId,
|
|
40925
|
+
clientOrganizationId,
|
|
40926
|
+
appMode,
|
|
40927
|
+
days,
|
|
40928
|
+
startDate,
|
|
40929
|
+
endDate,
|
|
40930
|
+
page = 1,
|
|
40931
|
+
limit = 25,
|
|
40932
|
+
sortBy = "posted_at"
|
|
40933
|
+
} = args;
|
|
40934
|
+
const offset = (page - 1) * limit;
|
|
40935
|
+
const query = compact({
|
|
40936
|
+
days: startDate || endDate ? void 0 : days ?? 180,
|
|
40937
|
+
startDate,
|
|
40938
|
+
endDate,
|
|
40939
|
+
limit,
|
|
40940
|
+
offset,
|
|
40941
|
+
sortBy
|
|
40942
|
+
});
|
|
40943
|
+
const response = await ctx.api.get("/api/analytics/posts", {
|
|
40944
|
+
query,
|
|
40945
|
+
clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
|
|
40946
|
+
});
|
|
40947
|
+
return compactAnalyticsPostsResponse(response);
|
|
40948
|
+
}
|
|
40949
|
+
};
|
|
40784
40950
|
getLinkedinAnalyticsSchema = external_exports.object({
|
|
40785
40951
|
...clientTarget,
|
|
40786
40952
|
days: external_exports.number().int().min(1).max(730).optional()
|
|
@@ -40875,22 +41041,25 @@ var init_analytics_deep = __esm({
|
|
|
40875
41041
|
getIcpPostSchema = external_exports.object({
|
|
40876
41042
|
...clientTarget,
|
|
40877
41043
|
postUrn: external_exports.string(),
|
|
40878
|
-
forceRefresh: external_exports.boolean().optional()
|
|
41044
|
+
forceRefresh: external_exports.boolean().optional(),
|
|
41045
|
+
page: external_exports.number().int().min(1).optional(),
|
|
41046
|
+
limit: external_exports.number().int().min(1).max(100).optional()
|
|
40879
41047
|
});
|
|
40880
41048
|
get_icp_post_engagement = {
|
|
40881
41049
|
name: "get_icp_post_engagement",
|
|
40882
|
-
description: "ICP engagement breakdown for a single LinkedIn post URN.
|
|
41050
|
+
description: "Paginated ICP engagement breakdown for a single LinkedIn post URN. Returns up to 100 engagers per page with total, count, has_more, and next_page. Use page/limit to walk giant posts such as Nespresso, Saks, Nike, or Apple until has_more is false.",
|
|
40883
41051
|
inputSchema: getIcpPostSchema,
|
|
40884
41052
|
handler: async (args, ctx) => {
|
|
40885
|
-
const { clientUserId, clientOrganizationId, appMode, postUrn, forceRefresh } = args;
|
|
41053
|
+
const { clientUserId, clientOrganizationId, appMode, postUrn, forceRefresh, page = 1, limit = 100 } = args;
|
|
40886
41054
|
return ctx.api.get("/api/analytics/icp", {
|
|
40887
|
-
query: compact({ postUrn, forceRefresh }),
|
|
41055
|
+
query: compact({ postUrn, forceRefresh, page, limit }),
|
|
40888
41056
|
clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
|
|
40889
41057
|
});
|
|
40890
41058
|
}
|
|
40891
41059
|
};
|
|
40892
41060
|
registerTools(
|
|
40893
41061
|
get_analytics_deep_dive,
|
|
41062
|
+
get_analytics_posts,
|
|
40894
41063
|
get_linkedin_analytics,
|
|
40895
41064
|
get_icp_contacts,
|
|
40896
41065
|
sync_icp_contacts,
|
|
@@ -41578,8 +41747,8 @@ var DEFAULT_MAX_TOOL_RESULT_CHARS, ARRAY_PREVIEW_ITEMS, MAX_STRING_CHARS, MAX_OB
|
|
|
41578
41747
|
var init_tool_result = __esm({
|
|
41579
41748
|
"src/tool-result.ts"() {
|
|
41580
41749
|
"use strict";
|
|
41581
|
-
DEFAULT_MAX_TOOL_RESULT_CHARS =
|
|
41582
|
-
ARRAY_PREVIEW_ITEMS =
|
|
41750
|
+
DEFAULT_MAX_TOOL_RESULT_CHARS = 2e5;
|
|
41751
|
+
ARRAY_PREVIEW_ITEMS = 100;
|
|
41583
41752
|
MAX_STRING_CHARS = 8e3;
|
|
41584
41753
|
MAX_OBJECT_KEYS = 80;
|
|
41585
41754
|
}
|
|
@@ -41593,9 +41762,16 @@ function getToolAccess(name) {
|
|
|
41593
41762
|
}
|
|
41594
41763
|
function isToolAllowed(name, accessMode) {
|
|
41595
41764
|
if (accessMode === "full") return true;
|
|
41765
|
+
if (READ_ONLY_ALLOWED_WRITE_TOOL_NAMES.has(name)) return true;
|
|
41596
41766
|
return getToolAccess(name) === "read";
|
|
41597
41767
|
}
|
|
41598
|
-
|
|
41768
|
+
function isToolReadOnly(name) {
|
|
41769
|
+
return !WRITE_TOOL_NAMES.has(name) && !DESTRUCTIVE_TOOL_NAMES.has(name) && name !== "sync_icp_contacts_all";
|
|
41770
|
+
}
|
|
41771
|
+
function isToolDestructive(name) {
|
|
41772
|
+
return DESTRUCTIVE_TOOL_NAMES.has(name);
|
|
41773
|
+
}
|
|
41774
|
+
var WRITE_TOOL_NAMES, READ_ONLY_ALLOWED_WRITE_TOOL_NAMES, ADMIN_TOOL_NAMES, DESTRUCTIVE_TOOL_NAMES;
|
|
41599
41775
|
var init_permissions = __esm({
|
|
41600
41776
|
"src/tools/permissions.ts"() {
|
|
41601
41777
|
"use strict";
|
|
@@ -41604,6 +41780,7 @@ var init_permissions = __esm({
|
|
|
41604
41780
|
"chat_with_ai",
|
|
41605
41781
|
"create_client_resource",
|
|
41606
41782
|
"create_content_piece",
|
|
41783
|
+
"create_content_engine_post_package",
|
|
41607
41784
|
"create_content_source",
|
|
41608
41785
|
"create_image_folder",
|
|
41609
41786
|
"create_post",
|
|
@@ -41649,11 +41826,27 @@ var init_permissions = __esm({
|
|
|
41649
41826
|
"update_resource_status",
|
|
41650
41827
|
"update_setup_checkpoint"
|
|
41651
41828
|
]);
|
|
41829
|
+
READ_ONLY_ALLOWED_WRITE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
41830
|
+
"create_content_engine_post_package"
|
|
41831
|
+
]);
|
|
41652
41832
|
ADMIN_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
41653
41833
|
"list_excluded_clients",
|
|
41654
41834
|
"manage_exclusions",
|
|
41655
41835
|
"sync_icp_contacts_all"
|
|
41656
41836
|
]);
|
|
41837
|
+
DESTRUCTIVE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
41838
|
+
"delete_client_resource",
|
|
41839
|
+
"delete_comment",
|
|
41840
|
+
"delete_content_piece",
|
|
41841
|
+
"delete_content_source",
|
|
41842
|
+
"delete_conversation",
|
|
41843
|
+
"delete_image",
|
|
41844
|
+
"delete_image_folder",
|
|
41845
|
+
"delete_post",
|
|
41846
|
+
"delete_report",
|
|
41847
|
+
"delete_resource",
|
|
41848
|
+
"manage_exclusions"
|
|
41849
|
+
]);
|
|
41657
41850
|
}
|
|
41658
41851
|
});
|
|
41659
41852
|
|
|
@@ -41692,7 +41885,14 @@ async function createMcpProtocolServer(opts) {
|
|
|
41692
41885
|
tools: visibleTools.map((t) => ({
|
|
41693
41886
|
name: t.name,
|
|
41694
41887
|
description: t.description,
|
|
41695
|
-
inputSchema: zodToJsonSchemaStub(t.inputSchema)
|
|
41888
|
+
inputSchema: zodToJsonSchemaStub(t.inputSchema),
|
|
41889
|
+
annotations: {
|
|
41890
|
+
title: t.name,
|
|
41891
|
+
readOnlyHint: isToolReadOnly(t.name),
|
|
41892
|
+
destructiveHint: isToolDestructive(t.name),
|
|
41893
|
+
idempotentHint: getToolAccess(t.name) !== "write" && !isToolDestructive(t.name),
|
|
41894
|
+
openWorldHint: true
|
|
41895
|
+
}
|
|
41696
41896
|
}))
|
|
41697
41897
|
}));
|
|
41698
41898
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -41836,7 +42036,7 @@ var init_server3 = __esm({
|
|
|
41836
42036
|
init_permissions();
|
|
41837
42037
|
init_logger();
|
|
41838
42038
|
SERVER_NAME = "notusos-mcp";
|
|
41839
|
-
SERVER_VERSION = true ? "0.1.
|
|
42039
|
+
SERVER_VERSION = true ? "0.1.20" : "dev";
|
|
41840
42040
|
}
|
|
41841
42041
|
});
|
|
41842
42042
|
|
|
@@ -41845,6 +42045,7 @@ var remote_server_exports = {};
|
|
|
41845
42045
|
__export(remote_server_exports, {
|
|
41846
42046
|
buildOAuthAuthorizationServerMetadata: () => buildOAuthAuthorizationServerMetadata,
|
|
41847
42047
|
getPathname: () => getPathname,
|
|
42048
|
+
isAllowedConnectorRedirectUri: () => isAllowedConnectorRedirectUri,
|
|
41848
42049
|
isAllowedMcpMethod: () => isAllowedMcpMethod,
|
|
41849
42050
|
isRequestTooLarge: () => isRequestTooLarge,
|
|
41850
42051
|
startRemoteServer: () => startRemoteServer
|
|
@@ -41867,18 +42068,18 @@ async function startRemoteServer(config2) {
|
|
|
41867
42068
|
writeJson(res, 200, { ok: true });
|
|
41868
42069
|
return;
|
|
41869
42070
|
}
|
|
41870
|
-
if (pathname === "/.well-known/oauth-protected-resource") {
|
|
42071
|
+
if (pathname === "/.well-known/oauth-protected-resource" || pathname === "/.well-known/oauth-protected-resource/mcp") {
|
|
41871
42072
|
const resource = publicUrl ? `${publicUrl}/mcp` : "/mcp";
|
|
41872
42073
|
writeJson(res, 200, {
|
|
41873
42074
|
resource,
|
|
41874
|
-
authorization_servers: [authBaseUrl],
|
|
42075
|
+
authorization_servers: [publicUrl || authBaseUrl],
|
|
41875
42076
|
bearer_methods_supported: ["header"],
|
|
41876
42077
|
scopes_supported: ["notusos:mcp"],
|
|
41877
42078
|
resource_name: "notusOS MCP"
|
|
41878
42079
|
});
|
|
41879
42080
|
return;
|
|
41880
42081
|
}
|
|
41881
|
-
if (pathname === "/.well-known/oauth-authorization-server") {
|
|
42082
|
+
if (pathname === "/.well-known/oauth-authorization-server" || pathname === "/.well-known/oauth-authorization-server/mcp" || pathname === "/.well-known/openid-configuration" || pathname === "/.well-known/openid-configuration/mcp") {
|
|
41882
42083
|
writeJson(res, 200, buildOAuthAuthorizationServerMetadata({ authBaseUrl, publicUrl }));
|
|
41883
42084
|
return;
|
|
41884
42085
|
}
|
|
@@ -41892,11 +42093,16 @@ async function startRemoteServer(config2) {
|
|
|
41892
42093
|
return;
|
|
41893
42094
|
}
|
|
41894
42095
|
const body = await readJsonBody(req, maxRequestBytes);
|
|
41895
|
-
const requestedName = typeof body.client_name === "string" ? body.client_name : "
|
|
42096
|
+
const requestedName = typeof body.client_name === "string" ? body.client_name : "MCP connector";
|
|
42097
|
+
const requestedRedirectUris = Array.isArray(body.redirect_uris) ? body.redirect_uris.filter((uri) => typeof uri === "string" && isAllowedConnectorRedirectUri(uri)) : [];
|
|
41896
42098
|
writeJson(res, 201, {
|
|
41897
|
-
client_id: "
|
|
42099
|
+
client_id: typeof body.client_id === "string" ? body.client_id : "notusos-mcp-cloud",
|
|
41898
42100
|
client_name: requestedName,
|
|
41899
|
-
redirect_uris: [
|
|
42101
|
+
redirect_uris: requestedRedirectUris.length > 0 ? requestedRedirectUris : [
|
|
42102
|
+
"https://claude.ai/api/mcp/auth_callback",
|
|
42103
|
+
"https://claude.com/api/mcp/auth_callback",
|
|
42104
|
+
"https://chatgpt.com/connector_platform_oauth_redirect"
|
|
42105
|
+
],
|
|
41900
42106
|
grant_types: ["authorization_code"],
|
|
41901
42107
|
response_types: ["code"],
|
|
41902
42108
|
token_endpoint_auth_method: "none",
|
|
@@ -42001,11 +42207,33 @@ function buildOAuthAuthorizationServerMetadata(options) {
|
|
|
42001
42207
|
registration_endpoint: `${endpointBase}/register`,
|
|
42002
42208
|
response_types_supported: ["code"],
|
|
42003
42209
|
grant_types_supported: ["authorization_code"],
|
|
42210
|
+
client_id_metadata_document_supported: true,
|
|
42004
42211
|
code_challenge_methods_supported: ["S256"],
|
|
42005
42212
|
token_endpoint_auth_methods_supported: ["none"],
|
|
42006
42213
|
scopes_supported: ["notusos:mcp"]
|
|
42007
42214
|
};
|
|
42008
42215
|
}
|
|
42216
|
+
function isAllowedConnectorRedirectUri(uri) {
|
|
42217
|
+
try {
|
|
42218
|
+
const parsed = new URL(uri);
|
|
42219
|
+
if (parsed.protocol !== "https:") return isLoopbackCallbackUri(parsed);
|
|
42220
|
+
if (parsed.hostname === "claude.ai" || parsed.hostname === "claude.com") {
|
|
42221
|
+
return parsed.pathname === "/api/mcp/auth_callback";
|
|
42222
|
+
}
|
|
42223
|
+
if (parsed.hostname === "chatgpt.com") {
|
|
42224
|
+
return parsed.pathname === "/connector_platform_oauth_redirect" || /^\/connector\/oauth\/[A-Za-z0-9_-]+$/.test(parsed.pathname);
|
|
42225
|
+
}
|
|
42226
|
+
return false;
|
|
42227
|
+
} catch {
|
|
42228
|
+
return false;
|
|
42229
|
+
}
|
|
42230
|
+
}
|
|
42231
|
+
function isLoopbackCallbackUri(parsed) {
|
|
42232
|
+
if (parsed.protocol !== "http:") return false;
|
|
42233
|
+
if (parsed.hostname !== "127.0.0.1" && parsed.hostname !== "localhost") return false;
|
|
42234
|
+
if (!parsed.port) return false;
|
|
42235
|
+
return parsed.pathname === "/callback";
|
|
42236
|
+
}
|
|
42009
42237
|
function extractBearerToken(req) {
|
|
42010
42238
|
const header = req.headers.authorization;
|
|
42011
42239
|
if (!header) return null;
|
|
@@ -42110,7 +42338,7 @@ function loadConfig(env = process.env) {
|
|
|
42110
42338
|
// bin/notusos-mcp.ts
|
|
42111
42339
|
init_token_store();
|
|
42112
42340
|
init_logger();
|
|
42113
|
-
var MCP_VERSION = true ? "0.1.
|
|
42341
|
+
var MCP_VERSION = true ? "0.1.20" : "dev";
|
|
42114
42342
|
async function main() {
|
|
42115
42343
|
const [, , sub] = process.argv;
|
|
42116
42344
|
const config2 = loadConfig();
|