@microsoft/m365agentstoolkit-mcp 0.2.1-alpha.eb1380cea.0 → 0.2.1-alpha.f760c0df7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
(()=>{"use strict";var e={292:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fetchSchema=t.clearSchemaCache=t.SchemaTypeEnum=void 0;const s=o(569);t.SchemaTypeEnum=s.z.enum(["app_manifest","declarative_agent_manifest","api_plugin_manifest","m365_agents_yaml"]);const r={app_manifest:{baseUrl:"https://developer.microsoft.com/json-schemas/teams/{{version}}/MicrosoftTeams.schema.json",latestVersion:"v1.
|
|
2
|
+
(()=>{"use strict";var e={292:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fetchSchema=t.clearSchemaCache=t.SchemaTypeEnum=void 0;const s=o(569);t.SchemaTypeEnum=s.z.enum(["app_manifest","declarative_agent_manifest","api_plugin_manifest","m365_agents_yaml"]);const r={app_manifest:{baseUrl:"https://developer.microsoft.com/json-schemas/teams/{{version}}/MicrosoftTeams.schema.json",latestVersion:"v1.23"},declarative_agent_manifest:{baseUrl:"https://developer.microsoft.com/json-schemas/copilot/declarative-agent/{{version}}/schema.json",latestVersion:"v1.4"},api_plugin_manifest:{baseUrl:"https://developer.microsoft.com/json-schemas/copilot/plugin/{{version}}/schema.json",latestVersion:"v2.3"},m365_agents_yaml:{baseUrl:"https://developer.microsoft.com/json-schemas/teams-toolkit/teamsapp-yaml/{{version}}/yaml.schema.json",latestVersion:"v1.9"}},n={};t.clearSchemaCache=function(){Object.keys(n).forEach((e=>{delete n[e]}))},t.fetchSchema=async function(e,t){const o=`${e}:${t}`;if(n[o])return n[o];const s=r[e];if(!s)return`Unknown schema name: ${e}`;try{"latest"===t&&(t=s.latestVersion);const e=s.baseUrl.replace("{{version}}",t),r=await fetch(e);if(!r.ok)throw new Error(`HTTP error with status: ${r.status}`);const a=await r.json(),i=JSON.stringify({schema_url:e,content:a});return n[o]=i,i}catch(e){return`Failed fetching schema at version: ${t}, error: ${e instanceof Error?e.message:String(e)}. Try different version.`}}},373:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.retrieveResource=t.ResourceTypeEnum=void 0;const s=o(569);t.ResourceTypeEnum=s.z.enum(["documents","samples","issues","code"]),t.retrieveResource=async function(e,t){try{const o=process.env.RETRIEVER_API_ENDPOINT||Buffer.from("aHR0cHM6Ly9hZmQtd20zZGg1amM2NzU1cy1wcm9kLWhrZndnYmJqYjVhN2hyYnUuYjAxLmF6dXJlZmQubmV0L3JldHJpZXZlcg==","base64").toString("utf-8"),s=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resource_type:e,question:t})});if(!s.ok)return`Fail to retrieve resource, ${s.status}: ${s.statusText}`;return(await s.json()).data}catch(e){return`Error retrieving resource: ${e instanceof Error?e.message:"Unknown error occurred"}`}}},569:e=>{e.exports=require("zod")},737:e=>{e.exports=require("@modelcontextprotocol/sdk/server/mcp.js")},752:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createServer=void 0;const s=o(737),r=o(569),n=o(292),a=o(373);t.createServer=function(){const e=new s.McpServer({name:"m365agentstoolkit-mcp",version:"0.1.0"});return e.tool("get_schema",'Get the schema for "App manifest", "Declarative agent manifest", "API plugin manifest", "M365 agents yaml", use it everytime before understanding, modifying or creating any of these manifest files.',{schema_name:n.SchemaTypeEnum.describe("name of schema"),schema_version:r.z.string().describe('version of schema in semantic versioning format vX.Y, where X is the major version and Y is the minor version (e.g. v1.0, v1.19, v2.1). Use "latest" if unsure.')},(async({schema_name:e,schema_version:t})=>({content:[{type:"text",text:await(0,n.fetchSchema)(e,t)}]}))),e.tool("get_knowledge","Access comprehensive knowledge about Microsoft 365 and Microsoft 365 Copilot development. Use this tool everytime for questions related to Microsoft 365 and Microsoft 365 Copilot.",{question:r.z.string().describe("Question to use for knowledge retrieval")},(async({question:e})=>({content:[{type:"text",text:await(0,a.retrieveResource)("documents",e)}]}))),e.tool("get_code_snippets","Access templates and code snippets for Microsoft 365 and Microsoft 365 Copilot development, focusing on SDKs such as **@microsoft/teams-ai**, **@microsoft/teams-js**, and **botbuilder**. Use this tool when looking for implementation examples, starter templates, or SDK usage patterns.",{question:r.z.string().describe("Query to find relevant code snippets related to Microsoft 365 app or agent SDKs")},(async({question:e})=>({content:[{type:"text",text:await(0,a.retrieveResource)("code",e)}]}))),e.tool("troubleshoot","Access troubleshooting solutions for common Microsoft 365 and Microsoft 365 Copilot development issues. Use this tool when encountering errors, unexpected behaviors, or implementation challenges.",{question:r.z.string().describe("Description of the issue or error you're experiencing")},(async({question:e})=>({content:[{type:"text",text:await(0,a.retrieveResource)("issues",e)}]}))),e}},802:e=>{e.exports=require("@modelcontextprotocol/sdk/server/stdio.js")}},t={};function o(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,o),n.exports}(()=>{const e=o(802),t=o(752);(async function(){const o=(0,t.createServer)(),s=new e.StdioServerTransport;await o.connect(s)})().catch((e=>{console.error("Fatal error in main():",e),process.exit(1)}))})()})();
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":";kJAEA,eAKa,EAAAA,eAAiB,EAAAC,EAAEC,KAAK,CACnC,eACA,6BACA,sBACA,qBAeF,MAAMC,EAA2D,CAC/DC,aAAc,CACZC,QAAS,4FACTC,cAAe,SAEjBC,2BAA4B,CAC1BF,QAAS,iGACTC,cAAe,QAEjBE,oBAAqB,CACnBH,QAAS,sFACTC,cAAe,QAEjBG,iBAAkB,CAChBJ,QAAS,4DACTC,cAAe,SAObI,EAAmC,CA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,KAAK,EAAE,G","sources":["webpack://@microsoft/m365agentstoolkit-mcp/./src/fetcher.ts","webpack://@microsoft/m365agentstoolkit-mcp/./src/retriever.ts","webpack://@microsoft/m365agentstoolkit-mcp/external commonjs \"zod\"","webpack://@microsoft/m365agentstoolkit-mcp/external commonjs \"@modelcontextprotocol/sdk/server/mcp.js\"","webpack://@microsoft/m365agentstoolkit-mcp/./src/server.ts","webpack://@microsoft/m365agentstoolkit-mcp/external commonjs \"@modelcontextprotocol/sdk/server/stdio.js\"","webpack://@microsoft/m365agentstoolkit-mcp/webpack/bootstrap","webpack://@microsoft/m365agentstoolkit-mcp/./src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { z } from \"zod\";\n\n/**\n * Schema types supported by the fetcher\n */\nexport const SchemaTypeEnum = z.enum([\n \"app_manifest\",\n \"declarative_agent_manifest\",\n \"api_plugin_manifest\",\n \"m365_agents_yaml\",\n]);\nexport type SchemaType = z.infer<typeof SchemaTypeEnum>;\n\n/**\n * Interface for schema repository information\n */\ninterface SchemaRepository {\n baseUrl: string;\n latestVersion: string;\n}\n\n/**\n * Repository configurations for each schema type\n */\nconst schemaRepositories: Record<SchemaType, SchemaRepository> = {\n app_manifest: {\n baseUrl: `https://developer.microsoft.com/json-schemas/teams/{{version}}/MicrosoftTeams.schema.json`,\n latestVersion: \"v1.22\",\n },\n declarative_agent_manifest: {\n baseUrl: `https://developer.microsoft.com/json-schemas/copilot/declarative-agent/{{version}}/schema.json`,\n latestVersion: \"v1.4\",\n },\n api_plugin_manifest: {\n baseUrl: `https://developer.microsoft.com/json-schemas/copilot/plugin/{{version}}/schema.json`,\n latestVersion: \"v2.3\",\n },\n m365_agents_yaml: {\n baseUrl: `https://aka.ms/teams-toolkit/{{version}}/yaml.schema.json`,\n latestVersion: \"v1.8\",\n },\n};\n\n/**\n * Cache for previously fetched schemas\n */\nconst schemaCache: Record<string, any> = {};\n\n/**\n * Clear the schema cache\n */\nexport function clearSchemaCache(): void {\n Object.keys(schemaCache).forEach((key) => {\n delete schemaCache[key];\n });\n}\n\n/**\n * Fetch schema from the appropriate repository\n * @param schemaName The type of schema to fetch\n * @param schemaVersion The version of the schema to fetch\n * @returns The requested schema as a JSON object with schema_url and content properties\n */\nexport async function fetchSchema(schemaName: SchemaType, schemaVersion: string): Promise<string> {\n // Create a cache key\n const cacheKey = `${schemaName}:${schemaVersion}`;\n\n // Check if we have this schema in cache\n if (schemaCache[cacheKey]) {\n return schemaCache[cacheKey];\n }\n\n const repository = schemaRepositories[schemaName];\n if (!repository) {\n return `Unknown schema name: ${schemaName}`;\n }\n\n try {\n if (schemaVersion === \"latest\") {\n schemaVersion = repository.latestVersion;\n }\n\n const url = repository.baseUrl.replace(\"{{version}}\", schemaVersion);\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`HTTP error with status: ${response.status}`);\n }\n\n const content = await response.json();\n\n const result = JSON.stringify({\n schema_url: url,\n content: content,\n });\n\n // Save to cache\n schemaCache[cacheKey] = result;\n\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return `Failed fetching schema at version: ${schemaVersion}, error: ${errorMessage}. Try different version.`;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { z } from \"zod\";\n\nexport const ResourceTypeEnum = z.enum([\"documents\", \"samples\", \"issues\", \"code\"]);\nexport type ResourceType = z.infer<typeof ResourceTypeEnum>;\n\n/**\n * Retrieves resources from the API service\n * @param resourceType The type of resource to retrieve\n * @param question The question to use for retrieval\n * @returns The retrieved resources or error message as string\n */\nexport async function retrieveResource(\n resourceType: ResourceType,\n question: string\n): Promise<string> {\n try {\n const apiEndpoint =\n process.env.RETRIEVER_API_ENDPOINT ||\n Buffer.from(\n // eslint-disable-next-line no-secrets/no-secrets\n \"aHR0cHM6Ly9hZmQtd20zZGg1amM2NzU1cy1wcm9kLWhrZndnYmJqYjVhN2hyYnUuYjAxLmF6dXJlZmQubmV0L3JldHJpZXZlcg==\",\n \"base64\"\n ).toString(\"utf-8\");\n\n const response = await fetch(apiEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n resource_type: resourceType,\n question: question,\n }),\n });\n\n if (!response.ok) {\n return `Fail to retrieve resource, ${response.status}: ${response.statusText}`;\n }\n\n const data = await response.json();\n return data.data;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n return `Error retrieving resource: ${errorMessage}`;\n }\n}\n","module.exports = require(\"zod\");","module.exports = require(\"@modelcontextprotocol/sdk/server/mcp.js\");","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { fetchSchema, SchemaTypeEnum } from \"./fetcher\";\nimport { retrieveResource } from \"./retriever\";\n\nexport function createServer(): McpServer {\n const server = new McpServer({\n name: \"m365agentstoolkit-mcp\",\n version: \"0.1.0\",\n });\n server.tool(\n \"get_schema\",\n 'Get the schema for \"App manifest\", \"Declarative agent manifest\", \"API plugin manifest\", \"M365 agents yaml\", use it everytime before understanding, modifying or creating any of these manifest files.',\n {\n schema_name: SchemaTypeEnum.describe(\"name of schema\"),\n schema_version: z\n .string()\n .describe(\n 'version of schema in semantic versioning format vX.Y, where X is the major version and Y is the minor version (e.g. v1.0, v1.19, v2.1). Use \"latest\" if unsure.'\n ),\n },\n async ({ schema_name, schema_version }) => {\n const schema = await fetchSchema(schema_name, schema_version);\n\n return {\n content: [\n {\n type: \"text\",\n text: schema,\n },\n ],\n };\n }\n );\n\n server.tool(\n \"get_knowledge\",\n \"Access comprehensive knowledge about Microsoft 365 and Microsoft 365 Copilot development. Use this tool everytime for questions related to Microsoft 365 and Microsoft 365 Copilot.\",\n {\n question: z.string().describe(\"Question to use for knowledge retrieval\"),\n },\n async ({ question }) => {\n const result = await retrieveResource(\"documents\", question);\n\n return {\n content: [\n {\n type: \"text\",\n text: result,\n },\n ],\n };\n }\n );\n\n server.tool(\n \"get_code_snippets\",\n \"Access templates and code snippets for Microsoft 365 and Microsoft 365 Copilot development, focusing on SDKs such as **@microsoft/teams-ai**, **@microsoft/teams-js**, and **botbuilder**. Use this tool when looking for implementation examples, starter templates, or SDK usage patterns.\",\n {\n question: z\n .string()\n .describe(\n \"Query to find relevant code snippets related to Microsoft 365 app or agent SDKs\"\n ),\n },\n async ({ question }) => {\n const result = await retrieveResource(\"code\", question);\n\n return {\n content: [\n {\n type: \"text\",\n text: result,\n },\n ],\n };\n }\n );\n\n server.tool(\n \"troubleshoot\",\n \"Access troubleshooting solutions for common Microsoft 365 and Microsoft 365 Copilot development issues. Use this tool when encountering errors, unexpected behaviors, or implementation challenges.\",\n {\n question: z.string().describe(\"Description of the issue or error you're experiencing\"),\n },\n async ({ question }) => {\n const result = await retrieveResource(\"issues\", question);\n\n return {\n content: [\n {\n type: \"text\",\n text: result,\n },\n ],\n };\n }\n );\n\n return server;\n}\n","module.exports = require(\"@modelcontextprotocol/sdk/server/stdio.js\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","#!/usr/bin/env node\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\n\nimport { createServer } from \"./server\";\n\nasync function main() {\n const server: McpServer = createServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\nmain().catch((error) => {\n console.error(\"Fatal error in main():\", error);\n process.exit(1);\n});\n"],"names":["SchemaTypeEnum","z","enum","schemaRepositories","app_manifest","baseUrl","latestVersion","declarative_agent_manifest","api_plugin_manifest","m365_agents_yaml","schemaCache","Object","keys","forEach","key","async","schemaName","schemaVersion","cacheKey","repository","url","replace","response","fetch","ok","Error","status","content","json","result","JSON","stringify","schema_url","error","message","String","ResourceTypeEnum","resourceType","question","apiEndpoint","process","env","RETRIEVER_API_ENDPOINT","Buffer","from","toString","method","headers","body","resource_type","statusText","data","module","exports","require","server","McpServer","name","version","tool","schema_name","describe","schema_version","string","type","text","fetchSchema","retrieveResource","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","createServer","transport","StdioServerTransport","connect","main","catch","console","exit"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"index.js","mappings":";kJAEA,eAKa,EAAAA,eAAiB,EAAAC,EAAEC,KAAK,CACnC,eACA,6BACA,sBACA,qBAeF,MAAMC,EAA2D,CAC/DC,aAAc,CACZC,QAAS,4FACTC,cAAe,SAEjBC,2BAA4B,CAC1BF,QAAS,iGACTC,cAAe,QAEjBE,oBAAqB,CACnBH,QAAS,sFACTC,cAAe,QAEjBG,iBAAkB,CAChBJ,QAAS,wGACTC,cAAe,SAObI,EAAmC,CAAC,EAK1C,8BACEC,OAAOC,KAAKF,GAAaG,SAASC,WACzBJ,EAAYI,EAAI,GAE3B,EAQA,cAAOC,eAA2BC,EAAwBC,GAExD,MAAMC,EAAW,GAAGF,KAAcC,IAGlC,GAAIP,EAAYQ,GACd,OAAOR,EAAYQ,GAGrB,MAAMC,EAAahB,EAAmBa,GACtC,IAAKG,EACH,MAAO,wBAAwBH,IAGjC,IACwB,WAAlBC,IACFA,EAAgBE,EAAWb,eAG7B,MAAMc,EAAMD,EAAWd,QAAQgB,QAAQ,cAAeJ,GAChDK,QAAiBC,MAAMH,GAE7B,IAAK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S,CACP,CACEqC,KAAM,OACNC,WANe,IAAAE,kBAAiB,YAAa7B,SAavDiB,EAAOI,KACL,oBACA,+RACA,CACErB,SAAU,EAAArC,EACP8D,SACAF,SACC,qFAGN9C,OAASuB,eAGA,CACLX,QAAS,CACP,CACEqC,KAAM,OACNC,WANe,IAAAE,kBAAiB,OAAQ7B,SAalDiB,EAAOI,KACL,eACA,sMACA,CACErB,SAAU,EAAArC,EAAE8D,SAASF,SAAS,2DAEhC9C,OAASuB,eAGA,CACLX,QAAS,CACP,CACEqC,KAAM,OACNC,WANe,IAAAE,kBAAiB,SAAU7B,SAa7CiB,CACT,C,UCtGAH,EAAOC,QAAUC,QAAQ,4C,GCCrBc,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAalB,QAGrB,IAAID,EAASgB,EAAyBE,GAAY,CAGjDjB,QAAS,CAAC,GAOX,OAHAoB,EAAoBH,GAAUlB,EAAQA,EAAOC,QAASgB,GAG/CjB,EAAOC,OACf,C,MClBA,eAEA,UAEAtC,iBACE,MAAMwC,GAAoB,IAAAmB,gBACpBC,EAAY,IAAI,EAAAC,2BAChBrB,EAAOsB,QAAQF,EACvB,EAEAG,GAAOC,OAAO9C,IACZ+C,QAAQ/C,MAAM,yBAA0BA,GACxCO,QAAQyC,KAAK,EAAE,G","sources":["webpack://@microsoft/m365agentstoolkit-mcp/./src/fetcher.ts","webpack://@microsoft/m365agentstoolkit-mcp/./src/retriever.ts","webpack://@microsoft/m365agentstoolkit-mcp/external commonjs \"zod\"","webpack://@microsoft/m365agentstoolkit-mcp/external commonjs \"@modelcontextprotocol/sdk/server/mcp.js\"","webpack://@microsoft/m365agentstoolkit-mcp/./src/server.ts","webpack://@microsoft/m365agentstoolkit-mcp/external commonjs \"@modelcontextprotocol/sdk/server/stdio.js\"","webpack://@microsoft/m365agentstoolkit-mcp/webpack/bootstrap","webpack://@microsoft/m365agentstoolkit-mcp/./src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { z } from \"zod\";\n\n/**\n * Schema types supported by the fetcher\n */\nexport const SchemaTypeEnum = z.enum([\n \"app_manifest\",\n \"declarative_agent_manifest\",\n \"api_plugin_manifest\",\n \"m365_agents_yaml\",\n]);\nexport type SchemaType = z.infer<typeof SchemaTypeEnum>;\n\n/**\n * Interface for schema repository information\n */\ninterface SchemaRepository {\n baseUrl: string;\n latestVersion: string;\n}\n\n/**\n * Repository configurations for each schema type\n */\nconst schemaRepositories: Record<SchemaType, SchemaRepository> = {\n app_manifest: {\n baseUrl: `https://developer.microsoft.com/json-schemas/teams/{{version}}/MicrosoftTeams.schema.json`,\n latestVersion: \"v1.23\",\n },\n declarative_agent_manifest: {\n baseUrl: `https://developer.microsoft.com/json-schemas/copilot/declarative-agent/{{version}}/schema.json`,\n latestVersion: \"v1.4\",\n },\n api_plugin_manifest: {\n baseUrl: `https://developer.microsoft.com/json-schemas/copilot/plugin/{{version}}/schema.json`,\n latestVersion: \"v2.3\",\n },\n m365_agents_yaml: {\n baseUrl: `https://developer.microsoft.com/json-schemas/teams-toolkit/teamsapp-yaml/{{version}}/yaml.schema.json`,\n latestVersion: \"v1.9\",\n },\n};\n\n/**\n * Cache for previously fetched schemas\n */\nconst schemaCache: Record<string, any> = {};\n\n/**\n * Clear the schema cache\n */\nexport function clearSchemaCache(): void {\n Object.keys(schemaCache).forEach((key) => {\n delete schemaCache[key];\n });\n}\n\n/**\n * Fetch schema from the appropriate repository\n * @param schemaName The type of schema to fetch\n * @param schemaVersion The version of the schema to fetch\n * @returns The requested schema as a JSON object with schema_url and content properties\n */\nexport async function fetchSchema(schemaName: SchemaType, schemaVersion: string): Promise<string> {\n // Create a cache key\n const cacheKey = `${schemaName}:${schemaVersion}`;\n\n // Check if we have this schema in cache\n if (schemaCache[cacheKey]) {\n return schemaCache[cacheKey];\n }\n\n const repository = schemaRepositories[schemaName];\n if (!repository) {\n return `Unknown schema name: ${schemaName}`;\n }\n\n try {\n if (schemaVersion === \"latest\") {\n schemaVersion = repository.latestVersion;\n }\n\n const url = repository.baseUrl.replace(\"{{version}}\", schemaVersion);\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(`HTTP error with status: ${response.status}`);\n }\n\n const content = await response.json();\n\n const result = JSON.stringify({\n schema_url: url,\n content: content,\n });\n\n // Save to cache\n schemaCache[cacheKey] = result;\n\n return result;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n return `Failed fetching schema at version: ${schemaVersion}, error: ${errorMessage}. Try different version.`;\n }\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { z } from \"zod\";\n\nexport const ResourceTypeEnum = z.enum([\"documents\", \"samples\", \"issues\", \"code\"]);\nexport type ResourceType = z.infer<typeof ResourceTypeEnum>;\n\n/**\n * Retrieves resources from the API service\n * @param resourceType The type of resource to retrieve\n * @param question The question to use for retrieval\n * @returns The retrieved resources or error message as string\n */\nexport async function retrieveResource(\n resourceType: ResourceType,\n question: string\n): Promise<string> {\n try {\n const apiEndpoint =\n process.env.RETRIEVER_API_ENDPOINT ||\n Buffer.from(\n // eslint-disable-next-line no-secrets/no-secrets\n \"aHR0cHM6Ly9hZmQtd20zZGg1amM2NzU1cy1wcm9kLWhrZndnYmJqYjVhN2hyYnUuYjAxLmF6dXJlZmQubmV0L3JldHJpZXZlcg==\",\n \"base64\"\n ).toString(\"utf-8\");\n\n const response = await fetch(apiEndpoint, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n resource_type: resourceType,\n question: question,\n }),\n });\n\n if (!response.ok) {\n return `Fail to retrieve resource, ${response.status}: ${response.statusText}`;\n }\n\n const data = await response.json();\n return data.data;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"Unknown error occurred\";\n return `Error retrieving resource: ${errorMessage}`;\n }\n}\n","module.exports = require(\"zod\");","module.exports = require(\"@modelcontextprotocol/sdk/server/mcp.js\");","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { z } from \"zod\";\nimport { fetchSchema, SchemaTypeEnum } from \"./fetcher\";\nimport { retrieveResource } from \"./retriever\";\n\nexport function createServer(): McpServer {\n const server = new McpServer({\n name: \"m365agentstoolkit-mcp\",\n version: \"0.1.0\",\n });\n server.tool(\n \"get_schema\",\n 'Get the schema for \"App manifest\", \"Declarative agent manifest\", \"API plugin manifest\", \"M365 agents yaml\", use it everytime before understanding, modifying or creating any of these manifest files.',\n {\n schema_name: SchemaTypeEnum.describe(\"name of schema\"),\n schema_version: z\n .string()\n .describe(\n 'version of schema in semantic versioning format vX.Y, where X is the major version and Y is the minor version (e.g. v1.0, v1.19, v2.1). Use \"latest\" if unsure.'\n ),\n },\n async ({ schema_name, schema_version }) => {\n const schema = await fetchSchema(schema_name, schema_version);\n\n return {\n content: [\n {\n type: \"text\",\n text: schema,\n },\n ],\n };\n }\n );\n\n server.tool(\n \"get_knowledge\",\n \"Access comprehensive knowledge about Microsoft 365 and Microsoft 365 Copilot development. Use this tool everytime for questions related to Microsoft 365 and Microsoft 365 Copilot.\",\n {\n question: z.string().describe(\"Question to use for knowledge retrieval\"),\n },\n async ({ question }) => {\n const result = await retrieveResource(\"documents\", question);\n\n return {\n content: [\n {\n type: \"text\",\n text: result,\n },\n ],\n };\n }\n );\n\n server.tool(\n \"get_code_snippets\",\n \"Access templates and code snippets for Microsoft 365 and Microsoft 365 Copilot development, focusing on SDKs such as **@microsoft/teams-ai**, **@microsoft/teams-js**, and **botbuilder**. Use this tool when looking for implementation examples, starter templates, or SDK usage patterns.\",\n {\n question: z\n .string()\n .describe(\n \"Query to find relevant code snippets related to Microsoft 365 app or agent SDKs\"\n ),\n },\n async ({ question }) => {\n const result = await retrieveResource(\"code\", question);\n\n return {\n content: [\n {\n type: \"text\",\n text: result,\n },\n ],\n };\n }\n );\n\n server.tool(\n \"troubleshoot\",\n \"Access troubleshooting solutions for common Microsoft 365 and Microsoft 365 Copilot development issues. Use this tool when encountering errors, unexpected behaviors, or implementation challenges.\",\n {\n question: z.string().describe(\"Description of the issue or error you're experiencing\"),\n },\n async ({ question }) => {\n const result = await retrieveResource(\"issues\", question);\n\n return {\n content: [\n {\n type: \"text\",\n text: result,\n },\n ],\n };\n }\n );\n\n return server;\n}\n","module.exports = require(\"@modelcontextprotocol/sdk/server/stdio.js\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","#!/usr/bin/env node\n// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\n\nimport { createServer } from \"./server\";\n\nasync function main() {\n const server: McpServer = createServer();\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\nmain().catch((error) => {\n console.error(\"Fatal error in main():\", error);\n process.exit(1);\n});\n"],"names":["SchemaTypeEnum","z","enum","schemaRepositories","app_manifest","baseUrl","latestVersion","declarative_agent_manifest","api_plugin_manifest","m365_agents_yaml","schemaCache","Object","keys","forEach","key","async","schemaName","schemaVersion","cacheKey","repository","url","replace","response","fetch","ok","Error","status","content","json","result","JSON","stringify","schema_url","error","message","String","ResourceTypeEnum","resourceType","question","apiEndpoint","process","env","RETRIEVER_API_ENDPOINT","Buffer","from","toString","method","headers","body","resource_type","statusText","data","module","exports","require","server","McpServer","name","version","tool","schema_name","describe","schema_version","string","type","text","fetchSchema","retrieveResource","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","createServer","transport","StdioServerTransport","connect","main","catch","console","exit"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/m365agentstoolkit-mcp",
|
|
3
|
-
"version": "0.2.1-alpha.
|
|
3
|
+
"version": "0.2.1-alpha.f760c0df7.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"m365agentstoolkit-mcp": "./dist/index.js"
|
|
6
6
|
},
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"npx eslint --cache --fix --quiet"
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "8addda7b9c4e94b8784f2db41740fc75250dafd8"
|
|
77
77
|
}
|