Consistent MCP Client() name from package
Make both clients use name from package.json for consistency and protocol clarity - web client changes `mcp-inspector` -> `inspector-client` (package.json) - cli client remains `inspector-cli` (package.json)
This commit is contained in:
parent
d7b020fdda
commit
f942df7e4c
2 changed files with 21 additions and 16 deletions
|
|
@ -89,10 +89,12 @@ function createTransportOptions(
|
||||||
async function callMethod(args: Args): Promise<void> {
|
async function callMethod(args: Args): Promise<void> {
|
||||||
const transportOptions = createTransportOptions(args.target, args.transport);
|
const transportOptions = createTransportOptions(args.target, args.transport);
|
||||||
const transport = createTransport(transportOptions);
|
const transport = createTransport(transportOptions);
|
||||||
const client = new Client({
|
|
||||||
name: "inspector-cli",
|
const [, name = packageJson.name] = packageJson.name.split("/");
|
||||||
version: packageJson.version,
|
const version = packageJson.version;
|
||||||
});
|
const clientIdentity = { name, version };
|
||||||
|
|
||||||
|
const client = new Client(clientIdentity);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await connect(client, transport);
|
await connect(client, transport);
|
||||||
|
|
|
||||||
|
|
@ -347,20 +347,23 @@ export function useConnection({
|
||||||
};
|
};
|
||||||
|
|
||||||
const connect = async (_e?: unknown, retryCount: number = 0) => {
|
const connect = async (_e?: unknown, retryCount: number = 0) => {
|
||||||
const client = new Client<Request, Notification, Result>(
|
const [, name = packageJson.name] = packageJson.name.split("/");
|
||||||
{
|
const version = packageJson.version;
|
||||||
name: "mcp-inspector",
|
const clientIdentity = { name, version };
|
||||||
version: packageJson.version,
|
|
||||||
},
|
const clientCapabilities = {
|
||||||
{
|
capabilities: {
|
||||||
capabilities: {
|
sampling: {},
|
||||||
sampling: {},
|
elicitation: {},
|
||||||
elicitation: {},
|
roots: {
|
||||||
roots: {
|
listChanged: true,
|
||||||
listChanged: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const client = new Client<Request, Notification, Result>(
|
||||||
|
clientIdentity,
|
||||||
|
clientCapabilities,
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue