@notus-os/mcp 0.1.16 → 0.1.18
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/dist/bin/notusos-mcp.js +130 -12
- package/package.json +1 -1
package/dist/bin/notusos-mcp.js
CHANGED
|
@@ -39668,7 +39668,7 @@ var init_resources = __esm({
|
|
|
39668
39668
|
listResourcesSchema = external_exports.object({ ...clientTarget });
|
|
39669
39669
|
list_resources = {
|
|
39670
39670
|
name: "list_resources",
|
|
39671
|
-
description: "All strategy docs, brand guides, and content pillars enabled in a client's library. Returns id, name, resource_type,
|
|
39671
|
+
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
39672
|
inputSchema: listResourcesSchema,
|
|
39673
39673
|
handler: async (args, ctx) => {
|
|
39674
39674
|
return ctx.api.get("/api/resources", { clientContext: toClientContext(args) });
|
|
@@ -40736,6 +40736,7 @@ var init_feedback = __esm({
|
|
|
40736
40736
|
var analytics_deep_exports = {};
|
|
40737
40737
|
__export(analytics_deep_exports, {
|
|
40738
40738
|
get_analytics_deep_dive: () => get_analytics_deep_dive,
|
|
40739
|
+
get_analytics_posts: () => get_analytics_posts,
|
|
40739
40740
|
get_icp_contacts: () => get_icp_contacts,
|
|
40740
40741
|
get_icp_post_engagement: () => get_icp_post_engagement,
|
|
40741
40742
|
get_linkedin_analytics: () => get_linkedin_analytics,
|
|
@@ -40744,7 +40745,27 @@ __export(analytics_deep_exports, {
|
|
|
40744
40745
|
sync_icp_contacts: () => sync_icp_contacts,
|
|
40745
40746
|
sync_icp_contacts_all: () => sync_icp_contacts_all
|
|
40746
40747
|
});
|
|
40747
|
-
|
|
40748
|
+
function compactAnalyticsPostsResponse(response) {
|
|
40749
|
+
if (!response || typeof response !== "object") return response;
|
|
40750
|
+
const record2 = response;
|
|
40751
|
+
if (!Array.isArray(record2.posts)) return response;
|
|
40752
|
+
return {
|
|
40753
|
+
...record2,
|
|
40754
|
+
posts: record2.posts.map((post) => {
|
|
40755
|
+
if (!post || typeof post !== "object") return post;
|
|
40756
|
+
const postRecord = post;
|
|
40757
|
+
const text = postRecord.text;
|
|
40758
|
+
if (typeof text !== "string" || text.length <= MCP_POST_TEXT_PREVIEW_CHARS) {
|
|
40759
|
+
return post;
|
|
40760
|
+
}
|
|
40761
|
+
return {
|
|
40762
|
+
...postRecord,
|
|
40763
|
+
text: `${text.slice(0, MCP_POST_TEXT_PREVIEW_CHARS)}...TRUNCATED_TEXT(${text.length} chars)`
|
|
40764
|
+
};
|
|
40765
|
+
})
|
|
40766
|
+
};
|
|
40767
|
+
}
|
|
40768
|
+
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
40769
|
var init_analytics_deep = __esm({
|
|
40749
40770
|
"src/tools/analytics-deep.ts"() {
|
|
40750
40771
|
"use strict";
|
|
@@ -40781,6 +40802,48 @@ var init_analytics_deep = __esm({
|
|
|
40781
40802
|
return Object.fromEntries(entries);
|
|
40782
40803
|
}
|
|
40783
40804
|
};
|
|
40805
|
+
getAnalyticsPostsSchema = external_exports.object({
|
|
40806
|
+
...clientTarget,
|
|
40807
|
+
days: external_exports.number().int().min(1).max(730).optional(),
|
|
40808
|
+
startDate: external_exports.string().optional(),
|
|
40809
|
+
endDate: external_exports.string().optional(),
|
|
40810
|
+
page: external_exports.number().int().min(1).optional(),
|
|
40811
|
+
limit: external_exports.number().int().min(1).max(25).optional(),
|
|
40812
|
+
sortBy: external_exports.enum(["posted_at", "score", "impressions", "likes", "comments", "reposts"]).optional()
|
|
40813
|
+
});
|
|
40814
|
+
MCP_POST_TEXT_PREVIEW_CHARS = 1200;
|
|
40815
|
+
get_analytics_posts = {
|
|
40816
|
+
name: "get_analytics_posts",
|
|
40817
|
+
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.",
|
|
40818
|
+
inputSchema: getAnalyticsPostsSchema,
|
|
40819
|
+
handler: async (args, ctx) => {
|
|
40820
|
+
const {
|
|
40821
|
+
clientUserId,
|
|
40822
|
+
clientOrganizationId,
|
|
40823
|
+
appMode,
|
|
40824
|
+
days,
|
|
40825
|
+
startDate,
|
|
40826
|
+
endDate,
|
|
40827
|
+
page = 1,
|
|
40828
|
+
limit = 25,
|
|
40829
|
+
sortBy = "posted_at"
|
|
40830
|
+
} = args;
|
|
40831
|
+
const offset = (page - 1) * limit;
|
|
40832
|
+
const query = compact({
|
|
40833
|
+
days: startDate || endDate ? void 0 : days ?? 180,
|
|
40834
|
+
startDate,
|
|
40835
|
+
endDate,
|
|
40836
|
+
limit,
|
|
40837
|
+
offset,
|
|
40838
|
+
sortBy
|
|
40839
|
+
});
|
|
40840
|
+
const response = await ctx.api.get("/api/analytics/posts", {
|
|
40841
|
+
query,
|
|
40842
|
+
clientContext: toClientContext({ clientUserId, clientOrganizationId, appMode })
|
|
40843
|
+
});
|
|
40844
|
+
return compactAnalyticsPostsResponse(response);
|
|
40845
|
+
}
|
|
40846
|
+
};
|
|
40784
40847
|
getLinkedinAnalyticsSchema = external_exports.object({
|
|
40785
40848
|
...clientTarget,
|
|
40786
40849
|
days: external_exports.number().int().min(1).max(730).optional()
|
|
@@ -40891,6 +40954,7 @@ var init_analytics_deep = __esm({
|
|
|
40891
40954
|
};
|
|
40892
40955
|
registerTools(
|
|
40893
40956
|
get_analytics_deep_dive,
|
|
40957
|
+
get_analytics_posts,
|
|
40894
40958
|
get_linkedin_analytics,
|
|
40895
40959
|
get_icp_contacts,
|
|
40896
40960
|
sync_icp_contacts,
|
|
@@ -41595,7 +41659,13 @@ function isToolAllowed(name, accessMode) {
|
|
|
41595
41659
|
if (accessMode === "full") return true;
|
|
41596
41660
|
return getToolAccess(name) === "read";
|
|
41597
41661
|
}
|
|
41598
|
-
|
|
41662
|
+
function isToolReadOnly(name) {
|
|
41663
|
+
return !WRITE_TOOL_NAMES.has(name) && !DESTRUCTIVE_TOOL_NAMES.has(name) && name !== "sync_icp_contacts_all";
|
|
41664
|
+
}
|
|
41665
|
+
function isToolDestructive(name) {
|
|
41666
|
+
return DESTRUCTIVE_TOOL_NAMES.has(name);
|
|
41667
|
+
}
|
|
41668
|
+
var WRITE_TOOL_NAMES, ADMIN_TOOL_NAMES, DESTRUCTIVE_TOOL_NAMES;
|
|
41599
41669
|
var init_permissions = __esm({
|
|
41600
41670
|
"src/tools/permissions.ts"() {
|
|
41601
41671
|
"use strict";
|
|
@@ -41654,6 +41724,19 @@ var init_permissions = __esm({
|
|
|
41654
41724
|
"manage_exclusions",
|
|
41655
41725
|
"sync_icp_contacts_all"
|
|
41656
41726
|
]);
|
|
41727
|
+
DESTRUCTIVE_TOOL_NAMES = /* @__PURE__ */ new Set([
|
|
41728
|
+
"delete_client_resource",
|
|
41729
|
+
"delete_comment",
|
|
41730
|
+
"delete_content_piece",
|
|
41731
|
+
"delete_content_source",
|
|
41732
|
+
"delete_conversation",
|
|
41733
|
+
"delete_image",
|
|
41734
|
+
"delete_image_folder",
|
|
41735
|
+
"delete_post",
|
|
41736
|
+
"delete_report",
|
|
41737
|
+
"delete_resource",
|
|
41738
|
+
"manage_exclusions"
|
|
41739
|
+
]);
|
|
41657
41740
|
}
|
|
41658
41741
|
});
|
|
41659
41742
|
|
|
@@ -41692,7 +41775,14 @@ async function createMcpProtocolServer(opts) {
|
|
|
41692
41775
|
tools: visibleTools.map((t) => ({
|
|
41693
41776
|
name: t.name,
|
|
41694
41777
|
description: t.description,
|
|
41695
|
-
inputSchema: zodToJsonSchemaStub(t.inputSchema)
|
|
41778
|
+
inputSchema: zodToJsonSchemaStub(t.inputSchema),
|
|
41779
|
+
annotations: {
|
|
41780
|
+
title: t.name,
|
|
41781
|
+
readOnlyHint: isToolReadOnly(t.name),
|
|
41782
|
+
destructiveHint: isToolDestructive(t.name),
|
|
41783
|
+
idempotentHint: getToolAccess(t.name) !== "write" && !isToolDestructive(t.name),
|
|
41784
|
+
openWorldHint: true
|
|
41785
|
+
}
|
|
41696
41786
|
}))
|
|
41697
41787
|
}));
|
|
41698
41788
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
@@ -41836,7 +41926,7 @@ var init_server3 = __esm({
|
|
|
41836
41926
|
init_permissions();
|
|
41837
41927
|
init_logger();
|
|
41838
41928
|
SERVER_NAME = "notusos-mcp";
|
|
41839
|
-
SERVER_VERSION = true ? "0.1.
|
|
41929
|
+
SERVER_VERSION = true ? "0.1.18" : "dev";
|
|
41840
41930
|
}
|
|
41841
41931
|
});
|
|
41842
41932
|
|
|
@@ -41845,6 +41935,7 @@ var remote_server_exports = {};
|
|
|
41845
41935
|
__export(remote_server_exports, {
|
|
41846
41936
|
buildOAuthAuthorizationServerMetadata: () => buildOAuthAuthorizationServerMetadata,
|
|
41847
41937
|
getPathname: () => getPathname,
|
|
41938
|
+
isAllowedConnectorRedirectUri: () => isAllowedConnectorRedirectUri,
|
|
41848
41939
|
isAllowedMcpMethod: () => isAllowedMcpMethod,
|
|
41849
41940
|
isRequestTooLarge: () => isRequestTooLarge,
|
|
41850
41941
|
startRemoteServer: () => startRemoteServer
|
|
@@ -41867,18 +41958,18 @@ async function startRemoteServer(config2) {
|
|
|
41867
41958
|
writeJson(res, 200, { ok: true });
|
|
41868
41959
|
return;
|
|
41869
41960
|
}
|
|
41870
|
-
if (pathname === "/.well-known/oauth-protected-resource") {
|
|
41961
|
+
if (pathname === "/.well-known/oauth-protected-resource" || pathname === "/.well-known/oauth-protected-resource/mcp") {
|
|
41871
41962
|
const resource = publicUrl ? `${publicUrl}/mcp` : "/mcp";
|
|
41872
41963
|
writeJson(res, 200, {
|
|
41873
41964
|
resource,
|
|
41874
|
-
authorization_servers: [authBaseUrl],
|
|
41965
|
+
authorization_servers: [publicUrl || authBaseUrl],
|
|
41875
41966
|
bearer_methods_supported: ["header"],
|
|
41876
41967
|
scopes_supported: ["notusos:mcp"],
|
|
41877
41968
|
resource_name: "notusOS MCP"
|
|
41878
41969
|
});
|
|
41879
41970
|
return;
|
|
41880
41971
|
}
|
|
41881
|
-
if (pathname === "/.well-known/oauth-authorization-server") {
|
|
41972
|
+
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
41973
|
writeJson(res, 200, buildOAuthAuthorizationServerMetadata({ authBaseUrl, publicUrl }));
|
|
41883
41974
|
return;
|
|
41884
41975
|
}
|
|
@@ -41892,11 +41983,16 @@ async function startRemoteServer(config2) {
|
|
|
41892
41983
|
return;
|
|
41893
41984
|
}
|
|
41894
41985
|
const body = await readJsonBody(req, maxRequestBytes);
|
|
41895
|
-
const requestedName = typeof body.client_name === "string" ? body.client_name : "
|
|
41986
|
+
const requestedName = typeof body.client_name === "string" ? body.client_name : "MCP connector";
|
|
41987
|
+
const requestedRedirectUris = Array.isArray(body.redirect_uris) ? body.redirect_uris.filter((uri) => typeof uri === "string" && isAllowedConnectorRedirectUri(uri)) : [];
|
|
41896
41988
|
writeJson(res, 201, {
|
|
41897
|
-
client_id: "
|
|
41989
|
+
client_id: typeof body.client_id === "string" ? body.client_id : "notusos-mcp-cloud",
|
|
41898
41990
|
client_name: requestedName,
|
|
41899
|
-
redirect_uris: [
|
|
41991
|
+
redirect_uris: requestedRedirectUris.length > 0 ? requestedRedirectUris : [
|
|
41992
|
+
"https://claude.ai/api/mcp/auth_callback",
|
|
41993
|
+
"https://claude.com/api/mcp/auth_callback",
|
|
41994
|
+
"https://chatgpt.com/connector_platform_oauth_redirect"
|
|
41995
|
+
],
|
|
41900
41996
|
grant_types: ["authorization_code"],
|
|
41901
41997
|
response_types: ["code"],
|
|
41902
41998
|
token_endpoint_auth_method: "none",
|
|
@@ -42001,11 +42097,33 @@ function buildOAuthAuthorizationServerMetadata(options) {
|
|
|
42001
42097
|
registration_endpoint: `${endpointBase}/register`,
|
|
42002
42098
|
response_types_supported: ["code"],
|
|
42003
42099
|
grant_types_supported: ["authorization_code"],
|
|
42100
|
+
client_id_metadata_document_supported: true,
|
|
42004
42101
|
code_challenge_methods_supported: ["S256"],
|
|
42005
42102
|
token_endpoint_auth_methods_supported: ["none"],
|
|
42006
42103
|
scopes_supported: ["notusos:mcp"]
|
|
42007
42104
|
};
|
|
42008
42105
|
}
|
|
42106
|
+
function isAllowedConnectorRedirectUri(uri) {
|
|
42107
|
+
try {
|
|
42108
|
+
const parsed = new URL(uri);
|
|
42109
|
+
if (parsed.protocol !== "https:") return isLoopbackCallbackUri(parsed);
|
|
42110
|
+
if (parsed.hostname === "claude.ai" || parsed.hostname === "claude.com") {
|
|
42111
|
+
return parsed.pathname === "/api/mcp/auth_callback";
|
|
42112
|
+
}
|
|
42113
|
+
if (parsed.hostname === "chatgpt.com") {
|
|
42114
|
+
return parsed.pathname === "/connector_platform_oauth_redirect" || /^\/connector\/oauth\/[A-Za-z0-9_-]+$/.test(parsed.pathname);
|
|
42115
|
+
}
|
|
42116
|
+
return false;
|
|
42117
|
+
} catch {
|
|
42118
|
+
return false;
|
|
42119
|
+
}
|
|
42120
|
+
}
|
|
42121
|
+
function isLoopbackCallbackUri(parsed) {
|
|
42122
|
+
if (parsed.protocol !== "http:") return false;
|
|
42123
|
+
if (parsed.hostname !== "127.0.0.1" && parsed.hostname !== "localhost") return false;
|
|
42124
|
+
if (!parsed.port) return false;
|
|
42125
|
+
return parsed.pathname === "/callback";
|
|
42126
|
+
}
|
|
42009
42127
|
function extractBearerToken(req) {
|
|
42010
42128
|
const header = req.headers.authorization;
|
|
42011
42129
|
if (!header) return null;
|
|
@@ -42110,7 +42228,7 @@ function loadConfig(env = process.env) {
|
|
|
42110
42228
|
// bin/notusos-mcp.ts
|
|
42111
42229
|
init_token_store();
|
|
42112
42230
|
init_logger();
|
|
42113
|
-
var MCP_VERSION = true ? "0.1.
|
|
42231
|
+
var MCP_VERSION = true ? "0.1.18" : "dev";
|
|
42114
42232
|
async function main() {
|
|
42115
42233
|
const [, , sub] = process.argv;
|
|
42116
42234
|
const config2 = loadConfig();
|