@topolo/mcp 0.9.5 → 0.9.6
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/index.js +75 -24
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -301,7 +301,9 @@ var APPLICATIONS = {
|
|
|
301
301
|
"domains": [
|
|
302
302
|
"bugfix.topolo.app"
|
|
303
303
|
],
|
|
304
|
-
"routes": [
|
|
304
|
+
"routes": [
|
|
305
|
+
"bugfix.topolo.app"
|
|
306
|
+
],
|
|
305
307
|
"appId": "bugfix"
|
|
306
308
|
}
|
|
307
309
|
]
|
|
@@ -417,7 +419,9 @@ var APPLICATIONS = {
|
|
|
417
419
|
"domains": [
|
|
418
420
|
"capacity.topolo.app"
|
|
419
421
|
],
|
|
420
|
-
"routes": [
|
|
422
|
+
"routes": [
|
|
423
|
+
"capacity.topolo.app"
|
|
424
|
+
],
|
|
421
425
|
"appId": "capacity"
|
|
422
426
|
}
|
|
423
427
|
]
|
|
@@ -1159,7 +1163,9 @@ var APPLICATIONS = {
|
|
|
1159
1163
|
"domains": [
|
|
1160
1164
|
"observability-watch.topolo.app"
|
|
1161
1165
|
],
|
|
1162
|
-
"routes": [
|
|
1166
|
+
"routes": [
|
|
1167
|
+
"observability-watch.topolo.app"
|
|
1168
|
+
],
|
|
1163
1169
|
"appId": "observability_watch"
|
|
1164
1170
|
}
|
|
1165
1171
|
]
|
|
@@ -4654,21 +4660,49 @@ async function resolveMcpCredential(environment, selector = process.env.TOPOLO_C
|
|
|
4654
4660
|
}
|
|
4655
4661
|
|
|
4656
4662
|
// src/index.ts
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4663
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4664
|
+
import { resolve } from "path";
|
|
4665
|
+
function readStdioEnvironment() {
|
|
4666
|
+
return process.env.TOPOLO_ENV;
|
|
4667
|
+
}
|
|
4668
|
+
function createStdioTransport() {
|
|
4669
|
+
return new StdioServerTransport();
|
|
4670
|
+
}
|
|
4671
|
+
function writeStdioError(message) {
|
|
4672
|
+
process.stderr.write(message);
|
|
4673
|
+
}
|
|
4674
|
+
function exitStdioProcess(code) {
|
|
4675
|
+
return process.exit(code);
|
|
4676
|
+
}
|
|
4677
|
+
var DEFAULT_DEPENDENCIES2 = {
|
|
4678
|
+
normalizeEnvironment,
|
|
4679
|
+
environmentValue: readStdioEnvironment,
|
|
4680
|
+
resolveCredential: resolveMcpCredential,
|
|
4681
|
+
readConfig,
|
|
4682
|
+
profileForEnvironment,
|
|
4683
|
+
resolveAgentName,
|
|
4684
|
+
resolveServiceUrls,
|
|
4685
|
+
createTopolo,
|
|
4686
|
+
buildServer,
|
|
4687
|
+
createTransport: createStdioTransport,
|
|
4688
|
+
advertisedToolNames,
|
|
4689
|
+
writeStderr: writeStdioError,
|
|
4690
|
+
exit: exitStdioProcess
|
|
4691
|
+
};
|
|
4692
|
+
async function runStdioMcp(dependencies = DEFAULT_DEPENDENCIES2) {
|
|
4693
|
+
const environment = dependencies.normalizeEnvironment(dependencies.environmentValue());
|
|
4694
|
+
const resolvedCredential = await dependencies.resolveCredential(environment);
|
|
4660
4695
|
const credential = resolvedCredential.credential;
|
|
4661
4696
|
if (!credential) {
|
|
4662
|
-
|
|
4663
|
-
"
|
|
4697
|
+
throw new TopoloMcpPublicError(
|
|
4698
|
+
"no Topolo credential. Run `topolo auth login`, or set TOPOLO_API_KEY / TOPOLO_ACCESS_TOKEN."
|
|
4664
4699
|
);
|
|
4665
|
-
process.exit(1);
|
|
4666
4700
|
}
|
|
4667
|
-
const config = await readConfig();
|
|
4668
|
-
const profile = profileForEnvironment(config, environment);
|
|
4669
|
-
const agentName = resolveAgentName(profile.agentName);
|
|
4670
|
-
const serviceUrls = resolveServiceUrls(profile.serviceUrls, environment);
|
|
4671
|
-
const topolo = createTopolo({
|
|
4701
|
+
const config = await dependencies.readConfig();
|
|
4702
|
+
const profile = dependencies.profileForEnvironment(config, environment);
|
|
4703
|
+
const agentName = dependencies.resolveAgentName(profile.agentName);
|
|
4704
|
+
const serviceUrls = dependencies.resolveServiceUrls(profile.serviceUrls, environment);
|
|
4705
|
+
const topolo = dependencies.createTopolo({
|
|
4672
4706
|
credential,
|
|
4673
4707
|
agent: {
|
|
4674
4708
|
clientName: "topolo-mcp",
|
|
@@ -4681,11 +4715,11 @@ async function main() {
|
|
|
4681
4715
|
...resolvedCredential.refreshCredential ? { refreshCredential: resolvedCredential.refreshCredential } : {}
|
|
4682
4716
|
});
|
|
4683
4717
|
const scopes = await loadScopes(topolo);
|
|
4684
|
-
const server = buildServer(topolo, scopes);
|
|
4685
|
-
const transport =
|
|
4718
|
+
const server = dependencies.buildServer(topolo, scopes);
|
|
4719
|
+
const transport = dependencies.createTransport();
|
|
4686
4720
|
await server.connect(transport);
|
|
4687
|
-
const toolNames = await advertisedToolNames(topolo, scopes);
|
|
4688
|
-
|
|
4721
|
+
const toolNames = await dependencies.advertisedToolNames(topolo, scopes);
|
|
4722
|
+
dependencies.writeStderr(
|
|
4689
4723
|
`TopoloMCP v${MCP_VERSION} connected (${environment}${resolvedCredential.contextKey ? `, ${resolvedCredential.contextKey}` : ""}). Tools available: ${toolNames.join(", ") || "(none)"}
|
|
4690
4724
|
`
|
|
4691
4725
|
);
|
|
@@ -4701,14 +4735,31 @@ async function loadScopes(topolo) {
|
|
|
4701
4735
|
};
|
|
4702
4736
|
} catch (err) {
|
|
4703
4737
|
if (err instanceof TopoloAuthError) {
|
|
4704
|
-
|
|
4705
|
-
process.exit(1);
|
|
4738
|
+
throw new TopoloMcpPublicError("credential rejected.");
|
|
4706
4739
|
}
|
|
4707
4740
|
throw err;
|
|
4708
4741
|
}
|
|
4709
4742
|
}
|
|
4710
|
-
|
|
4711
|
-
|
|
4743
|
+
function terminateStdioMcp(error, dependencies = DEFAULT_DEPENDENCIES2) {
|
|
4744
|
+
const isPublic = error instanceof TopoloMcpPublicError;
|
|
4745
|
+
const message = publicMcpErrorMessage(error, "Unexpected startup failure.");
|
|
4746
|
+
dependencies.writeStderr(`TopoloMCP${isPublic ? "" : " fatal"}: ${message}
|
|
4712
4747
|
`);
|
|
4713
|
-
|
|
4714
|
-
}
|
|
4748
|
+
return dependencies.exit(1);
|
|
4749
|
+
}
|
|
4750
|
+
function isDirectExecution(moduleUrl, argvEntry) {
|
|
4751
|
+
return Boolean(argvEntry && fileURLToPath2(moduleUrl) === resolve(argvEntry));
|
|
4752
|
+
}
|
|
4753
|
+
if (isDirectExecution(import.meta.url, process.argv[1])) {
|
|
4754
|
+
void runStdioMcp().catch((error) => terminateStdioMcp(error));
|
|
4755
|
+
}
|
|
4756
|
+
export {
|
|
4757
|
+
createStdioTransport,
|
|
4758
|
+
exitStdioProcess,
|
|
4759
|
+
isDirectExecution,
|
|
4760
|
+
loadScopes,
|
|
4761
|
+
readStdioEnvironment,
|
|
4762
|
+
runStdioMcp,
|
|
4763
|
+
terminateStdioMcp,
|
|
4764
|
+
writeStdioError
|
|
4765
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/mcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Model Context Protocol server for the Topolo platform. Exposes scope-gated tools that third-party agents (Claude, Codex, etc.) can call natively.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@topolo/sdk": "^0.9.
|
|
39
|
+
"@topolo/sdk": "^0.9.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@topolo/sdk": "file:../topolo-sdk",
|