@mcpc-tech/plugin-markdown-loader 0.0.2
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 +21 -0
- package/index.cjs +4000 -0
- package/index.mjs +3961 -0
- package/package.json +42 -0
- package/types/mod.d.ts +38 -0
- package/types/mod.d.ts.map +1 -0
- package/types/src/markdown-loader.d.ts +85 -0
- package/types/src/markdown-loader.d.ts.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcpc-tech/plugin-markdown-loader",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"homepage": "https://jsr.io/@mcpc/plugin-markdown-loader",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@ai-sdk/provider": "^2.0.0",
|
|
7
|
+
"@mcpc-tech/acp-ai-provider": "^0.1.20",
|
|
8
|
+
"@mcpc-tech/ripgrep-napi": "^0.0.4",
|
|
9
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
10
|
+
"@opentelemetry/api": "^1.9.0",
|
|
11
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.56.0",
|
|
12
|
+
"@opentelemetry/resources": "^1.29.0",
|
|
13
|
+
"@opentelemetry/sdk-trace-base": "^1.29.0",
|
|
14
|
+
"@opentelemetry/sdk-trace-node": "^1.29.0",
|
|
15
|
+
"@opentelemetry/semantic-conventions": "^1.29.0",
|
|
16
|
+
"@segment/ajv-human-errors": "^2.15.0",
|
|
17
|
+
"ai": "^5.0.60",
|
|
18
|
+
"ajv": "^8.17.1",
|
|
19
|
+
"ajv-errors": "^3.0.0",
|
|
20
|
+
"ajv-formats": "^3.0.1",
|
|
21
|
+
"cheerio": "^1.0.0",
|
|
22
|
+
"json-schema-traverse": "^1.0.0",
|
|
23
|
+
"jsonrepair": "^3.13.0"
|
|
24
|
+
},
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./types/mod.d.ts",
|
|
28
|
+
"import": "./index.mjs",
|
|
29
|
+
"require": "./index.cjs"
|
|
30
|
+
},
|
|
31
|
+
"./types/*": "./types/*"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/mcpc-tech/mcpc.git"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/mcpc-tech/mcpc/issues"
|
|
39
|
+
},
|
|
40
|
+
"main": "./index.cjs",
|
|
41
|
+
"module": "./index.mjs"
|
|
42
|
+
}
|
package/types/mod.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @mcpc/plugin-markdown-loader
|
|
3
|
+
*
|
|
4
|
+
* Markdown agent definition loader plugin for MCPC.
|
|
5
|
+
* Enables loading agent definitions from Markdown files with YAML front matter.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Option 1: String path (recommended)
|
|
10
|
+
* const server = await mcpc(
|
|
11
|
+
* [{ name: "server", version: "1.0.0" }, { capabilities: { tools: {} } }],
|
|
12
|
+
* ["./agents/my-agent.md"],
|
|
13
|
+
* { plugins: ["@mcpc/plugin-markdown-loader"] }
|
|
14
|
+
* );
|
|
15
|
+
*
|
|
16
|
+
* // Option 2: Import directly
|
|
17
|
+
* import { markdownLoaderPlugin } from "@mcpc/plugin-markdown-loader";
|
|
18
|
+
* const server = await mcpc(
|
|
19
|
+
* [{ name: "server", version: "1.0.0" }, { capabilities: { tools: {} } }],
|
|
20
|
+
* ["./agents/my-agent.md"],
|
|
21
|
+
* { plugins: [markdownLoaderPlugin()] }
|
|
22
|
+
* );
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module
|
|
26
|
+
*/ import { type ToolPlugin } from "@jsr/mcpc__core";
|
|
27
|
+
export { setMarkdownAgentLoader } from "@jsr/mcpc__core";
|
|
28
|
+
export { isMarkdownAgentFile, loadMarkdownAgentFile, type MarkdownAgentFrontMatter, markdownAgentToComposeDefinition, type ParsedMarkdownAgent, parseMarkdownAgent } from "./src/markdown-loader.js";
|
|
29
|
+
/**
|
|
30
|
+
* Create a Markdown loader plugin for mcpc().
|
|
31
|
+
*
|
|
32
|
+
* This plugin registers the Markdown file loader, enabling you to use
|
|
33
|
+
* Markdown file paths as compose inputs.
|
|
34
|
+
*/ export declare function markdownLoaderPlugin(): ToolPlugin;
|
|
35
|
+
/** Factory function for string-based plugin loading */ export declare const createPlugin: any;
|
|
36
|
+
/** Default plugin instance for string-based plugin loading */ declare const defaultPlugin: ToolPlugin;
|
|
37
|
+
export default defaultPlugin;
|
|
38
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBC,GAED,SAAiC,KAAK,UAAU,0BAAiC;AAIjF,SAAS,sBAAsB,0BAAiC;AAEhE,SACE,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,wBAAwB,EAC7B,gCAAgC,EAChC,KAAK,mBAAmB,EACxB,kBAAkB,mCACc;AAElC;;;;;CAKC,GACD,OAAO,iBAAS,wBAAwB;AAWxC,qDAAqD,GACrD,OAAO,cAAM,kBAAoC;AAEjD,4DAA4D,GAC5D,cAAM,eAAe;AACrB,eAAe,cAAc"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown Agent Definition Loader
|
|
3
|
+
*
|
|
4
|
+
* This module provides utilities to load agent definitions from Markdown files
|
|
5
|
+
* with YAML front matter for configuration.
|
|
6
|
+
*
|
|
7
|
+
* Markdown agent files use the following format:
|
|
8
|
+
* ```markdown
|
|
9
|
+
* ---
|
|
10
|
+
* name: my-agent
|
|
11
|
+
* mode: agentic
|
|
12
|
+
* maxSteps: 50
|
|
13
|
+
* deps:
|
|
14
|
+
* mcpServers:
|
|
15
|
+
* desktop-commander:
|
|
16
|
+
* command: npx
|
|
17
|
+
* args: ["-y", "@wonderwhy-er/desktop-commander@latest"]
|
|
18
|
+
* transportType: stdio
|
|
19
|
+
* ---
|
|
20
|
+
*
|
|
21
|
+
* # Agent Description
|
|
22
|
+
*
|
|
23
|
+
* Your agent description goes here in Markdown format.
|
|
24
|
+
* You can use <tool name="server.tool_name"/> to reference tools.
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/ import { type ComposeDefinition, isMarkdownFile, type McpServerConfig, type SamplingConfig } from "@jsr/mcpc__core";
|
|
29
|
+
export { isMarkdownFile as isMarkdownAgentFile };
|
|
30
|
+
/**
|
|
31
|
+
* Front matter configuration for Markdown agent definitions
|
|
32
|
+
*/ export interface MarkdownAgentFrontMatter {
|
|
33
|
+
/** Agent name (required) */ name: string;
|
|
34
|
+
/** Execution mode */ mode?: "agentic" | "ai_sampling" | "ai_acp" | "code_execution";
|
|
35
|
+
/** Maximum execution steps */ maxSteps?: number;
|
|
36
|
+
/** Maximum tokens for sampling */ maxTokens?: number;
|
|
37
|
+
/** Enable tracing */ tracingEnabled?: boolean;
|
|
38
|
+
/** MCP server dependencies */ deps?: {
|
|
39
|
+
mcpServers: Record<string, McpServerConfig>;
|
|
40
|
+
};
|
|
41
|
+
/** Plugin file paths */ plugins?: string[];
|
|
42
|
+
/** Tool references */ refs?: string[];
|
|
43
|
+
/** Sampling configuration */ samplingConfig?: SamplingConfig;
|
|
44
|
+
/** Provider options for AI SDK sampling mode */ providerOptions?: {
|
|
45
|
+
modelPreferences?: {
|
|
46
|
+
hints?: Array<{
|
|
47
|
+
name?: string;
|
|
48
|
+
}>;
|
|
49
|
+
costPriority?: number;
|
|
50
|
+
speedPriority?: number;
|
|
51
|
+
intelligencePriority?: number;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/** ACP settings for AI SDK ACP mode */ acpSettings?: {
|
|
55
|
+
command: string;
|
|
56
|
+
args?: string[];
|
|
57
|
+
env?: Record<string, string>;
|
|
58
|
+
session?: {
|
|
59
|
+
cwd?: string;
|
|
60
|
+
mcpServers?: Array<{
|
|
61
|
+
name: string;
|
|
62
|
+
command: string;
|
|
63
|
+
args?: string[];
|
|
64
|
+
env?: Record<string, string>;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
67
|
+
persistSession?: boolean;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Result of parsing a Markdown agent file
|
|
72
|
+
*/ export interface ParsedMarkdownAgent {
|
|
73
|
+
frontMatter: MarkdownAgentFrontMatter;
|
|
74
|
+
description: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Parse YAML front matter and Markdown content from a string
|
|
78
|
+
*/ export declare function parseMarkdownAgent(content: string): ParsedMarkdownAgent;
|
|
79
|
+
/**
|
|
80
|
+
* Convert parsed Markdown agent to ComposeDefinition
|
|
81
|
+
*/ export declare function markdownAgentToComposeDefinition(parsed: ParsedMarkdownAgent): ComposeDefinition;
|
|
82
|
+
/**
|
|
83
|
+
* Load a Markdown agent definition from a file path
|
|
84
|
+
*/ export declare function loadMarkdownAgentFile(filePath: string): Promise<ComposeDefinition>;
|
|
85
|
+
//# sourceMappingURL=markdown-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown-loader.d.ts","sources":["../../src/markdown-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,GAED,SACE,KAAK,iBAAiB,EACtB,cAAc,EACd,KAAK,eAAe,EAEpB,KAAK,cAAc,0BACW;AAMhC,SAAyB,kBAAkB,mBAAmB,GAAG;AAgCjE;;CAEC,GACD,iBAAiB;EACf,0BAA0B,GAC1B,MAAM,MAAM;EACZ,mBAAmB,GACnB,OAAO,YAAY,gBAAgB,WAAW;EAC9C,4BAA4B,GAC5B,WA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