fix some bug
This commit is contained in:
parent
e98ad038c5
commit
13d05462fe
@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
## [main] 0.1.1
|
||||
- 修复 SSH 连接 Ubuntu 的情况下的部分 bug
|
||||
- 修复 python 项目点击 openmcp 进行连接时,初始化参数错误的问题
|
||||
|
||||
## [main] 0.1.0
|
||||
- 新特性:支持同时连入多个 mcp server
|
||||
- 新特性:更新协议内容,支持 streamable http 协议,未来将逐步取代 SSE 的连接方式
|
||||
|
@ -133,8 +133,12 @@ export class McpClient {
|
||||
// 调用工具
|
||||
public async callTool(options: { name: string; arguments: Record<string, any>, callToolOption?: any }) {
|
||||
const { callToolOption, ...methodArgs } = options;
|
||||
console.log('methodArgs', methodArgs);
|
||||
console.log('callToolOption', callToolOption);
|
||||
return await this.client.callTool(methodArgs, undefined, callToolOption);
|
||||
const res = await this.client.callTool(methodArgs, undefined, callToolOption);
|
||||
console.log('callTool res', res);
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,8 @@ export class McpInstalledConnectProvider implements vscode.TreeDataProvider<Conn
|
||||
const connection = getConnectionConfig();
|
||||
const sidebarItems = connection.items.map((item, index) => {
|
||||
// 连接的名字
|
||||
item = Array.isArray(item)? item[0] : item;
|
||||
const itemName = `${item.name} (${item.type || item.connectionType})`
|
||||
const nItem = Array.isArray(item)? item[0] : item;
|
||||
const itemName = `${nItem.name} (${nItem.type || nItem.connectionType})`
|
||||
return new ConnectionViewItem(itemName, vscode.TreeItemCollapsibleState.None, item, 'server');
|
||||
})
|
||||
|
||||
|
@ -22,8 +22,8 @@ export class McpWorkspaceConnectProvider implements vscode.TreeDataProvider<Conn
|
||||
const connection = getWorkspaceConnectionConfig();
|
||||
const sidebarItems = connection.items.map((item, index) => {
|
||||
// 连接的名字
|
||||
item = Array.isArray(item) ? item[0] : item;
|
||||
const itemName = `${item.name} (${item.type || item.connectionType})`
|
||||
const nItem = Array.isArray(item) ? item[0] : item;
|
||||
const itemName = `${nItem.name} (${nItem.type || nItem.connectionType})`
|
||||
return new ConnectionViewItem(itemName, vscode.TreeItemCollapsibleState.None, item, 'server');
|
||||
})
|
||||
|
||||
|
@ -5,6 +5,9 @@ export async function deleteUserConnection(item: McpOptions[] | McpOptions) {
|
||||
// 弹出确认对话框
|
||||
const masterNode = Array.isArray(item) ? item[0] : item;
|
||||
const name = masterNode.name;
|
||||
|
||||
console.log('enter delete');
|
||||
|
||||
const confirm = await vscode.window.showWarningMessage(
|
||||
`确定要删除连接 "${name}" 吗?`,
|
||||
{ modal: true },
|
||||
@ -18,6 +21,10 @@ export async function deleteUserConnection(item: McpOptions[] | McpOptions) {
|
||||
const workspaceConnectionConfig = getWorkspaceConnectionConfig();
|
||||
|
||||
// 从配置中移除该连接项
|
||||
console.log(item);
|
||||
console.log(workspaceConnectionConfig.items);
|
||||
// TODO: 改成基于 path 进行搜索
|
||||
|
||||
const index = workspaceConnectionConfig.items.indexOf(item);
|
||||
if (index !== -1) {
|
||||
workspaceConnectionConfig.items.splice(index, 1);
|
||||
|
@ -1,7 +1,8 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { RegisterCommand } from "../common";
|
||||
import { getDefaultLanunchSignature, getLaunchCWD, revealOpenMcpWebviewPanel } from './webview.service';
|
||||
import { getDefaultLanunchSignature, getWorkspacePath, revealOpenMcpWebviewPanel } from './webview.service';
|
||||
import { getWorkspaceConnectionConfigItemByPath } from '../global';
|
||||
import path from 'path';
|
||||
|
||||
export class WebviewController {
|
||||
@RegisterCommand('openmcp.showOpenMCP')
|
||||
@ -10,8 +11,7 @@ export class WebviewController {
|
||||
|
||||
if (!connectionItem) {
|
||||
// 项目不存在连接信息
|
||||
const cwd = getLaunchCWD(context, uri);
|
||||
|
||||
const cwd = path.dirname(uri.fsPath);
|
||||
const signature = getDefaultLanunchSignature(uri.fsPath, cwd);
|
||||
|
||||
if (!signature) {
|
||||
|
@ -24,7 +24,7 @@ export function getWebviewContent(context: vscode.ExtensionContext, panel: vscod
|
||||
return html;
|
||||
}
|
||||
|
||||
export function getLaunchCWD(context: vscode.ExtensionContext, uri: vscode.Uri) {
|
||||
export function getWorkspacePath(context: vscode.ExtensionContext, uri: vscode.Uri) {
|
||||
// TODO: 启动上下文?
|
||||
// 获取当前打开的项目的路径
|
||||
const workspaceFolder = vscode.workspace.getWorkspaceFolder(uri);
|
||||
|
Loading…
x
Reference in New Issue
Block a user