@sammorrowdrums/mcpi-ext 0.2.0 → 0.2.1

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.
Files changed (208) hide show
  1. package/dist/code-mode/code-mode-integration.test.d.ts +2 -0
  2. package/dist/code-mode/code-mode-integration.test.d.ts.map +1 -0
  3. package/dist/code-mode/code-mode-integration.test.js +116 -0
  4. package/dist/code-mode/code-mode-integration.test.js.map +1 -0
  5. package/dist/code-mode/eligibility.d.ts +10 -0
  6. package/dist/code-mode/eligibility.d.ts.map +1 -0
  7. package/dist/code-mode/eligibility.js +14 -0
  8. package/dist/code-mode/eligibility.js.map +1 -0
  9. package/dist/code-mode/eligibility.test.d.ts +2 -0
  10. package/dist/code-mode/eligibility.test.d.ts.map +1 -0
  11. package/dist/code-mode/eligibility.test.js +53 -0
  12. package/dist/code-mode/eligibility.test.js.map +1 -0
  13. package/dist/code-mode/executor.d.ts +35 -0
  14. package/dist/code-mode/executor.d.ts.map +1 -0
  15. package/dist/code-mode/executor.js +120 -0
  16. package/dist/code-mode/executor.js.map +1 -0
  17. package/dist/code-mode/executor.test.d.ts +2 -0
  18. package/dist/code-mode/executor.test.d.ts.map +1 -0
  19. package/dist/code-mode/executor.test.js +130 -0
  20. package/dist/code-mode/executor.test.js.map +1 -0
  21. package/dist/code-mode/index.d.ts +65 -0
  22. package/dist/code-mode/index.d.ts.map +1 -0
  23. package/dist/code-mode/index.js +175 -0
  24. package/dist/code-mode/index.js.map +1 -0
  25. package/dist/code-mode/tools.d.ts +45 -0
  26. package/dist/code-mode/tools.d.ts.map +1 -0
  27. package/dist/code-mode/tools.js +70 -0
  28. package/dist/code-mode/tools.js.map +1 -0
  29. package/dist/code-mode/type-hints.d.ts +20 -0
  30. package/dist/code-mode/type-hints.d.ts.map +1 -0
  31. package/dist/code-mode/type-hints.js +189 -0
  32. package/dist/code-mode/type-hints.js.map +1 -0
  33. package/dist/code-mode/type-hints.test.d.ts +2 -0
  34. package/dist/code-mode/type-hints.test.d.ts.map +1 -0
  35. package/dist/code-mode/type-hints.test.js +157 -0
  36. package/dist/code-mode/type-hints.test.js.map +1 -0
  37. package/dist/docker-e2e.d.ts +55 -0
  38. package/dist/docker-e2e.d.ts.map +1 -0
  39. package/dist/docker-e2e.js +235 -0
  40. package/dist/docker-e2e.js.map +1 -0
  41. package/dist/docker-e2e.test.d.ts +2 -0
  42. package/dist/docker-e2e.test.d.ts.map +1 -0
  43. package/dist/docker-e2e.test.js +176 -0
  44. package/dist/docker-e2e.test.js.map +1 -0
  45. package/dist/index.d.ts +3 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +148 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/index.test.d.ts +2 -0
  50. package/dist/index.test.d.ts.map +1 -0
  51. package/dist/index.test.js +8 -0
  52. package/dist/index.test.js.map +1 -0
  53. package/dist/mcp/client-manager.d.ts +46 -0
  54. package/dist/mcp/client-manager.d.ts.map +1 -0
  55. package/dist/mcp/client-manager.js +148 -0
  56. package/dist/mcp/client-manager.js.map +1 -0
  57. package/dist/mcp/client-manager.test.d.ts +2 -0
  58. package/dist/mcp/client-manager.test.d.ts.map +1 -0
  59. package/dist/mcp/client-manager.test.js +204 -0
  60. package/dist/mcp/client-manager.test.js.map +1 -0
  61. package/dist/mcp/config-loader.d.ts +8 -0
  62. package/dist/mcp/config-loader.d.ts.map +1 -0
  63. package/dist/mcp/config-loader.js +43 -0
  64. package/dist/mcp/config-loader.js.map +1 -0
  65. package/dist/mcp/config-loader.test.d.ts +2 -0
  66. package/dist/mcp/config-loader.test.d.ts.map +1 -0
  67. package/dist/mcp/config-loader.test.js +93 -0
  68. package/dist/mcp/config-loader.test.js.map +1 -0
  69. package/dist/mcp/config.d.ts +46 -0
  70. package/dist/mcp/config.d.ts.map +1 -0
  71. package/dist/mcp/config.js +28 -0
  72. package/dist/mcp/config.js.map +1 -0
  73. package/{src/mcp/index.ts → dist/mcp/index.d.ts} +1 -0
  74. package/dist/mcp/index.d.ts.map +1 -0
  75. package/dist/mcp/index.js +4 -0
  76. package/dist/mcp/index.js.map +1 -0
  77. package/dist/skills/discover.d.ts +10 -0
  78. package/dist/skills/discover.d.ts.map +1 -0
  79. package/dist/skills/discover.js +60 -0
  80. package/dist/skills/discover.js.map +1 -0
  81. package/dist/skills/format.d.ts +10 -0
  82. package/dist/skills/format.d.ts.map +1 -0
  83. package/dist/skills/format.js +38 -0
  84. package/dist/skills/format.js.map +1 -0
  85. package/dist/skills/format.test.d.ts +2 -0
  86. package/dist/skills/format.test.d.ts.map +1 -0
  87. package/dist/skills/format.test.js +63 -0
  88. package/dist/skills/format.test.js.map +1 -0
  89. package/{src/skills/index.ts → dist/skills/index.d.ts} +2 -5
  90. package/dist/skills/index.d.ts.map +1 -0
  91. package/dist/skills/index.js +6 -0
  92. package/dist/skills/index.js.map +1 -0
  93. package/dist/skills/load-skill-tool.d.ts +40 -0
  94. package/dist/skills/load-skill-tool.d.ts.map +1 -0
  95. package/dist/skills/load-skill-tool.js +104 -0
  96. package/dist/skills/load-skill-tool.js.map +1 -0
  97. package/dist/skills/mcp-tool-proxy.d.ts +11 -0
  98. package/dist/skills/mcp-tool-proxy.d.ts.map +1 -0
  99. package/dist/skills/mcp-tool-proxy.js +116 -0
  100. package/dist/skills/mcp-tool-proxy.js.map +1 -0
  101. package/dist/skills/skill-integration.test.d.ts +2 -0
  102. package/dist/skills/skill-integration.test.d.ts.map +1 -0
  103. package/dist/skills/skill-integration.test.js +119 -0
  104. package/dist/skills/skill-integration.test.js.map +1 -0
  105. package/dist/skills/skill-registry.d.ts +39 -0
  106. package/dist/skills/skill-registry.d.ts.map +1 -0
  107. package/dist/skills/skill-registry.js +48 -0
  108. package/dist/skills/skill-registry.js.map +1 -0
  109. package/dist/skills/skill-registry.test.d.ts +2 -0
  110. package/dist/skills/skill-registry.test.d.ts.map +1 -0
  111. package/dist/skills/skill-registry.test.js +67 -0
  112. package/dist/skills/skill-registry.test.js.map +1 -0
  113. package/dist/test-servers/weather-server.d.ts +12 -0
  114. package/dist/test-servers/weather-server.d.ts.map +1 -0
  115. package/dist/test-servers/weather-server.js +139 -0
  116. package/dist/test-servers/weather-server.js.map +1 -0
  117. package/dist/test-servers/weather-stdio.d.ts +2 -0
  118. package/dist/test-servers/weather-stdio.d.ts.map +1 -0
  119. package/{src/test-servers/weather-stdio.ts → dist/test-servers/weather-stdio.js} +1 -1
  120. package/dist/test-servers/weather-stdio.js.map +1 -0
  121. package/dist/tool-cli/cli.d.ts +3 -0
  122. package/dist/tool-cli/cli.d.ts.map +1 -0
  123. package/dist/tool-cli/cli.js +179 -0
  124. package/dist/tool-cli/cli.js.map +1 -0
  125. package/dist/tool-cli/constants.d.ts +7 -0
  126. package/dist/tool-cli/constants.d.ts.map +1 -0
  127. package/dist/tool-cli/constants.js +15 -0
  128. package/dist/tool-cli/constants.js.map +1 -0
  129. package/dist/tool-cli/format.d.ts +8 -0
  130. package/dist/tool-cli/format.d.ts.map +1 -0
  131. package/{src/tool-cli/format.ts → dist/tool-cli/format.js} +5 -4
  132. package/dist/tool-cli/format.js.map +1 -0
  133. package/dist/tool-cli/format.test.d.ts +2 -0
  134. package/dist/tool-cli/format.test.d.ts.map +1 -0
  135. package/dist/tool-cli/format.test.js +30 -0
  136. package/dist/tool-cli/format.test.js.map +1 -0
  137. package/{src/tool-cli/index.ts → dist/tool-cli/index.d.ts} +1 -0
  138. package/dist/tool-cli/index.d.ts.map +1 -0
  139. package/dist/tool-cli/index.js +3 -0
  140. package/dist/tool-cli/index.js.map +1 -0
  141. package/dist/tool-cli/rpc-client.d.ts +6 -0
  142. package/dist/tool-cli/rpc-client.d.ts.map +1 -0
  143. package/dist/tool-cli/rpc-client.js +25 -0
  144. package/dist/tool-cli/rpc-client.js.map +1 -0
  145. package/dist/tool-cli/rpc-server.d.ts +48 -0
  146. package/dist/tool-cli/rpc-server.d.ts.map +1 -0
  147. package/dist/tool-cli/rpc-server.js +220 -0
  148. package/dist/tool-cli/rpc-server.js.map +1 -0
  149. package/dist/tool-cli/rpc-server.test.d.ts +2 -0
  150. package/dist/tool-cli/rpc-server.test.d.ts.map +1 -0
  151. package/dist/tool-cli/rpc-server.test.js +154 -0
  152. package/dist/tool-cli/rpc-server.test.js.map +1 -0
  153. package/package.json +5 -1
  154. package/.dockerignore +0 -6
  155. package/.github/dependabot.yml +0 -25
  156. package/.github/workflows/ci.yml +0 -50
  157. package/.hadolint.yaml +0 -6
  158. package/.prettierignore +0 -4
  159. package/.prettierrc +0 -7
  160. package/AGENTS.md +0 -118
  161. package/DECISIONS.md +0 -99
  162. package/Dockerfile +0 -39
  163. package/aube-lock.yaml +0 -4146
  164. package/docs/code-mode.md +0 -38
  165. package/docs/skills.md +0 -57
  166. package/docs/tool-cli.md +0 -54
  167. package/eslint.config.js +0 -27
  168. package/images/banner.webp +0 -0
  169. package/images/code-c-maude.webp +0 -0
  170. package/images/code-mode-histogram.png +0 -0
  171. package/images/nuclear-mcp-football.webp +0 -0
  172. package/images/skills-enabling-mcp-tools.png +0 -0
  173. package/images/the-skill-dealer.webp +0 -0
  174. package/images/tool-cli-grep.png +0 -0
  175. package/mise.toml +0 -53
  176. package/scripts/docker-entrypoint.sh +0 -29
  177. package/scripts/test-echo-server.mjs +0 -28
  178. package/scripts/test-mcp-integration.mjs +0 -59
  179. package/scripts/test-tool-cli-smoke.mjs +0 -93
  180. package/src/code-mode/code-mode-integration.test.ts +0 -135
  181. package/src/code-mode/eligibility.test.ts +0 -60
  182. package/src/code-mode/eligibility.ts +0 -16
  183. package/src/code-mode/executor.test.ts +0 -168
  184. package/src/code-mode/executor.ts +0 -163
  185. package/src/code-mode/index.ts +0 -208
  186. package/src/code-mode/tools.ts +0 -110
  187. package/src/code-mode/type-hints.test.ts +0 -187
  188. package/src/code-mode/type-hints.ts +0 -249
  189. package/src/docker-e2e.test.ts +0 -195
  190. package/src/docker-e2e.ts +0 -277
  191. package/src/index.test.ts +0 -8
  192. package/src/index.ts +0 -179
  193. package/src/mcp/client-manager.test.ts +0 -250
  194. package/src/mcp/client-manager.ts +0 -199
  195. package/src/mcp/config-loader.test.ts +0 -115
  196. package/src/mcp/config-loader.ts +0 -46
  197. package/src/mcp/config.ts +0 -40
  198. package/src/skills/discover.ts +0 -81
  199. package/src/skills/format.test.ts +0 -70
  200. package/src/skills/format.ts +0 -42
  201. package/src/skills/load-skill-tool.ts +0 -136
  202. package/src/skills/mcp-tool-proxy.ts +0 -143
  203. package/src/skills/skill-integration.test.ts +0 -139
  204. package/src/skills/skill-registry.test.ts +0 -83
  205. package/src/skills/skill-registry.ts +0 -69
  206. package/src/test-servers/weather-server.ts +0 -171
  207. package/src/tool-cli/format.test.ts +0 -33
  208. package/tsconfig.json +0 -21
