支持 SSE
This commit is contained in:
parent
1e201db87a
commit
ddb4dfb565
@ -40,12 +40,11 @@
|
|||||||
|---------|---------|--------|---------|-----------|
|
|---------|---------|--------|---------|-----------|
|
||||||
| `all` | 完成最基本的各类基础设施 | `完整版本` | 100% | `Done` |
|
| `all` | 完成最基本的各类基础设施 | `完整版本` | 100% | `Done` |
|
||||||
| `render` | chat 模式下支持进行成本分析 | `迭代版本` | 100% | `Done` |
|
| `render` | chat 模式下支持进行成本分析 | `迭代版本` | 100% | `Done` |
|
||||||
| `ext` | 支持基本的 MCP 项目管理 | `MVP` | 70% | `P0` |
|
| `ext` | 支持基本的 MCP 项目管理 | `MVP` | 90% | `P0` |
|
||||||
| `service` | 支持自定义支持 openai 接口协议的大模型接入 | `完整版本` | 100% | `Done` |
|
| `service` | 支持自定义支持 openai 接口协议的大模型接入 | `完整版本` | 100% | `Done` |
|
||||||
| `service` | 支持自定义接口协议的大模型接入 | `MVP` | 0% | `P1` |
|
| `service` | 支持自定义接口协议的大模型接入 | `MVP` | 0% | `P1` |
|
||||||
| `all` | 支持同时调试多个 MCP Server | `MVP` | 0% | `P1` |
|
| `all` | 支持同时调试多个 MCP Server | `MVP` | 0% | `P1` |
|
||||||
| `all` | 支持通过大模型进行在线验证 | `迭代版本` | 100% | `Done` |
|
| `all` | 支持通过大模型进行在线验证 | `迭代版本` | 100% | `Done` |
|
||||||
| `all` | 支持 completion/complete 协议字段 | `MVP` | 0% | `P1` |
|
|
||||||
| `all` | 支持对用户对应服务器的调试工作内容进行保存 | `迭代版本` | 100% | `Done` |
|
| `all` | 支持对用户对应服务器的调试工作内容进行保存 | `迭代版本` | 100% | `Done` |
|
||||||
| `render` | 高危操作权限确认 | `MVP` | 0% | `P1` |
|
| `render` | 高危操作权限确认 | `MVP` | 0% | `P1` |
|
||||||
| `service` | 对于连接的 mcp server 进行热更新 | `MVP` | 0% | `P1` |
|
| `service` | 对于连接的 mcp server 进行热更新 | `MVP` | 0% | `P1` |
|
||||||
|
@ -2,7 +2,7 @@ import * as vscode from 'vscode';
|
|||||||
import * as fspath from 'path';
|
import * as fspath from 'path';
|
||||||
|
|
||||||
import * as OpenMCPService from '../resources/service';
|
import * as OpenMCPService from '../resources/service';
|
||||||
import { getLaunchCWD, revealOpenMcpWebviewPanel } from './webview';
|
import { getDefaultLanunchSigature, getLaunchCWD, revealOpenMcpWebviewPanel } from './webview';
|
||||||
import { ConnectionViewItem, registerSidebar } from './sidebar';
|
import { ConnectionViewItem, registerSidebar } from './sidebar';
|
||||||
import { getWorkspaceConnectionConfigItemByPath, ISSEConnectionItem, IStdioConnectionItem } from './global';
|
import { getWorkspaceConnectionConfigItemByPath, ISSEConnectionItem, IStdioConnectionItem } from './global';
|
||||||
|
|
||||||
@ -31,19 +31,19 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
if (!connectionItem) {
|
if (!connectionItem) {
|
||||||
// 项目不存在连接信息
|
// 项目不存在连接信息
|
||||||
const cwd = getLaunchCWD(context, uri);
|
const cwd = getLaunchCWD(context, uri);
|
||||||
|
|
||||||
|
const sigature = getDefaultLanunchSigature(uri.fsPath, cwd);
|
||||||
|
|
||||||
// 获取 uri 相对于 cwd 的路径
|
if (!sigature) {
|
||||||
const relativePath = fspath.relative(cwd, uri.fsPath);
|
vscode.window.showErrorMessage('OpenMCP: 无法获取启动参数');
|
||||||
|
return;
|
||||||
// TODO: 实现从 connection.json 中读取配置,然后启动对应的 connection
|
}
|
||||||
const command = 'mcp';
|
|
||||||
const args = ['run', relativePath];
|
|
||||||
|
|
||||||
revealOpenMcpWebviewPanel(context, uri.fsPath, {
|
revealOpenMcpWebviewPanel(context, uri.fsPath, {
|
||||||
type: 'stdio',
|
type: 'stdio',
|
||||||
name: 'OpenMCP',
|
name: 'OpenMCP',
|
||||||
command,
|
command: sigature.command,
|
||||||
args,
|
args: sigature.args,
|
||||||
cwd
|
cwd
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -112,4 +112,20 @@ export function revealOpenMcpWebviewPanel(
|
|||||||
});
|
});
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDefaultLanunchSigature(path: string, cwd: string) {
|
||||||
|
const relativePath = fspath.relative(cwd, path);
|
||||||
|
|
||||||
|
if (relativePath.endsWith('.py')) {
|
||||||
|
return {
|
||||||
|
command: 'mcp',
|
||||||
|
args: ['run', relativePath]
|
||||||
|
};
|
||||||
|
} else if (relativePath.endsWith('.js')) {
|
||||||
|
return {
|
||||||
|
command:'node',
|
||||||
|
args: [relativePath]
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user