@evantahler/mcpx 0.18.1 → 0.18.3
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/package.json +6 -5
- package/src/cli.ts +11 -1
- package/src/client/debug-fetch.ts +4 -4
- package/src/client/oauth.ts +1 -1
- package/src/client/stdio.ts +1 -1
- package/src/commands/add.ts +2 -2
- package/src/output/formatter.ts +2 -2
- package/src/search/semantic.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evantahler/mcpx",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "A command-line interface for MCP servers. curl for MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dev": "bun run src/cli.ts",
|
|
24
24
|
"test": "bun test",
|
|
25
25
|
"test:e2e": "bun test test/integration/remote-server.test.ts",
|
|
26
|
-
"lint": "prettier --check .",
|
|
26
|
+
"lint": "prettier --check . && tsc --noEmit",
|
|
27
27
|
"format": "prettier --write .",
|
|
28
28
|
"build": "bun build --compile --minify --sourcemap ./src/cli.ts --outfile dist/mcpx"
|
|
29
29
|
},
|
|
@@ -51,12 +51,13 @@
|
|
|
51
51
|
"ansis": "^4.2.0",
|
|
52
52
|
"commander": "^14.0.3",
|
|
53
53
|
"nanospinner": "^1.2.2",
|
|
54
|
-
"picomatch": "^4.0.3"
|
|
54
|
+
"picomatch": "^4.0.3",
|
|
55
|
+
"@types/picomatch": "^4.0.2"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@types/bun": "latest",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
59
|
+
"prettier": "^3.8.1",
|
|
60
|
+
"typescript": "^5"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"typescript": "^5"
|
package/src/cli.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
|
|
3
3
|
import { program } from "commander";
|
|
4
|
+
import { bold, cyan, yellow, dim, green } from "ansis";
|
|
4
5
|
import { registerListCommand } from "./commands/list.ts";
|
|
5
6
|
import { registerInfoCommand } from "./commands/info.ts";
|
|
6
7
|
import { registerSearchCommand } from "./commands/search.ts";
|
|
@@ -40,6 +41,15 @@ program
|
|
|
40
41
|
"warning",
|
|
41
42
|
);
|
|
42
43
|
|
|
44
|
+
program.configureHelp({
|
|
45
|
+
styleTitle: (str) => bold(str),
|
|
46
|
+
styleCommandText: (str) => cyan(str),
|
|
47
|
+
styleSubcommandText: (str) => cyan(str),
|
|
48
|
+
styleOptionText: (str) => yellow(str),
|
|
49
|
+
styleArgumentText: (str) => green(str),
|
|
50
|
+
styleDescriptionText: (str) => dim(str),
|
|
51
|
+
});
|
|
52
|
+
|
|
43
53
|
registerListCommand(program);
|
|
44
54
|
registerInfoCommand(program);
|
|
45
55
|
registerSearchCommand(program);
|
|
@@ -65,7 +75,7 @@ const knownCommands = new Set(program.commands.map((c) => c.name()));
|
|
|
65
75
|
const cliArgs = process.argv.slice(2);
|
|
66
76
|
let firstCommand: string | undefined;
|
|
67
77
|
for (let i = 0; i < cliArgs.length; i++) {
|
|
68
|
-
const a = cliArgs[i]
|
|
78
|
+
const a = cliArgs[i]!;
|
|
69
79
|
if (
|
|
70
80
|
a === "-c" ||
|
|
71
81
|
a === "--config" ||
|
|
@@ -38,7 +38,7 @@ function log(line: string) {
|
|
|
38
38
|
|
|
39
39
|
function logHeaders(
|
|
40
40
|
prefix: string,
|
|
41
|
-
headers:
|
|
41
|
+
headers: RequestInit["headers"],
|
|
42
42
|
fmt: (s: string) => string,
|
|
43
43
|
showSecrets: boolean,
|
|
44
44
|
) {
|
|
@@ -50,11 +50,11 @@ function logHeaders(
|
|
|
50
50
|
if (headers instanceof Headers) {
|
|
51
51
|
headers.forEach((value, key) => log(format(key, value)));
|
|
52
52
|
} else if (Array.isArray(headers)) {
|
|
53
|
-
for (const
|
|
54
|
-
log(format(
|
|
53
|
+
for (const pair of headers) {
|
|
54
|
+
log(format(String(pair[0]), String(pair[1])));
|
|
55
55
|
}
|
|
56
56
|
} else {
|
|
57
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
57
|
+
for (const [key, value] of Object.entries(headers as Record<string, string>)) {
|
|
58
58
|
log(format(key, value));
|
|
59
59
|
}
|
|
60
60
|
}
|
package/src/client/oauth.ts
CHANGED
|
@@ -301,7 +301,7 @@ export async function runOAuthFlow(serverUrl: string, provider: McpOAuthProvider
|
|
|
301
301
|
|
|
302
302
|
const { server, authCodePromise } = startCallbackServer();
|
|
303
303
|
try {
|
|
304
|
-
provider.setCallbackPort(server.port);
|
|
304
|
+
provider.setCallbackPort(server.port!);
|
|
305
305
|
|
|
306
306
|
const result = await auth(provider, { serverUrl });
|
|
307
307
|
if (result === "REDIRECT") {
|
package/src/client/stdio.ts
CHANGED
|
@@ -5,7 +5,7 @@ export function createStdioTransport(config: StdioServerConfig): StdioClientTran
|
|
|
5
5
|
return new StdioClientTransport({
|
|
6
6
|
command: config.command,
|
|
7
7
|
args: config.args,
|
|
8
|
-
env: config.env ? { ...process.env, ...config.env } : undefined,
|
|
8
|
+
env: config.env ? ({ ...process.env, ...config.env } as Record<string, string>) : undefined,
|
|
9
9
|
cwd: config.cwd,
|
|
10
10
|
stderr: "pipe",
|
|
11
11
|
});
|
package/src/commands/add.ts
CHANGED
|
@@ -156,7 +156,7 @@ function buildStdioConfig(options: {
|
|
|
156
156
|
config.cwd = options.cwd;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
return config as ServerConfig;
|
|
159
|
+
return config as unknown as ServerConfig;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
function buildHttpConfig(options: { url?: string; header?: string[] }): ServerConfig {
|
|
@@ -175,5 +175,5 @@ function buildHttpConfig(options: { url?: string; header?: string[] }): ServerCo
|
|
|
175
175
|
config.headers = headers;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
return config as ServerConfig;
|
|
178
|
+
return config as unknown as ServerConfig;
|
|
179
179
|
}
|
package/src/output/formatter.ts
CHANGED
|
@@ -166,7 +166,7 @@ export function formatServerOverview(overview: ServerOverview, options: FormatOp
|
|
|
166
166
|
const maxName = Math.max(...overview.tools.map((t) => t.name.length));
|
|
167
167
|
const termWidth = getTerminalWidth();
|
|
168
168
|
for (let i = 0; i < overview.tools.length; i++) {
|
|
169
|
-
const t = overview.tools[i]
|
|
169
|
+
const t = overview.tools[i]!;
|
|
170
170
|
if (i > 0) lines.push("");
|
|
171
171
|
const name = ` ${bold(t.name.padEnd(maxName))}`;
|
|
172
172
|
if (t.description) {
|
|
@@ -622,7 +622,7 @@ export function jsonToMarkdown(value: unknown, depth: number = 1, skipKey?: stri
|
|
|
622
622
|
|
|
623
623
|
/** Render a markdown string to ANSI-styled terminal output using Bun's built-in renderer */
|
|
624
624
|
export function renderMarkdownToAnsi(input: string): string {
|
|
625
|
-
const result = Bun.markdown.ansi(input);
|
|
625
|
+
const result = (Bun as any).markdown.ansi(input) as string;
|
|
626
626
|
const restored = restoreUrlPlaceholders(result);
|
|
627
627
|
resetUrlPlaceholders();
|
|
628
628
|
return restored;
|
package/src/search/semantic.ts
CHANGED
|
@@ -53,7 +53,7 @@ export function cosineSimilarity(a: number[], b: number[]): number {
|
|
|
53
53
|
export async function semanticSearch(
|
|
54
54
|
query: string,
|
|
55
55
|
tools: IndexedTool[],
|
|
56
|
-
topK = DEFAULTS.SEARCH_TOP_K,
|
|
56
|
+
topK: number = DEFAULTS.SEARCH_TOP_K,
|
|
57
57
|
): Promise<SemanticMatch[]> {
|
|
58
58
|
// Only search tools that have embeddings
|
|
59
59
|
const withEmbeddings = tools.filter((t) => t.embedding.length > 0);
|