@microsoft/m365agentstoolkit-mcp 0.1.0-alpha.18ed8019e.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Microsoft
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @microsoft/mcp-m365
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchSchema = exports.clearSchemaCache = exports.SchemaTypeEnum = void 0;
4
+ // Copyright (c) Microsoft Corporation.
5
+ // Licensed under the MIT license.
6
+ const zod_1 = require("zod");
7
+ /**
8
+ * Schema types supported by the fetcher
9
+ */
10
+ exports.SchemaTypeEnum = zod_1.z.enum([
11
+ "app_manifest",
12
+ "declarative_agent_manifest",
13
+ "api_plugin_manifest",
14
+ ]);
15
+ /**
16
+ * Repository configurations for each schema type
17
+ */
18
+ const schemaRepositories = {
19
+ app_manifest: {
20
+ baseUrl: `https://developer.microsoft.com/json-schemas/teams/{{version}}/MicrosoftTeams.schema.json`,
21
+ },
22
+ declarative_agent_manifest: {
23
+ baseUrl: `https://developer.microsoft.com/json-schemas/copilot/declarative-agent/{{version}}/schema.json`,
24
+ },
25
+ api_plugin_manifest: {
26
+ baseUrl: `https://developer.microsoft.com/json-schemas/copilot/plugin/{{version}}/schema.json`,
27
+ },
28
+ };
29
+ /**
30
+ * Cache for previously fetched schemas
31
+ */
32
+ const schemaCache = {};
33
+ /**
34
+ * Clear the schema cache
35
+ */
36
+ function clearSchemaCache() {
37
+ Object.keys(schemaCache).forEach((key) => {
38
+ delete schemaCache[key];
39
+ });
40
+ }
41
+ exports.clearSchemaCache = clearSchemaCache;
42
+ /**
43
+ * Fetch schema from the appropriate repository
44
+ * @param schemaName The type of schema to fetch
45
+ * @param schemaVersion The version of the schema to fetch
46
+ * @returns The requested schema as a JSON object with schema_url and content properties
47
+ */
48
+ async function fetchSchema(schemaName, schemaVersion) {
49
+ // Create a cache key
50
+ const cacheKey = `${schemaName}:${schemaVersion}`;
51
+ // Check if we have this schema in cache
52
+ if (schemaCache[cacheKey]) {
53
+ return schemaCache[cacheKey];
54
+ }
55
+ const repository = schemaRepositories[schemaName];
56
+ if (!repository) {
57
+ return `Unknown schema name: ${schemaName}`;
58
+ }
59
+ try {
60
+ const url = repository.baseUrl.replace("{{version}}", schemaVersion);
61
+ const response = await fetch(url);
62
+ if (!response.ok) {
63
+ throw new Error(`HTTP error with status: ${response.status}`);
64
+ }
65
+ const content = await response.json();
66
+ const result = JSON.stringify({
67
+ schema_url: url,
68
+ content: content,
69
+ });
70
+ // Save to cache
71
+ schemaCache[cacheKey] = result;
72
+ return result;
73
+ }
74
+ catch (error) {
75
+ const errorMessage = error instanceof Error ? error.message : String(error);
76
+ return `Failed fetching schema at version: ${schemaVersion}, error: ${errorMessage}. Try different version.`;
77
+ }
78
+ }
79
+ exports.fetchSchema = fetchSchema;
80
+ //# sourceMappingURL=fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,6BAAwB;AAExB;;GAEG;AACU,QAAA,cAAc,GAAG,OAAC,CAAC,IAAI,CAAC;IACnC,cAAc;IACd,4BAA4B;IAC5B,qBAAqB;CACtB,CAAC,CAAC;AAUH;;GAEG;AACH,MAAM,kBAAkB,GAAyC;IAC/D,YAAY,EAAE;QACZ,OAAO,EAAE,2FAA2F;KACrG;IACD,0BAA0B,EAAE;QAC1B,OAAO,EAAE,gGAAgG;KAC1G;IACD,mBAAmB,EAAE;QACnB,OAAO,EAAE,qFAAqF;KAC/F;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,GAAwB,EAAE,CAAC;AAE5C;;GAEG;AACH,SAAgB,gBAAgB;IAC9B,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACvC,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,4CAIC;AAED;;;;;GAKG;AACI,KAAK,UAAU,WAAW,CAAC,UAAsB,EAAE,aAAqB;IAC7E,qBAAqB;IACrB,MAAM,QAAQ,GAAG,GAAG,UAAU,IAAI,aAAa,EAAE,CAAC;IAElD,wCAAwC;IACxC,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE;QACzB,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;KAC9B;IAED,MAAM,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;IAClD,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,wBAAwB,UAAU,EAAE,CAAC;KAC7C;IAED,IAAI;QACF,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QACrE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;SAC/D;QAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEtC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;YAC5B,UAAU,EAAE,GAAG;YACf,OAAO,EAAE,OAAO;SACjB,CAAC,CAAC;QAEH,gBAAgB;QAChB,WAAW,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;QAE/B,OAAO,MAAM,CAAC;KACf;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5E,OAAO,sCAAsC,aAAa,YAAY,YAAY,0BAA0B,CAAC;KAC9G;AACH,CAAC;AArCD,kCAqCC"}
package/dist/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
4
+ const server_1 = require("./server");
5
+ async function main() {
6
+ const server = (0, server_1.createServer)();
7
+ const transport = new stdio_js_1.StdioServerTransport();
8
+ await server.connect(transport);
9
+ }
10
+ main().catch((error) => {
11
+ console.error("Fatal error in main():", error);
12
+ process.exit(1);
13
+ });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAGA,wEAAiF;AAEjF,qCAAwC;AAExC,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAc,IAAA,qBAAY,GAAE,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/dist/server.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createServer = void 0;
4
+ // Copyright (c) Microsoft Corporation.
5
+ // Licensed under the MIT license.
6
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
7
+ const zod_1 = require("zod");
8
+ const fetcher_1 = require("./fetcher");
9
+ function createServer() {
10
+ const server = new mcp_js_1.McpServer({
11
+ name: "m365agentstoolkit-mcp",
12
+ version: "0.1.0",
13
+ });
14
+ server.tool("get_schema", 'Get the schema for "App manifest", "Declarative agent manifest", "API plugin manifest", use it everytime before understanding, modifying or creating any of these manifest files.', {
15
+ schema_name: fetcher_1.SchemaTypeEnum.describe("name of schema"),
16
+ schema_version: zod_1.z.string().describe("version of schema"),
17
+ }, async ({ schema_name, schema_version }) => {
18
+ const schema = await (0, fetcher_1.fetchSchema)(schema_name, schema_version);
19
+ return {
20
+ content: [
21
+ {
22
+ type: "text",
23
+ text: schema,
24
+ },
25
+ ],
26
+ };
27
+ });
28
+ return server;
29
+ }
30
+ exports.createServer = createServer;
31
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AACvC,kCAAkC;AAClC,oEAAoE;AACpE,6BAAwB;AACxB,uCAAwD;AAExD,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,kBAAS,CAAC;QAC3B,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CACT,YAAY,EACZ,mLAAmL,EACnL;QACE,WAAW,EAAE,wBAAc,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QACtD,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;KACzD,EACD,KAAK,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,EAAE,EAAE;QACxC,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAW,EAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAE9D,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM;iBACb;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AA3BD,oCA2BC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@microsoft/m365agentstoolkit-mcp",
3
+ "version": "0.1.0-alpha.18ed8019e.0",
4
+ "scripts": {
5
+ "build": "tsc && shx chmod +x dist/index.js",
6
+ "watch": "tsc --watch",
7
+ "start": "node ./dist/index.js",
8
+ "test:unit": "jest",
9
+ "lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\"",
10
+ "lint:staged": "lint-staged",
11
+ "lint:fix": "eslint --fix \"src/**/*.ts\" \"tests/**/*.ts\""
12
+ },
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "keywords": [
20
+ "mcp"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/OfficeDev/teams-toolkit.git"
25
+ },
26
+ "author": "Microsoft Corporation",
27
+ "license": "MIT",
28
+ "description": "MCP server for Microsoft 365 Agents Toolkit",
29
+ "dependencies": {
30
+ "@modelcontextprotocol/sdk": "^1.9.0",
31
+ "zod": "^3.24.2"
32
+ },
33
+ "devDependencies": {
34
+ "@istanbuljs/nyc-config-typescript": "^1.0.2",
35
+ "@types/jest": "^29.5.13",
36
+ "@types/node": "^20.10.0",
37
+ "@types/sinon": "^17.0.4",
38
+ "@typescript-eslint/eslint-plugin": "^4.19.0",
39
+ "@typescript-eslint/parser": "^4.19.0",
40
+ "chai": "^5.2.0",
41
+ "eslint": "^7.29.0",
42
+ "eslint-plugin-header": "^3.1.1",
43
+ "eslint-plugin-import": "^2.25.2",
44
+ "eslint-plugin-no-secrets": "^0.8.9",
45
+ "eslint-plugin-prettier": "^4.0.0",
46
+ "jest": "^29.7.0",
47
+ "jest-environment-node": "^29.7.0",
48
+ "nock": "^14.0.4",
49
+ "prettier": "^2.4.1",
50
+ "shx": "^0.3.4",
51
+ "sinon": "^20.0.0",
52
+ "ts-jest": "29.2.5",
53
+ "ts-node": "^9.1.1",
54
+ "typescript": "^4.4.4"
55
+ },
56
+ "lint-staged": {
57
+ "*.{js,jsx,css,ts,tsx}": [
58
+ "npx eslint --cache --fix --quiet"
59
+ ]
60
+ },
61
+ "gitHead": "2b0fdff8334c5e67cb619e471d44a5fe463b02fa"
62
+ }