Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions app/components/mcp-market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ import {
resumeMcpServer,
} from "../mcp/actions";
import {
ListToolsResponse,
ToolSchema,
McpConfigData,
PresetServer,
ServerConfig,
ServerStatusResponse,
isServerStdioConfig,
} from "../mcp/types";
import clsx from "clsx";
import PlayIcon from "../icons/play.svg";
Expand All @@ -46,7 +47,7 @@ export function McpMarketPage() {
const [searchText, setSearchText] = useState("");
const [userConfig, setUserConfig] = useState<Record<string, any>>({});
const [editingServerId, setEditingServerId] = useState<string | undefined>();
const [tools, setTools] = useState<ListToolsResponse["tools"] | null>(null);
const [tools, setTools] = useState<ToolSchema[] | null>(null);
const [viewingServerId, setViewingServerId] = useState<string | undefined>();
const [isLoading, setIsLoading] = useState(false);
const [config, setConfig] = useState<McpConfigData>();
Expand Down Expand Up @@ -136,7 +137,7 @@ export function McpMarketPage() {
useEffect(() => {
if (!editingServerId || !config) return;
const currentConfig = config.mcpServers[editingServerId];
if (currentConfig) {
if (isServerStdioConfig(currentConfig)) {
// 从当前配置中提取用户配置
const preset = presetServers.find((s) => s.id === editingServerId);
if (preset?.configSchema) {
Expand Down Expand Up @@ -230,7 +231,7 @@ export function McpMarketPage() {
try {
const result = await getClientTools(id);
if (result) {
setTools(result);
setTools(result?.tools);
} else {
throw new Error("Failed to load tools");
}
Expand Down Expand Up @@ -731,17 +732,15 @@ export function McpMarketPage() {
<div className={styles["tools-list"]}>
{isLoading ? (
<div>Loading...</div>
) : tools?.tools ? (
tools.tools.map(
(tool: ListToolsResponse["tools"], index: number) => (
<div key={index} className={styles["tool-item"]}>
<div className={styles["tool-name"]}>{tool.name}</div>
<div className={styles["tool-description"]}>
{tool.description}
</div>
) : tools ? (
tools.map((tool: ToolSchema, index: number) => (
<div key={index} className={styles["tool-item"]}>
<div className={styles["tool-name"]}>{tool.name}</div>
<div className={styles["tool-description"]}>
{tool.description}
</div>
),
)
</div>
))
) : (
<div>No tools available</div>
)}
Expand Down
11 changes: 11 additions & 0 deletions app/config/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ export const getBuildConfig = () => {
buildMode,
isApp,
template: process.env.DEFAULT_INPUT_TEMPLATE ?? DEFAULT_INPUT_TEMPLATE,

needCode: !!process.env.CODE,
hideUserApiKey: !!process.env.HIDE_USER_API_KEY,
baseUrl: process.env.BASE_URL,
openaiUrl: process.env.OPENAI_BASE_URL ?? process.env.BASE_URL,
disableGPT4: !!process.env.DISABLE_GPT4,
useCustomConfig: !!process.env.USE_CUSTOM_CONFIG,
hideBalanceQuery: !process.env.ENABLE_BALANCE_QUERY,
disableFastLink: !!process.env.DISABLE_FAST_LINK,
defaultModel: process.env.DEFAULT_MODEL ?? "",
enableMcp: process.env.ENABLE_MCP === "true",
};
};

Expand Down
Loading