feat: MCP market

This commit is contained in:
Kadxy
2025-01-09 19:51:01 +08:00
parent 0c14ce6417
commit 7d51bfd42e
14 changed files with 1607 additions and 30 deletions

View File

@@ -1,10 +1,10 @@
export function isMcpJson(content: string) {
return content.match(/```json:mcp:(\w+)([\s\S]*?)```/);
return content.match(/```json:mcp:([^{\s]+)([\s\S]*?)```/);
}
export function extractMcpJson(content: string) {
const match = content.match(/```json:mcp:(\w+)([\s\S]*?)```/);
if (match) {
const match = content.match(/```json:mcp:([^{\s]+)([\s\S]*?)```/);
if (match && match.length === 3) {
return { clientId: match[1], mcp: JSON.parse(match[2]) };
}
return null;