@@ -1,69 +0,0 @@
1
- /** Metadata for a skill discovered from an MCP server. */
2
- export interface McpSkillMetadata {
3
- /** Skill name from SKILL.md frontmatter. */
4
- name: string;
5
- /** Short description from SKILL.md frontmatter. */
6
- description: string;
7
- /** The skill:// URI for the SKILL.md resource. */
8
- uri: string;
9
- /** Which MCP server this skill came from. */
10
- serverName: string;
11
- /** Tool names this skill gates via allowed-tools frontmatter. */
12
- allowedTools: string[];
13
- }
14
-
15
- /**
16
- * Registry for MCP-discovered skills.
17
- *
18
- * Holds skill metadata discovered from MCP servers. Skills are registered
19
- * during MCP connection and looked up when the model invokes load_skill.
20
- */
21
- export class SkillRegistry {
22
- private skills = new Map<string, McpSkillMetadata>();
23
-
24
- /** Register a skill. Overwrites any existing skill with the same name. */
25
- register(skill: McpSkillMetadata): void {
26
- this.skills.set(skill.name, skill);
27
- }
28
-
29
- /** Register multiple skills at once. */
30
- registerAll(skills: McpSkillMetadata[]): void {
31
- for (const skill of skills) {
32
- this.register(skill);
33
- }
34
- }
35
-
36
- /** Get a skill by name. */
37
- get(name: string): McpSkillMetadata | undefined {
38
- return this.skills.get(name);
39
- }
40
-
41
- /** Get all registered skills. */
42
- getAll(): McpSkillMetadata[] {
43
- return [...this.skills.values()];
44
- }
45
-
46
- /** Remove a skill by name. */
47
- unregister(name: string): boolean {
48
- return this.skills.delete(name);
49
- }
50
-
51
- /** Remove all skills from a specific MCP server. */
52
- unregisterByServer(serverName: string): void {
53
- for (const [name, skill] of this.skills) {
54
- if (skill.serverName === serverName) {
55
- this.skills.delete(name);
56
- }
57
- }
58
- }
59
-
60
- /** Remove all skills. */
61
- clear(): void {
62
- this.skills.clear();
63
- }
64
-
65
- /** Number of registered skills. */
66
- get size(): number {
67
- return this.skills.size;
68
- }
69
- }
@@ -1,171 +0,0 @@
1
- /**
2
- * Test MCP weather server — exposes a weather skill with gated tools.
3
- *
4
- * Registers:
5
- * - skill://weather/SKILL.md — a skill resource with frontmatter
6
- * - check_weather_for_city — current weather (gated by skill)
7
- * - check_weekly_forecast_for_city — 7-day forecast (gated by skill)
8
- * - echo — ungated baseline tool
9
- */
10
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
11
- import { z } from "zod";
12
-
13
- const SKILL_CONTENT = `---
14
- name: weather
15
- description: Check current weather and weekly forecasts for any city
16
- allowed-tools:
17
- - check_weather_for_city
18
- - check_weekly_forecast_for_city
19
- ---
20
-
21
- # Weather Forecasting Skill
22
-
23
- Use the weather tools to look up conditions for any city.
24
-
25
- - **check_weather_for_city** — returns current temperature, conditions, and humidity
26
- - **check_weekly_forecast_for_city** — returns a 7-day forecast summary
27
-
28
- Always confirm the city name with the user before calling.
29
- `;
30
-
31
- const WEATHER_DATA: Record<string, { temp: number; conditions: string; humidity: number }> = {
32
- london: { temp: 14, conditions: "Cloudy", humidity: 78 },
33
- tokyo: { temp: 26, conditions: "Sunny", humidity: 55 },
34
- "new york": { temp: 22, conditions: "Partly cloudy", humidity: 62 },
35
- sydney: { temp: 19, conditions: "Clear", humidity: 45 },
36
- };
37
-
38
- const FORECAST_DATA: Record<string, string> = {
39
- london:
40
- "Mon 13°C Rain | Tue 14°C Cloudy | Wed 15°C Cloudy | Thu 12°C Rain | Fri 14°C Sunny | Sat 16°C Sunny | Sun 15°C Cloudy",
41
- tokyo:
42
- "Mon 27°C Sunny | Tue 28°C Sunny | Wed 25°C Rain | Thu 24°C Cloudy | Fri 26°C Sunny | Sat 27°C Sunny | Sun 26°C Partly cloudy",
43
- "new york":
44
- "Mon 23°C Sunny | Tue 24°C Sunny | Wed 20°C Thunderstorms | Thu 18°C Cloudy | Fri 21°C Sunny | Sat 22°C Sunny | Sun 23°C Clear",
45
- sydney:
46
- "Mon 18°C Clear | Tue 20°C Sunny | Wed 19°C Cloudy | Thu 17°C Rain | Fri 18°C Cloudy | Sat 21°C Sunny | Sun 20°C Clear",
47
- };
48
-
49
- export function createWeatherServer(): McpServer {
50
- const server = new McpServer(
51
- { name: "test-weather-server", version: "0.1.0" },
52
- { capabilities: { resources: {} } },
53
- );
54
-
55
- // Skill resource
56
- server.registerResource(
57
- "weather-skill",
58
- "skill://weather/SKILL.md",
59
- {
60
- description: "Weather forecasting skill instructions",
61
- mimeType: "text/markdown",
62
- },
63
- async () => ({
64
- contents: [
65
- {
66
- uri: "skill://weather/SKILL.md",
67
- text: SKILL_CONTENT,
68
- mimeType: "text/markdown",
69
- },
70
- ],
71
- }),
72
- );
73
-
74
- // Tool: current weather (gated by skill)
75
- server.registerTool(
76
- "check_weather_for_city",
77
- {
78
- description: "Get current weather conditions for a city",
79
- inputSchema: { city: z.string().describe("City name, e.g. 'London'") },
80
- outputSchema: {
81
- temperature: z.number().describe("Temperature in Celsius"),
82
- conditions: z.string().describe("Weather conditions description"),
83
- humidity: z.number().describe("Humidity percentage"),
84
- city: z.string().describe("City name"),
85
- },
86
- annotations: { readOnlyHint: true },
87
- },
88
- async ({ city }) => {
89
- const data = WEATHER_DATA[city.toLowerCase()];
90
- if (!data) {
91
- return {
92
- content: [
93
- {
94
- type: "text" as const,
95
- text: `No weather data available for "${city}". Try: London, Tokyo, New York, or Sydney.`,
96
- },
97
- ],
98
- };
99
- }
100
- const structuredContent = {
101
- temperature: data.temp,
102
- conditions: data.conditions,
103
- humidity: data.humidity,
104
- city,
105
- };
106
- return {
107
- content: [
108
- {
109
- type: "text" as const,
110
- text: `Weather in ${city}: ${data.conditions}, ${data.temp}°C, humidity ${data.humidity}%`,
111
- },
112
- ],
113
- structuredContent,
114
- };
115
- },
116
- );
117
-
118
- // Tool: weekly forecast (gated by skill)
119
- server.registerTool(
120
- "check_weekly_forecast_for_city",
121
- {
122
- description: "Get a 7-day weather forecast for a city",
123
- inputSchema: { city: z.string().describe("City name, e.g. 'Tokyo'") },
124
- outputSchema: {
125
- city: z.string().describe("City name"),
126
- forecast: z.string().describe("7-day forecast summary"),
127
- },
128
- annotations: { readOnlyHint: true },
129
- },
130
- async ({ city }) => {
131
- const forecast = FORECAST_DATA[city.toLowerCase()];
132
- if (!forecast) {
133
- return {
134
- content: [
135
- {
136
- type: "text" as const,
137
- text: `No forecast data available for "${city}". Try: London, Tokyo, New York, or Sydney.`,
138
- },
139
- ],
140
- };
141
- }
142
- const structuredContent = { city, forecast };
143
- return {
144
- content: [{ type: "text" as const, text: `Forecast for ${city}: ${forecast}` }],
145
- structuredContent,
146
- };
147
- },
148
- );
149
-
150
- // Ungated tool (always available, not behind a skill)
151
- server.registerTool(
152
- "echo",
153
- {
154
- description: "Echoes back the input message",
155
- inputSchema: { message: z.string() },
156
- outputSchema: {
157
- echo: z.string().describe("The echoed message"),
158
- },
159
- annotations: { readOnlyHint: true },
160
- },
161
- async ({ message }) => {
162
- const structuredContent = { echo: message };
163
- return {
164
- content: [{ type: "text" as const, text: `Echo: ${message}` }],
165
- structuredContent,
166
- };
167
- },
168
- );
169
-
170
- return server;
171
- }
@@ -1,33 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { formatToolCliForPrompt } from "./format.js";
3
-
4
- describe("formatToolCliForPrompt", () => {
5
- it("returns empty string when no servers connected", () => {
6
- expect(formatToolCliForPrompt(0)).toBe("");
7
- });
8
-
9
- it("includes tool-cli usage instructions when servers are connected", () => {
10
- const result = formatToolCliForPrompt(2);
11
- expect(result).toContain("tool-cli");
12
- expect(result).toContain("<tool_cli>");
13
- expect(result).toContain("</tool_cli>");
14
- expect(result).toContain("--help");
15
- expect(result).toContain("<server>");
16
- expect(result).toContain("<tool>");
17
- expect(result).toContain("2 MCP server(s) currently connected");
18
- });
19
-
20
- it("advises preferring skills over tool-cli", () => {
21
- const result = formatToolCliForPrompt(1);
22
- expect(result).toContain("prefer the skill");
23
- });
24
-
25
- it("includes shell chaining and piping examples", () => {
26
- const result = formatToolCliForPrompt(1);
27
- expect(result).toContain("grep");
28
- expect(result).toContain("|");
29
- expect(result).toContain("jq");
30
- expect(result).toContain("xargs");
31
- expect(result).toContain("Prefer piping and chaining");
32
- });
33
- });
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "Node16",
5
- "moduleResolution": "Node16",
6
- "lib": ["ES2022"],
7
- "outDir": "dist",
8
- "rootDir": "src",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "sourceMap": true,
16
- "resolveJsonModule": true,
17
- "types": ["node"]
18
- },
19
- "include": ["src"],
20
- "exclude": ["node_modules", "dist"]
21
- }