MCPcopy Create free account
hub / github.com/CopilotKit/OpenGenerativeUI / createMcpServer

Function createMcpServer

apps/mcp/src/server.ts:6–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { assembleDocument } from "./renderer.js";
5
6export function createMcpServer(): McpServer {
7 const server = new McpServer({
8 name: "open-generative-ui",
9 version: "0.1.0",
10 });
11
12 // Resources: list and get skills
13 server.registerResource(
14 "skills-list",
15 "skills://list",
16 { description: "JSON array of available skill names", mimeType: "application/json" },
17 async () => ({
18 contents: [
19 {
20 uri: "skills://list",
21 mimeType: "application/json",
22 text: JSON.stringify(listSkills()),
23 },
24 ],
25 })
26 );
27
28 server.registerResource(
29 "skill",
30 new ResourceTemplate("skills://{name}", {
31 list: async () => ({
32 resources: listSkills().map((name) => ({
33 uri: `skills://${name}`,
34 name,
35 mimeType: "text/plain",
36 })),
37 }),
38 }),
39 { description: "Full text of a skill instruction document", mimeType: "text/plain" },
40 async (uri, { name }) => ({
41 contents: [
42 {
43 uri: uri.href,
44 mimeType: "text/plain",
45 text: loadSkill(name as string),
46 },
47 ],
48 })
49 );
50
51 // Prompts: pre-composed skill prompts
52 server.registerPrompt(
53 "create_widget",
54 { description: "Instructions for creating interactive HTML widgets" },
55 async () => ({
56 messages: [
57 {
58 role: "user",
59 content: { type: "text", text: loadSkill("master-agent-playbook") },
60 },
61 ],
62 })
63 );

Callers 2

index.tsFile · 0.85
stdio.tsFile · 0.85

Calls 3

listSkillsFunction · 0.85
loadSkillFunction · 0.85
assembleDocumentFunction · 0.85

Tested by

no test coverage detected