@uniswap/ai-toolkit-claude-mcp-helper 1.0.18-next.2 → 1.0.18-next.4
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/claude-mcp-helper.cjs +106 -14
- package/dist/packages/claude-mcp-helper/src/config/reader.d.ts +18 -1
- package/dist/packages/claude-mcp-helper/src/config/reader.d.ts.map +1 -1
- package/dist/packages/claude-mcp-helper/src/config/writer.d.ts +21 -2
- package/dist/packages/claude-mcp-helper/src/config/writer.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4660,6 +4660,12 @@ function extractPluginName(pluginKey) {
|
|
|
4660
4660
|
const atIndex = pluginKey.indexOf("@");
|
|
4661
4661
|
return atIndex > 0 ? pluginKey.substring(0, atIndex) : pluginKey;
|
|
4662
4662
|
}
|
|
4663
|
+
function buildPluginServerName(pluginName, serverName) {
|
|
4664
|
+
return `plugin:${pluginName}:${serverName}`;
|
|
4665
|
+
}
|
|
4666
|
+
function isPluginServerName(name) {
|
|
4667
|
+
return name.startsWith("plugin:");
|
|
4668
|
+
}
|
|
4663
4669
|
function getPluginMcpServers() {
|
|
4664
4670
|
const serverToPlugin = /* @__PURE__ */ new Map();
|
|
4665
4671
|
const installedPlugins = readInstalledPlugins();
|
|
@@ -4670,8 +4676,9 @@ function getPluginMcpServers() {
|
|
|
4670
4676
|
const mcpConfig = readPluginMcpConfig(installation.installPath);
|
|
4671
4677
|
if (mcpConfig.mcpServers) {
|
|
4672
4678
|
for (const serverName of Object.keys(mcpConfig.mcpServers)) {
|
|
4673
|
-
|
|
4674
|
-
|
|
4679
|
+
const fullName = buildPluginServerName(pluginName, serverName);
|
|
4680
|
+
if (!serverToPlugin.has(fullName)) {
|
|
4681
|
+
serverToPlugin.set(fullName, pluginName);
|
|
4675
4682
|
}
|
|
4676
4683
|
}
|
|
4677
4684
|
}
|
|
@@ -4907,7 +4914,36 @@ function ensureClaudeDirectory() {
|
|
|
4907
4914
|
(0, import_fs2.mkdirSync)(configDir, { recursive: true });
|
|
4908
4915
|
}
|
|
4909
4916
|
}
|
|
4917
|
+
function updateGlobalConfigPluginServers(disabledPluginServers) {
|
|
4918
|
+
const configPath = getGlobalConfigPath();
|
|
4919
|
+
const cwd = process.cwd();
|
|
4920
|
+
let config = {};
|
|
4921
|
+
if ((0, import_fs2.existsSync)(configPath)) {
|
|
4922
|
+
try {
|
|
4923
|
+
const content = (0, import_fs2.readFileSync)(configPath, "utf-8");
|
|
4924
|
+
config = JSON.parse(content);
|
|
4925
|
+
} catch (error) {
|
|
4926
|
+
console.error(`Failed to read global config: ${error}`);
|
|
4927
|
+
config = {};
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
if (!config.projects) {
|
|
4931
|
+
config.projects = {};
|
|
4932
|
+
}
|
|
4933
|
+
if (!config.projects[cwd]) {
|
|
4934
|
+
config.projects[cwd] = {};
|
|
4935
|
+
}
|
|
4936
|
+
config.projects[cwd].disabledMcpServers = disabledPluginServers;
|
|
4937
|
+
try {
|
|
4938
|
+
(0, import_fs2.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
4939
|
+
} catch (error) {
|
|
4940
|
+
throw new Error(`Failed to write global config: ${error}`);
|
|
4941
|
+
}
|
|
4942
|
+
}
|
|
4910
4943
|
function updateLocalConfig(deniedServers) {
|
|
4944
|
+
const pluginServers = deniedServers.filter((s) => isPluginServerName(s));
|
|
4945
|
+
const regularServers = deniedServers.filter((s) => !isPluginServerName(s));
|
|
4946
|
+
updateGlobalConfigPluginServers(pluginServers);
|
|
4911
4947
|
ensureClaudeDirectory();
|
|
4912
4948
|
const configPath = getLocalConfigPath();
|
|
4913
4949
|
let config = {};
|
|
@@ -4916,22 +4952,78 @@ function updateLocalConfig(deniedServers) {
|
|
|
4916
4952
|
const content = (0, import_fs2.readFileSync)(configPath, "utf-8");
|
|
4917
4953
|
config = JSON.parse(content);
|
|
4918
4954
|
} catch (error) {
|
|
4919
|
-
console.error(
|
|
4920
|
-
`Failed to read existing config, creating new one: ${error}`
|
|
4921
|
-
);
|
|
4955
|
+
console.error(`Failed to read existing config, creating new one: ${error}`);
|
|
4922
4956
|
config = {};
|
|
4923
4957
|
}
|
|
4924
4958
|
}
|
|
4925
|
-
config.deniedMcpServers =
|
|
4926
|
-
(serverName) => ({ serverName })
|
|
4927
|
-
);
|
|
4959
|
+
config.deniedMcpServers = regularServers.map((serverName) => ({ serverName }));
|
|
4928
4960
|
try {
|
|
4929
4961
|
(0, import_fs2.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
4930
4962
|
} catch (error) {
|
|
4931
4963
|
throw new Error(`Failed to write config: ${error}`);
|
|
4932
4964
|
}
|
|
4933
4965
|
}
|
|
4966
|
+
function enablePluginServer(serverName) {
|
|
4967
|
+
const configPath = getGlobalConfigPath();
|
|
4968
|
+
const cwd = process.cwd();
|
|
4969
|
+
if (!(0, import_fs2.existsSync)(configPath)) {
|
|
4970
|
+
return;
|
|
4971
|
+
}
|
|
4972
|
+
let config;
|
|
4973
|
+
try {
|
|
4974
|
+
const content = (0, import_fs2.readFileSync)(configPath, "utf-8");
|
|
4975
|
+
config = JSON.parse(content);
|
|
4976
|
+
} catch (error) {
|
|
4977
|
+
throw new Error(`Failed to read global config: ${error}`);
|
|
4978
|
+
}
|
|
4979
|
+
if (!config.projects?.[cwd]?.disabledMcpServers) {
|
|
4980
|
+
return;
|
|
4981
|
+
}
|
|
4982
|
+
config.projects[cwd].disabledMcpServers = config.projects[cwd].disabledMcpServers.filter(
|
|
4983
|
+
(name) => name !== serverName
|
|
4984
|
+
);
|
|
4985
|
+
try {
|
|
4986
|
+
(0, import_fs2.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
4987
|
+
} catch (error) {
|
|
4988
|
+
throw new Error(`Failed to write global config: ${error}`);
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
function disablePluginServer(serverName) {
|
|
4992
|
+
const configPath = getGlobalConfigPath();
|
|
4993
|
+
const cwd = process.cwd();
|
|
4994
|
+
let config = {};
|
|
4995
|
+
if ((0, import_fs2.existsSync)(configPath)) {
|
|
4996
|
+
try {
|
|
4997
|
+
const content = (0, import_fs2.readFileSync)(configPath, "utf-8");
|
|
4998
|
+
config = JSON.parse(content);
|
|
4999
|
+
} catch (error) {
|
|
5000
|
+
console.error(`Failed to read global config: ${error}`);
|
|
5001
|
+
config = {};
|
|
5002
|
+
}
|
|
5003
|
+
}
|
|
5004
|
+
if (!config.projects) {
|
|
5005
|
+
config.projects = {};
|
|
5006
|
+
}
|
|
5007
|
+
if (!config.projects[cwd]) {
|
|
5008
|
+
config.projects[cwd] = {};
|
|
5009
|
+
}
|
|
5010
|
+
if (!config.projects[cwd].disabledMcpServers) {
|
|
5011
|
+
config.projects[cwd].disabledMcpServers = [];
|
|
5012
|
+
}
|
|
5013
|
+
if (!config.projects[cwd].disabledMcpServers.includes(serverName)) {
|
|
5014
|
+
config.projects[cwd].disabledMcpServers.push(serverName);
|
|
5015
|
+
}
|
|
5016
|
+
try {
|
|
5017
|
+
(0, import_fs2.writeFileSync)(configPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
5018
|
+
} catch (error) {
|
|
5019
|
+
throw new Error(`Failed to write global config: ${error}`);
|
|
5020
|
+
}
|
|
5021
|
+
}
|
|
4934
5022
|
function enableServer(serverName) {
|
|
5023
|
+
if (isPluginServerName(serverName)) {
|
|
5024
|
+
enablePluginServer(serverName);
|
|
5025
|
+
return;
|
|
5026
|
+
}
|
|
4935
5027
|
const configPath = getLocalConfigPath();
|
|
4936
5028
|
if (!(0, import_fs2.existsSync)(configPath)) {
|
|
4937
5029
|
return;
|
|
@@ -4956,6 +5048,10 @@ function enableServer(serverName) {
|
|
|
4956
5048
|
}
|
|
4957
5049
|
}
|
|
4958
5050
|
function disableServer(serverName) {
|
|
5051
|
+
if (isPluginServerName(serverName)) {
|
|
5052
|
+
disablePluginServer(serverName);
|
|
5053
|
+
return;
|
|
5054
|
+
}
|
|
4959
5055
|
ensureClaudeDirectory();
|
|
4960
5056
|
const configPath = getLocalConfigPath();
|
|
4961
5057
|
let config = {};
|
|
@@ -4964,18 +5060,14 @@ function disableServer(serverName) {
|
|
|
4964
5060
|
const content = (0, import_fs2.readFileSync)(configPath, "utf-8");
|
|
4965
5061
|
config = JSON.parse(content);
|
|
4966
5062
|
} catch (error) {
|
|
4967
|
-
console.error(
|
|
4968
|
-
`Failed to read existing config, creating new one: ${error}`
|
|
4969
|
-
);
|
|
5063
|
+
console.error(`Failed to read existing config, creating new one: ${error}`);
|
|
4970
5064
|
config = {};
|
|
4971
5065
|
}
|
|
4972
5066
|
}
|
|
4973
5067
|
if (!config.deniedMcpServers) {
|
|
4974
5068
|
config.deniedMcpServers = [];
|
|
4975
5069
|
}
|
|
4976
|
-
const alreadyDenied = config.deniedMcpServers.some(
|
|
4977
|
-
(denied) => denied.serverName === serverName
|
|
4978
|
-
);
|
|
5070
|
+
const alreadyDenied = config.deniedMcpServers.some((denied) => denied.serverName === serverName);
|
|
4979
5071
|
if (!alreadyDenied) {
|
|
4980
5072
|
config.deniedMcpServers.push({ serverName });
|
|
4981
5073
|
}
|
|
@@ -38,9 +38,26 @@ export interface ServerInfo {
|
|
|
38
38
|
name: string;
|
|
39
39
|
origin: ServerOrigin;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Build the full qualified name for a plugin MCP server
|
|
43
|
+
* Format: "plugin:pluginName:serverName"
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildPluginServerName(pluginName: string, serverName: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a full qualified plugin server name back into components
|
|
48
|
+
* Returns null if the name is not a plugin server name
|
|
49
|
+
*/
|
|
50
|
+
export declare function parsePluginServerName(fullName: string): {
|
|
51
|
+
pluginName: string;
|
|
52
|
+
serverName: string;
|
|
53
|
+
} | null;
|
|
54
|
+
/**
|
|
55
|
+
* Check if a server name is a plugin server (starts with "plugin:")
|
|
56
|
+
*/
|
|
57
|
+
export declare function isPluginServerName(name: string): boolean;
|
|
41
58
|
/**
|
|
42
59
|
* Get all MCP servers from installed plugins
|
|
43
|
-
* Returns a map of server name to plugin name
|
|
60
|
+
* Returns a map of full qualified server name (plugin:pluginName:serverName) to plugin name
|
|
44
61
|
*/
|
|
45
62
|
export declare function getPluginMcpServers(): Map<string, string>;
|
|
46
63
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../../../../src/config/reader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,YAAY,CAc/C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,aAAa,CAc/C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,CAc7C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAc7D;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;CACtB;AA8BD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../../../../src/config/reader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,S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B,oBAAoB,IAAI,YAAY,EAAE,CAUrD;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAGvC"}
|
|
@@ -1,14 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Update global configuration (~/.claude.json) with disabled plugin servers
|
|
3
|
+
* Plugin servers need to be disabled in the global config's project-specific
|
|
4
|
+
* disabledMcpServers array, NOT in the local .claude/settings.local.json
|
|
5
|
+
*
|
|
6
|
+
* @param disabledPluginServers Array of full plugin server names (plugin:pluginName:serverName)
|
|
7
|
+
*/
|
|
8
|
+
export declare function updateGlobalConfigPluginServers(disabledPluginServers: string[]): void;
|
|
1
9
|
/**
|
|
2
10
|
* Update local configuration with denied servers
|
|
11
|
+
*
|
|
12
|
+
* This function handles both regular and plugin-installed MCP servers:
|
|
13
|
+
* - Regular servers (from mcp.json, ~/.claude.json mcpServers) are written to
|
|
14
|
+
* ./.claude/settings.local.json
|
|
15
|
+
* - Plugin servers (with names like "plugin:pluginName:serverName") are written to
|
|
16
|
+
* ~/.claude.json projects[cwd].disabledMcpServers
|
|
17
|
+
*
|
|
3
18
|
* @param deniedServers Array of server names that should be denied
|
|
4
19
|
*/
|
|
5
20
|
export declare function updateLocalConfig(deniedServers: string[]): void;
|
|
6
21
|
/**
|
|
7
|
-
* Enable a server by removing it from
|
|
22
|
+
* Enable a server by removing it from the appropriate config
|
|
23
|
+
* - Plugin servers are enabled by removing from ~/.claude.json projects[cwd].disabledMcpServers
|
|
24
|
+
* - Regular servers are enabled by removing from ./.claude/settings.local.json deniedMcpServers
|
|
8
25
|
*/
|
|
9
26
|
export declare function enableServer(serverName: string): void;
|
|
10
27
|
/**
|
|
11
|
-
* Disable a server by adding it to
|
|
28
|
+
* Disable a server by adding it to the appropriate config
|
|
29
|
+
* - Plugin servers are disabled by adding to ~/.claude.json projects[cwd].disabledMcpServers
|
|
30
|
+
* - Regular servers are disabled by adding to ./.claude/settings.local.json deniedMcpServers
|
|
12
31
|
*/
|
|
13
32
|
export declare function disableServer(serverName: string): void;
|
|
14
33
|
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../../../src/config/writer.ts"],"names":[],"mappings":"AAiBA
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../../../../src/config/writer.ts"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAC,qBAAqB,EAAE,MAAM,EAAE,GAAG,IAAI,CAsCrF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,IAAI,CAoC/D;AAsFD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAuCrD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CA0CtD"}
|