You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
349 B
TypeScript
12 lines
349 B
TypeScript
|
9 months ago
|
export function isMcpJson(content: string) {
|
||
|
|
return content.match(/```json:mcp:([^{\s]+)([\s\S]*?)```/);
|
||
|
|
}
|
||
|
|
|
||
|
|
export function extractMcpJson(content: string) {
|
||
|
|
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;
|
||
|
|
}
|