@hasna/mcps 0.0.12 → 0.0.14
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/bin/index.js +1123 -603
- package/bin/mcp.js +21747 -21322
- package/dist/index.d.ts +3 -1
- package/dist/index.js +376 -6
- package/dist/lib/provider-profile-seeds.d.ts +2 -0
- package/dist/lib/provider-profiles.d.ts +14 -0
- package/dist/mcp/index.d.ts +4 -0
- package/dist/mcp/index.js +35290 -0
- package/dist/mcp/server.d.ts +10 -0
- package/dist/mcp/tools.d.ts +14 -0
- package/dist/types.d.ts +82 -2
- package/package.json +10 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { McpServerEntry, AddServerOptions, McpTool, RegistryServer, ConnectedServer, FinderResult, MachineEntry, AddMachineOptions, MachinePlatform, MachineArch, MachineInstaller, HasnaMcpCatalogEntry, MachinePackageHealth, FleetHealthReport, FleetInstallPackageResult, FleetInstallReport, } from "./types.js";
|
|
1
|
+
export type { McpServerEntry, AddServerOptions, McpTool, RegistryServer, ConnectedServer, FinderResult, MachineEntry, AddMachineOptions, MachinePlatform, MachineArch, MachineInstaller, HasnaMcpCatalogEntry, MachinePackageHealth, FleetHealthReport, FleetInstallPackageResult, FleetInstallReport, ProviderAuthMetadata, ProviderEndpointFallback, ProviderInstallFallback, ProviderProfile, ProviderProfileAuthType, ProviderProfileBearerTokenMode, ProviderProfileSource, ProviderProfileTokenMode, ProviderProfileTransport, ProviderSafetyMetadata, ProviderSourceProvenance, InstallProviderProfileOptions, UpsertProviderProfileOptions, } from "./types.js";
|
|
2
2
|
export { addServer, removeServer, listServers, getServer, updateServer, enableServer, disableServer, getToolCounts, getCachedTools, setServerEnv, unsetServerEnv, cloneServer, } from "./lib/registry.js";
|
|
3
3
|
export { diagnoseServer } from "./lib/doctor.js";
|
|
4
4
|
export type { DoctorReport, DoctorCheck } from "./lib/doctor.js";
|
|
@@ -6,6 +6,8 @@ export { searchRegistry, getRegistryServer, installFromRegistry } from "./lib/re
|
|
|
6
6
|
export { findServers, listAwesomeServers } from "./lib/finder.js";
|
|
7
7
|
export type { FindOptions } from "./lib/finder.js";
|
|
8
8
|
export { listSources, getSource, addSource, removeSource, enableSource, disableSource, } from "./lib/sources.js";
|
|
9
|
+
export { upsertProviderProfile, listProviderProfiles, searchProviderProfiles, getProviderProfile, installProviderProfile, removeProviderProfile, enableProviderProfile, disableProviderProfile, seedDefaultProviderProfiles, } from "./lib/provider-profiles.js";
|
|
10
|
+
export { DEFAULT_PROVIDER_PROFILE_SEEDS } from "./lib/provider-profile-seeds.js";
|
|
9
11
|
export { installToAgents } from "./lib/install.js";
|
|
10
12
|
export type { AgentTarget, InstallResult } from "./lib/install.js";
|
|
11
13
|
export type { McpSource, AddSourceOptions } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -9451,6 +9451,85 @@ var init_config2 = __esm(() => {
|
|
|
9451
9451
|
DB_PATH = process.env.HASNA_MCPS_DB_PATH ?? process.env.MCPS_DB_PATH ?? join5(MCPS_DIR, "registry.db");
|
|
9452
9452
|
});
|
|
9453
9453
|
|
|
9454
|
+
// src/lib/provider-profile-seeds.ts
|
|
9455
|
+
var DEFAULT_PROVIDER_PROFILE_SEEDS;
|
|
9456
|
+
var init_provider_profile_seeds = __esm(() => {
|
|
9457
|
+
DEFAULT_PROVIDER_PROFILE_SEEDS = [
|
|
9458
|
+
{
|
|
9459
|
+
id: "notion",
|
|
9460
|
+
displayName: "Notion",
|
|
9461
|
+
description: "Connect a Notion workspace so agents can search, read, create, and update workspace content.",
|
|
9462
|
+
endpoint: "https://mcp.notion.com/mcp",
|
|
9463
|
+
transport: "streamable-http",
|
|
9464
|
+
fallbackEndpoints: [
|
|
9465
|
+
{
|
|
9466
|
+
transport: "sse",
|
|
9467
|
+
url: "https://mcp.notion.com/sse",
|
|
9468
|
+
notes: "Fallback for clients that do not support Streamable HTTP."
|
|
9469
|
+
}
|
|
9470
|
+
],
|
|
9471
|
+
authType: "oauth2",
|
|
9472
|
+
authMetadata: {
|
|
9473
|
+
oauthVersion: "2.0",
|
|
9474
|
+
pkce: true,
|
|
9475
|
+
dynamicClientRegistration: true,
|
|
9476
|
+
bearerToken: "none",
|
|
9477
|
+
notes: "Remote Notion MCP uses OAuth with PKCE. Bearer-token authentication is only appropriate for self-hosted/local fallback deployments."
|
|
9478
|
+
},
|
|
9479
|
+
tokenMode: "workspace",
|
|
9480
|
+
installFallback: {
|
|
9481
|
+
command: "npx",
|
|
9482
|
+
args: ["-y", "mcp-remote", "https://mcp.notion.com/sse", "--transport", "sse-only"],
|
|
9483
|
+
packageName: "mcp-remote",
|
|
9484
|
+
url: "https://mcp.notion.com/sse"
|
|
9485
|
+
},
|
|
9486
|
+
docsUrl: "https://developers.notion.com/guides/mcp/build-mcp-client",
|
|
9487
|
+
safety: {
|
|
9488
|
+
requiresApproval: true,
|
|
9489
|
+
dataClasses: ["workspace_content", "pages", "databases", "comments"],
|
|
9490
|
+
notes: "Connected agents operate with the authorizing user's workspace access. Human confirmation is recommended for write-capable workflows."
|
|
9491
|
+
},
|
|
9492
|
+
provenance: {
|
|
9493
|
+
source: "curated",
|
|
9494
|
+
sourceUrl: "https://developers.notion.com/guides/mcp/build-mcp-client",
|
|
9495
|
+
verifiedAt: "2026-05-10"
|
|
9496
|
+
}
|
|
9497
|
+
},
|
|
9498
|
+
{
|
|
9499
|
+
id: "linear",
|
|
9500
|
+
displayName: "Linear",
|
|
9501
|
+
description: "Connect Linear so agents can find, create, and update issues, projects, comments, and related workspace objects.",
|
|
9502
|
+
endpoint: "https://mcp.linear.app/mcp",
|
|
9503
|
+
transport: "streamable-http",
|
|
9504
|
+
authType: "oauth2",
|
|
9505
|
+
authMetadata: {
|
|
9506
|
+
oauthVersion: "2.1",
|
|
9507
|
+
dynamicClientRegistration: true,
|
|
9508
|
+
bearerToken: "optional",
|
|
9509
|
+
notes: "Linear supports interactive OAuth 2.1 with dynamic client registration and optional Authorization: Bearer tokens for OAuth tokens or API keys."
|
|
9510
|
+
},
|
|
9511
|
+
tokenMode: "workspace",
|
|
9512
|
+
installFallback: {
|
|
9513
|
+
command: "npx",
|
|
9514
|
+
args: ["-y", "mcp-remote", "https://mcp.linear.app/mcp"],
|
|
9515
|
+
packageName: "mcp-remote",
|
|
9516
|
+
url: "https://mcp.linear.app/mcp"
|
|
9517
|
+
},
|
|
9518
|
+
docsUrl: "https://linear.app/docs/mcp",
|
|
9519
|
+
safety: {
|
|
9520
|
+
requiresApproval: true,
|
|
9521
|
+
dataClasses: ["issues", "projects", "comments", "teams", "users"],
|
|
9522
|
+
notes: "Linear tools can create and update workspace objects, so write actions should be policy-gated by the platform."
|
|
9523
|
+
},
|
|
9524
|
+
provenance: {
|
|
9525
|
+
source: "curated",
|
|
9526
|
+
sourceUrl: "https://linear.app/docs/mcp",
|
|
9527
|
+
verifiedAt: "2026-05-10"
|
|
9528
|
+
}
|
|
9529
|
+
}
|
|
9530
|
+
];
|
|
9531
|
+
});
|
|
9532
|
+
|
|
9454
9533
|
// src/lib/db.ts
|
|
9455
9534
|
import { mkdirSync as mkdirSync5 } from "fs";
|
|
9456
9535
|
function getDb() {
|
|
@@ -9536,6 +9615,50 @@ function getDb() {
|
|
|
9536
9615
|
('github-mcp-topic', 'GitHub MCP Topic', 'github-topic', 'https://api.github.com/search/repositories', 'GitHub repositories tagged with mcp-server topic')
|
|
9537
9616
|
`);
|
|
9538
9617
|
}
|
|
9618
|
+
db.exec(`
|
|
9619
|
+
CREATE TABLE IF NOT EXISTS provider_profiles (
|
|
9620
|
+
id TEXT PRIMARY KEY,
|
|
9621
|
+
display_name TEXT NOT NULL,
|
|
9622
|
+
description TEXT,
|
|
9623
|
+
endpoint TEXT,
|
|
9624
|
+
transport TEXT NOT NULL,
|
|
9625
|
+
fallback_endpoints TEXT NOT NULL DEFAULT '[]',
|
|
9626
|
+
auth_type TEXT NOT NULL,
|
|
9627
|
+
auth_metadata TEXT NOT NULL DEFAULT '{}',
|
|
9628
|
+
scopes TEXT NOT NULL DEFAULT '[]',
|
|
9629
|
+
token_mode TEXT NOT NULL DEFAULT 'none',
|
|
9630
|
+
install_fallback TEXT NOT NULL DEFAULT '{}',
|
|
9631
|
+
docs_url TEXT,
|
|
9632
|
+
safety TEXT NOT NULL DEFAULT '{}',
|
|
9633
|
+
provenance TEXT NOT NULL DEFAULT '{"source":"manual"}',
|
|
9634
|
+
enabled INTEGER NOT NULL DEFAULT 1,
|
|
9635
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
9636
|
+
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
9637
|
+
)
|
|
9638
|
+
`);
|
|
9639
|
+
try {
|
|
9640
|
+
db.exec("ALTER TABLE provider_profiles ADD COLUMN fallback_endpoints TEXT NOT NULL DEFAULT '[]'");
|
|
9641
|
+
} catch {}
|
|
9642
|
+
try {
|
|
9643
|
+
db.exec("ALTER TABLE provider_profiles ADD COLUMN auth_metadata TEXT NOT NULL DEFAULT '{}'");
|
|
9644
|
+
} catch {}
|
|
9645
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_provider_profiles_enabled ON provider_profiles(enabled)");
|
|
9646
|
+
const providerProfileCount = db.query("SELECT COUNT(*) as c FROM provider_profiles").get().c;
|
|
9647
|
+
if (providerProfileCount === 0) {
|
|
9648
|
+
const insertProviderProfile = db.prepare(`
|
|
9649
|
+
INSERT OR IGNORE INTO provider_profiles (
|
|
9650
|
+
id, display_name, description, endpoint, transport, fallback_endpoints,
|
|
9651
|
+
auth_type, auth_metadata, scopes, token_mode, install_fallback,
|
|
9652
|
+
docs_url, safety, provenance, enabled
|
|
9653
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
9654
|
+
`);
|
|
9655
|
+
const run = db.transaction(() => {
|
|
9656
|
+
for (const profile of DEFAULT_PROVIDER_PROFILE_SEEDS) {
|
|
9657
|
+
insertProviderProfile.run(profile.id, profile.displayName, profile.description ?? null, profile.endpoint ?? null, profile.transport, JSON.stringify(profile.fallbackEndpoints ?? []), profile.authType, JSON.stringify(profile.authMetadata ?? {}), JSON.stringify(profile.scopes ?? []), profile.tokenMode ?? "none", JSON.stringify(profile.installFallback ?? null), profile.docsUrl ?? null, JSON.stringify(profile.safety ?? {}), JSON.stringify(profile.provenance), profile.enabled === false ? 0 : 1);
|
|
9658
|
+
}
|
|
9659
|
+
});
|
|
9660
|
+
run();
|
|
9661
|
+
}
|
|
9539
9662
|
db.exec(`
|
|
9540
9663
|
CREATE TABLE IF NOT EXISTS feedback (
|
|
9541
9664
|
id TEXT PRIMARY KEY DEFAULT (lower(hex(randomblob(16)))),
|
|
@@ -9560,6 +9683,7 @@ var db = null, _adapter = null;
|
|
|
9560
9683
|
var init_db = __esm(() => {
|
|
9561
9684
|
init_dist();
|
|
9562
9685
|
init_config2();
|
|
9686
|
+
init_provider_profile_seeds();
|
|
9563
9687
|
});
|
|
9564
9688
|
|
|
9565
9689
|
// node_modules/ajv/dist/compile/codegen/code.js
|
|
@@ -25425,6 +25549,242 @@ async function listAwesomeServers() {
|
|
|
25425
25549
|
// src/index.ts
|
|
25426
25550
|
init_sources();
|
|
25427
25551
|
|
|
25552
|
+
// src/lib/provider-profiles.ts
|
|
25553
|
+
init_db();
|
|
25554
|
+
init_provider_profile_seeds();
|
|
25555
|
+
var TRANSPORTS = new Set(["stdio", "sse", "streamable-http"]);
|
|
25556
|
+
var AUTH_TYPES = new Set(["none", "oauth2", "api_key", "bearer_token", "custom"]);
|
|
25557
|
+
var TOKEN_MODES = new Set(["none", "user", "workspace", "service"]);
|
|
25558
|
+
var BEARER_TOKEN_MODES = new Set(["none", "optional", "required"]);
|
|
25559
|
+
var PROVENANCE_SOURCES = new Set(["curated", "official-registry", "npm", "github", "manual"]);
|
|
25560
|
+
function safeJsonParse2(value, fallback) {
|
|
25561
|
+
if (typeof value !== "string")
|
|
25562
|
+
return fallback;
|
|
25563
|
+
try {
|
|
25564
|
+
return JSON.parse(value);
|
|
25565
|
+
} catch {
|
|
25566
|
+
return fallback;
|
|
25567
|
+
}
|
|
25568
|
+
}
|
|
25569
|
+
function normalizeString(value) {
|
|
25570
|
+
const trimmed = value?.trim();
|
|
25571
|
+
return trimmed ? trimmed : null;
|
|
25572
|
+
}
|
|
25573
|
+
function normalizeId(id) {
|
|
25574
|
+
const normalized = id.trim().toLowerCase();
|
|
25575
|
+
if (!/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/.test(normalized)) {
|
|
25576
|
+
throw new Error("Provider profile id must be lowercase kebab-case");
|
|
25577
|
+
}
|
|
25578
|
+
return normalized;
|
|
25579
|
+
}
|
|
25580
|
+
function normalizeScopes(scopes) {
|
|
25581
|
+
const seen = new Set;
|
|
25582
|
+
const normalized = [];
|
|
25583
|
+
for (const scope of scopes ?? []) {
|
|
25584
|
+
const trimmed = scope.trim();
|
|
25585
|
+
if (!trimmed || seen.has(trimmed))
|
|
25586
|
+
continue;
|
|
25587
|
+
seen.add(trimmed);
|
|
25588
|
+
normalized.push(trimmed);
|
|
25589
|
+
}
|
|
25590
|
+
return normalized;
|
|
25591
|
+
}
|
|
25592
|
+
function assertKnown(value, allowed, label) {
|
|
25593
|
+
if (!allowed.has(value))
|
|
25594
|
+
throw new Error(`Unknown provider profile ${label}: ${value}`);
|
|
25595
|
+
return value;
|
|
25596
|
+
}
|
|
25597
|
+
function normalizeProvenance(provenance) {
|
|
25598
|
+
const source = assertKnown(provenance.source, PROVENANCE_SOURCES, "provenance source");
|
|
25599
|
+
return {
|
|
25600
|
+
source,
|
|
25601
|
+
sourceUrl: normalizeString(provenance.sourceUrl) ?? undefined,
|
|
25602
|
+
repositoryUrl: normalizeString(provenance.repositoryUrl) ?? undefined,
|
|
25603
|
+
packageName: normalizeString(provenance.packageName) ?? undefined,
|
|
25604
|
+
verifiedAt: normalizeString(provenance.verifiedAt) ?? undefined
|
|
25605
|
+
};
|
|
25606
|
+
}
|
|
25607
|
+
function normalizeInstallFallback(fallback) {
|
|
25608
|
+
if (!fallback)
|
|
25609
|
+
return null;
|
|
25610
|
+
const normalized = {
|
|
25611
|
+
command: normalizeString(fallback.command) ?? undefined,
|
|
25612
|
+
args: Array.isArray(fallback.args) ? fallback.args.map((arg) => arg.trim()).filter(Boolean) : undefined,
|
|
25613
|
+
env: fallback.env && Object.keys(fallback.env).length > 0 ? fallback.env : undefined,
|
|
25614
|
+
packageName: normalizeString(fallback.packageName) ?? undefined,
|
|
25615
|
+
registryId: normalizeString(fallback.registryId) ?? undefined,
|
|
25616
|
+
url: normalizeString(fallback.url) ?? undefined
|
|
25617
|
+
};
|
|
25618
|
+
return Object.values(normalized).some((value) => value !== undefined) ? normalized : null;
|
|
25619
|
+
}
|
|
25620
|
+
function normalizeFallbackEndpoints(fallbacks) {
|
|
25621
|
+
const seen = new Set;
|
|
25622
|
+
const normalized = [];
|
|
25623
|
+
for (const fallback of fallbacks ?? []) {
|
|
25624
|
+
const transport = assertKnown(fallback.transport, TRANSPORTS, "fallback transport");
|
|
25625
|
+
const url2 = normalizeString(fallback.url);
|
|
25626
|
+
if (!url2)
|
|
25627
|
+
continue;
|
|
25628
|
+
const key = `${transport}:${url2}`;
|
|
25629
|
+
if (seen.has(key))
|
|
25630
|
+
continue;
|
|
25631
|
+
seen.add(key);
|
|
25632
|
+
normalized.push({
|
|
25633
|
+
transport,
|
|
25634
|
+
url: url2,
|
|
25635
|
+
notes: normalizeString(fallback.notes) ?? undefined
|
|
25636
|
+
});
|
|
25637
|
+
}
|
|
25638
|
+
return normalized;
|
|
25639
|
+
}
|
|
25640
|
+
function normalizeAuthMetadata(authMetadata) {
|
|
25641
|
+
const bearerToken = authMetadata?.bearerToken ? assertKnown(authMetadata.bearerToken, BEARER_TOKEN_MODES, "bearer token mode") : undefined;
|
|
25642
|
+
return {
|
|
25643
|
+
oauthVersion: authMetadata?.oauthVersion,
|
|
25644
|
+
pkce: authMetadata?.pkce,
|
|
25645
|
+
dynamicClientRegistration: authMetadata?.dynamicClientRegistration,
|
|
25646
|
+
bearerToken,
|
|
25647
|
+
notes: normalizeString(authMetadata?.notes) ?? undefined
|
|
25648
|
+
};
|
|
25649
|
+
}
|
|
25650
|
+
function parseRow2(row) {
|
|
25651
|
+
const installFallback = safeJsonParse2(row.install_fallback, null);
|
|
25652
|
+
return {
|
|
25653
|
+
id: row.id,
|
|
25654
|
+
displayName: row.display_name,
|
|
25655
|
+
description: row.description || null,
|
|
25656
|
+
endpoint: row.endpoint || null,
|
|
25657
|
+
transport: row.transport,
|
|
25658
|
+
fallbackEndpoints: safeJsonParse2(row.fallback_endpoints, []),
|
|
25659
|
+
authType: row.auth_type,
|
|
25660
|
+
authMetadata: safeJsonParse2(row.auth_metadata, {}),
|
|
25661
|
+
scopes: safeJsonParse2(row.scopes, []),
|
|
25662
|
+
tokenMode: row.token_mode,
|
|
25663
|
+
installFallback,
|
|
25664
|
+
docsUrl: row.docs_url || null,
|
|
25665
|
+
safety: safeJsonParse2(row.safety, {}),
|
|
25666
|
+
provenance: safeJsonParse2(row.provenance, { source: "manual" }),
|
|
25667
|
+
enabled: row.enabled === 1 || row.enabled === true,
|
|
25668
|
+
created_at: row.created_at,
|
|
25669
|
+
updated_at: row.updated_at
|
|
25670
|
+
};
|
|
25671
|
+
}
|
|
25672
|
+
function upsertProviderProfile(opts) {
|
|
25673
|
+
const db2 = getDb();
|
|
25674
|
+
const id = normalizeId(opts.id);
|
|
25675
|
+
const displayName = normalizeString(opts.displayName);
|
|
25676
|
+
if (!displayName)
|
|
25677
|
+
throw new Error("Provider profile displayName is required");
|
|
25678
|
+
const transport = assertKnown(opts.transport, TRANSPORTS, "transport");
|
|
25679
|
+
const fallbackEndpoints = normalizeFallbackEndpoints(opts.fallbackEndpoints);
|
|
25680
|
+
const authType = assertKnown(opts.authType, AUTH_TYPES, "auth type");
|
|
25681
|
+
const authMetadata = normalizeAuthMetadata(opts.authMetadata);
|
|
25682
|
+
const tokenMode = assertKnown(opts.tokenMode ?? "none", TOKEN_MODES, "token mode");
|
|
25683
|
+
const scopes = normalizeScopes(opts.scopes);
|
|
25684
|
+
const installFallback = normalizeInstallFallback(opts.installFallback);
|
|
25685
|
+
const provenance = normalizeProvenance(opts.provenance);
|
|
25686
|
+
const safety = opts.safety ?? {};
|
|
25687
|
+
const enabled = opts.enabled === false ? 0 : 1;
|
|
25688
|
+
const row = db2.prepare(`INSERT INTO provider_profiles (
|
|
25689
|
+
id, display_name, description, endpoint, transport, fallback_endpoints, auth_type, auth_metadata, scopes,
|
|
25690
|
+
token_mode, install_fallback, docs_url, safety, provenance, enabled
|
|
25691
|
+
)
|
|
25692
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
25693
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
25694
|
+
display_name = excluded.display_name,
|
|
25695
|
+
description = excluded.description,
|
|
25696
|
+
endpoint = excluded.endpoint,
|
|
25697
|
+
transport = excluded.transport,
|
|
25698
|
+
fallback_endpoints = excluded.fallback_endpoints,
|
|
25699
|
+
auth_type = excluded.auth_type,
|
|
25700
|
+
auth_metadata = excluded.auth_metadata,
|
|
25701
|
+
scopes = excluded.scopes,
|
|
25702
|
+
token_mode = excluded.token_mode,
|
|
25703
|
+
install_fallback = excluded.install_fallback,
|
|
25704
|
+
docs_url = excluded.docs_url,
|
|
25705
|
+
safety = excluded.safety,
|
|
25706
|
+
provenance = excluded.provenance,
|
|
25707
|
+
enabled = excluded.enabled,
|
|
25708
|
+
updated_at = datetime('now')
|
|
25709
|
+
RETURNING *`).get(id, displayName, normalizeString(opts.description), normalizeString(opts.endpoint), transport, JSON.stringify(fallbackEndpoints), authType, JSON.stringify(authMetadata), JSON.stringify(scopes), tokenMode, JSON.stringify(installFallback), normalizeString(opts.docsUrl), JSON.stringify(safety), JSON.stringify(provenance), enabled);
|
|
25710
|
+
return parseRow2(row);
|
|
25711
|
+
}
|
|
25712
|
+
function listProviderProfiles(options = {}) {
|
|
25713
|
+
const db2 = getDb();
|
|
25714
|
+
const sql = options.enabledOnly ? "SELECT * FROM provider_profiles WHERE enabled = 1 ORDER BY display_name" : "SELECT * FROM provider_profiles ORDER BY display_name";
|
|
25715
|
+
return db2.prepare(sql).all().map(parseRow2);
|
|
25716
|
+
}
|
|
25717
|
+
function searchProviderProfiles(query, options = {}) {
|
|
25718
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
25719
|
+
if (!normalizedQuery)
|
|
25720
|
+
return listProviderProfiles(options);
|
|
25721
|
+
return listProviderProfiles(options).filter((profile) => {
|
|
25722
|
+
const searchable = [
|
|
25723
|
+
profile.id,
|
|
25724
|
+
profile.displayName,
|
|
25725
|
+
profile.description ?? "",
|
|
25726
|
+
profile.endpoint ?? "",
|
|
25727
|
+
profile.docsUrl ?? "",
|
|
25728
|
+
profile.provenance.sourceUrl ?? "",
|
|
25729
|
+
profile.provenance.packageName ?? ""
|
|
25730
|
+
].join(`
|
|
25731
|
+
`).toLowerCase();
|
|
25732
|
+
return searchable.includes(normalizedQuery);
|
|
25733
|
+
});
|
|
25734
|
+
}
|
|
25735
|
+
function getProviderProfile(id) {
|
|
25736
|
+
const db2 = getDb();
|
|
25737
|
+
const row = db2.prepare("SELECT * FROM provider_profiles WHERE id = ?").get(normalizeId(id));
|
|
25738
|
+
return row ? parseRow2(row) : null;
|
|
25739
|
+
}
|
|
25740
|
+
function removeProviderProfile(id) {
|
|
25741
|
+
const db2 = getDb();
|
|
25742
|
+
db2.prepare("DELETE FROM provider_profiles WHERE id = ?").run(normalizeId(id));
|
|
25743
|
+
}
|
|
25744
|
+
function enableProviderProfile(id) {
|
|
25745
|
+
return setProviderProfileEnabled(id, true);
|
|
25746
|
+
}
|
|
25747
|
+
function disableProviderProfile(id) {
|
|
25748
|
+
return setProviderProfileEnabled(id, false);
|
|
25749
|
+
}
|
|
25750
|
+
function seedDefaultProviderProfiles() {
|
|
25751
|
+
return DEFAULT_PROVIDER_PROFILE_SEEDS.map((profile) => upsertProviderProfile(profile));
|
|
25752
|
+
}
|
|
25753
|
+
function installProviderProfile(id, options = {}) {
|
|
25754
|
+
const profile = getProviderProfile(id);
|
|
25755
|
+
if (!profile)
|
|
25756
|
+
throw new Error(`Provider profile "${id}" not found`);
|
|
25757
|
+
if (!profile.enabled)
|
|
25758
|
+
throw new Error(`Provider profile "${id}" is disabled`);
|
|
25759
|
+
const fallback = profile.installFallback;
|
|
25760
|
+
const useFallback = options.useFallback || !profile.endpoint;
|
|
25761
|
+
const command = useFallback ? fallback?.command : fallback?.command ?? "npx";
|
|
25762
|
+
const args = useFallback ? fallback?.args ?? [] : fallback?.args ?? [];
|
|
25763
|
+
if (!command) {
|
|
25764
|
+
throw new Error(`Provider profile "${id}" does not define an install fallback command`);
|
|
25765
|
+
}
|
|
25766
|
+
return addServer({
|
|
25767
|
+
name: options.name ?? profile.displayName,
|
|
25768
|
+
description: profile.description ?? undefined,
|
|
25769
|
+
command,
|
|
25770
|
+
args,
|
|
25771
|
+
transport: useFallback ? "stdio" : profile.transport,
|
|
25772
|
+
url: useFallback ? fallback?.url : profile.endpoint ?? undefined,
|
|
25773
|
+
source: "provider-profile"
|
|
25774
|
+
});
|
|
25775
|
+
}
|
|
25776
|
+
function setProviderProfileEnabled(id, enabled) {
|
|
25777
|
+
const db2 = getDb();
|
|
25778
|
+
const row = db2.prepare("UPDATE provider_profiles SET enabled = ?, updated_at = datetime('now') WHERE id = ? RETURNING *").get(enabled ? 1 : 0, normalizeId(id));
|
|
25779
|
+
if (!row) {
|
|
25780
|
+
throw new Error(`Provider profile "${id}" not found`);
|
|
25781
|
+
}
|
|
25782
|
+
return parseRow2(row);
|
|
25783
|
+
}
|
|
25784
|
+
|
|
25785
|
+
// src/index.ts
|
|
25786
|
+
init_provider_profile_seeds();
|
|
25787
|
+
|
|
25428
25788
|
// src/lib/install.ts
|
|
25429
25789
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
25430
25790
|
import { existsSync as existsSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync3, mkdirSync as mkdirSync7 } from "fs";
|
|
@@ -25510,7 +25870,7 @@ function installToAgents(entry, targets = ["claude", "codex", "gemini"]) {
|
|
|
25510
25870
|
// src/lib/machines.ts
|
|
25511
25871
|
init_db();
|
|
25512
25872
|
import { userInfo } from "os";
|
|
25513
|
-
function
|
|
25873
|
+
function parseRow3(row) {
|
|
25514
25874
|
return {
|
|
25515
25875
|
id: row.id,
|
|
25516
25876
|
name: row.name,
|
|
@@ -25553,12 +25913,12 @@ function toSqlBool(value, fallback = true) {
|
|
|
25553
25913
|
function listMachines() {
|
|
25554
25914
|
const db2 = getDb();
|
|
25555
25915
|
const rows = db2.prepare("SELECT * FROM machines ORDER BY name ASC").all();
|
|
25556
|
-
return rows.map(
|
|
25916
|
+
return rows.map(parseRow3);
|
|
25557
25917
|
}
|
|
25558
25918
|
function getMachine(id) {
|
|
25559
25919
|
const db2 = getDb();
|
|
25560
25920
|
const row = db2.prepare("SELECT * FROM machines WHERE id = ?").get(id);
|
|
25561
|
-
return row ?
|
|
25921
|
+
return row ? parseRow3(row) : null;
|
|
25562
25922
|
}
|
|
25563
25923
|
function addMachine(opts) {
|
|
25564
25924
|
const db2 = getDb();
|
|
@@ -25573,7 +25933,7 @@ function addMachine(opts) {
|
|
|
25573
25933
|
id, name, host, username, port, platform, arch, bun_path, npm_path, installer, ssh_key_path, enabled
|
|
25574
25934
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
25575
25935
|
RETURNING *`).get(id, name, host, normalizeText(opts.username) ?? resolveDefaultUser(), opts.port ?? 22, opts.platform ?? "unknown", opts.arch ?? "unknown", normalizeText(opts.bun_path) ?? null, normalizeText(opts.npm_path) ?? null, opts.installer ?? "auto", normalizeText(opts.ssh_key_path) ?? null, toSqlBool(opts.enabled, true));
|
|
25576
|
-
return
|
|
25936
|
+
return parseRow3(row);
|
|
25577
25937
|
}
|
|
25578
25938
|
function upsertMachine(opts) {
|
|
25579
25939
|
const db2 = getDb();
|
|
@@ -25601,7 +25961,7 @@ function upsertMachine(opts) {
|
|
|
25601
25961
|
enabled = excluded.enabled,
|
|
25602
25962
|
updated_at = datetime('now')
|
|
25603
25963
|
RETURNING *`).get(id, name, host, normalizeText(opts.username) ?? resolveDefaultUser(), opts.port ?? 22, opts.platform ?? "unknown", opts.arch ?? "unknown", normalizeText(opts.bun_path) ?? null, normalizeText(opts.npm_path) ?? null, opts.installer ?? "auto", normalizeText(opts.ssh_key_path) ?? null, toSqlBool(opts.enabled, true));
|
|
25604
|
-
return
|
|
25964
|
+
return parseRow3(row);
|
|
25605
25965
|
}
|
|
25606
25966
|
function updateMachine(id, updates) {
|
|
25607
25967
|
const db2 = getDb();
|
|
@@ -25664,7 +26024,7 @@ function updateMachine(id, updates) {
|
|
|
25664
26024
|
const row = db2.prepare(`UPDATE machines SET ${sets.join(", ")} WHERE id = ? RETURNING *`).get(...values);
|
|
25665
26025
|
if (!row)
|
|
25666
26026
|
throw new Error(`Machine "${id}" not found`);
|
|
25667
|
-
return
|
|
26027
|
+
return parseRow3(row);
|
|
25668
26028
|
}
|
|
25669
26029
|
function removeMachine(id) {
|
|
25670
26030
|
const db2 = getDb();
|
|
@@ -26431,42 +26791,51 @@ function readPackageVersion(moduleUrl, fallback = FALLBACK_VERSION) {
|
|
|
26431
26791
|
// src/index.ts
|
|
26432
26792
|
init_db();
|
|
26433
26793
|
export {
|
|
26794
|
+
upsertProviderProfile,
|
|
26434
26795
|
upsertMachine,
|
|
26435
26796
|
updateServer,
|
|
26436
26797
|
updateMachine,
|
|
26437
26798
|
unsetServerEnv,
|
|
26438
26799
|
setServerEnv,
|
|
26800
|
+
seedDefaultProviderProfiles,
|
|
26439
26801
|
seedDefaultMachines,
|
|
26440
26802
|
searchRegistry,
|
|
26803
|
+
searchProviderProfiles,
|
|
26441
26804
|
runFleetInstall,
|
|
26442
26805
|
runFleetHealthCheck,
|
|
26443
26806
|
removeSource,
|
|
26444
26807
|
removeServer,
|
|
26808
|
+
removeProviderProfile,
|
|
26445
26809
|
removeMachine,
|
|
26446
26810
|
refreshTools,
|
|
26447
26811
|
readPackageVersion,
|
|
26448
26812
|
listSources,
|
|
26449
26813
|
listServers,
|
|
26814
|
+
listProviderProfiles,
|
|
26450
26815
|
listMachines,
|
|
26451
26816
|
listHasnaMcpCatalog,
|
|
26452
26817
|
listAwesomeServers,
|
|
26453
26818
|
listAllTools,
|
|
26454
26819
|
installToAgents,
|
|
26820
|
+
installProviderProfile,
|
|
26455
26821
|
installFromRegistry,
|
|
26456
26822
|
getToolCounts,
|
|
26457
26823
|
getSource,
|
|
26458
26824
|
getServer,
|
|
26459
26825
|
getRegistryServer,
|
|
26826
|
+
getProviderProfile,
|
|
26460
26827
|
getMachine,
|
|
26461
26828
|
getDb,
|
|
26462
26829
|
getCachedTools,
|
|
26463
26830
|
findServers,
|
|
26464
26831
|
enableSource,
|
|
26465
26832
|
enableServer,
|
|
26833
|
+
enableProviderProfile,
|
|
26466
26834
|
disconnectServer,
|
|
26467
26835
|
disconnectAll,
|
|
26468
26836
|
disableSource,
|
|
26469
26837
|
disableServer,
|
|
26838
|
+
disableProviderProfile,
|
|
26470
26839
|
diagnoseServer,
|
|
26471
26840
|
connectToServer,
|
|
26472
26841
|
closeDb,
|
|
@@ -26475,5 +26844,6 @@ export {
|
|
|
26475
26844
|
addSource,
|
|
26476
26845
|
addServer,
|
|
26477
26846
|
addMachine,
|
|
26847
|
+
DEFAULT_PROVIDER_PROFILE_SEEDS,
|
|
26478
26848
|
DEFAULT_MACHINE_SEEDS
|
|
26479
26849
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InstallProviderProfileOptions, McpServerEntry, ProviderProfile, UpsertProviderProfileOptions } from "../types.js";
|
|
2
|
+
export declare function upsertProviderProfile(opts: UpsertProviderProfileOptions): ProviderProfile;
|
|
3
|
+
export declare function listProviderProfiles(options?: {
|
|
4
|
+
enabledOnly?: boolean;
|
|
5
|
+
}): ProviderProfile[];
|
|
6
|
+
export declare function searchProviderProfiles(query: string, options?: {
|
|
7
|
+
enabledOnly?: boolean;
|
|
8
|
+
}): ProviderProfile[];
|
|
9
|
+
export declare function getProviderProfile(id: string): ProviderProfile | null;
|
|
10
|
+
export declare function removeProviderProfile(id: string): void;
|
|
11
|
+
export declare function enableProviderProfile(id: string): ProviderProfile;
|
|
12
|
+
export declare function disableProviderProfile(id: string): ProviderProfile;
|
|
13
|
+
export declare function seedDefaultProviderProfiles(): ProviderProfile[];
|
|
14
|
+
export declare function installProviderProfile(id: string, options?: InstallProviderProfileOptions): McpServerEntry;
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
export { createMcpServer, VERSION } from "./server.js";
|
|
3
|
+
export { buildMcpTools, listTools, registerMcpTools, tools, } from "./tools.js";
|
|
4
|
+
export type { McpsMcpToolDefinition } from "./tools.js";
|
|
1
5
|
export declare function startMcpServer(): Promise<void>;
|