@lonca/baron-mcp-server 0.1.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.
@@ -0,0 +1,139 @@
1
+ import { IssuesPort, ScmPort, CiPort, NotifyPort, DeployPort } from '@lonca/baron-core';
2
+ import { KnowledgeLoop } from '@lonca/baron-knowledge-loop';
3
+ import { NativeRequest, NativeResponse, Env } from '@lonca/baron-providers';
4
+ import { RecipeService } from '@lonca/baron-recipes';
5
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
+
7
+ /** The provider-native escape hatch (decision #18), restricted by the caller to bound providers. */
8
+ type NativeAccess = (provider: string, request: NativeRequest) => Promise<NativeResponse>;
9
+ /** The ports the MCP server serves. issues/scm bind from policy; knowledge is always available. */
10
+ interface McpPorts {
11
+ readonly issues?: IssuesPort;
12
+ readonly scm?: ScmPort;
13
+ readonly ci?: CiPort;
14
+ readonly notify?: NotifyPort;
15
+ readonly deploy?: DeployPort;
16
+ readonly knowledge?: KnowledgeLoop;
17
+ /** Provider-native escape hatch (decision #18); set by the loader, scoped to bound providers. */
18
+ readonly nativeAccess?: NativeAccess;
19
+ /** Deterministic recipe runner (built-ins + project recipes) over the bound ports. */
20
+ readonly recipes?: RecipeService;
21
+ }
22
+ /** Tool names: snake_case, `baron_` (product) namespace, singular noun to mirror the primitives. */
23
+ declare const MCP_TOOL_NAMES: {
24
+ readonly create: "baron_issue_create";
25
+ readonly get: "baron_issue_get";
26
+ readonly transition: "baron_issue_transition";
27
+ readonly comment: "baron_issue_comment";
28
+ readonly link: "baron_issue_link";
29
+ readonly query: "baron_issue_query";
30
+ };
31
+ declare const SCM_TOOL_NAMES: {
32
+ readonly branchCreate: "baron_scm_branch_create";
33
+ readonly prCreate: "baron_scm_pr_create";
34
+ readonly prThread: "baron_scm_pr_thread";
35
+ readonly prStatus: "baron_scm_pr_status";
36
+ };
37
+ declare const CI_TOOL_NAMES: {
38
+ readonly pipelines: "baron_ci_pipelines";
39
+ readonly runs: "baron_ci_runs";
40
+ readonly runGet: "baron_ci_run_get";
41
+ readonly runLogs: "baron_ci_run_logs";
42
+ readonly runTrigger: "baron_ci_run_trigger";
43
+ readonly runCancel: "baron_ci_run_cancel";
44
+ };
45
+ declare const NOTIFY_TOOL_NAMES: {
46
+ readonly send: "baron_notify_send";
47
+ };
48
+ declare const DEPLOY_TOOL_NAMES: {
49
+ readonly environments: "baron_deploy_environments";
50
+ readonly deployments: "baron_deploy_deployments";
51
+ };
52
+ declare const NATIVE_TOOL_NAMES: {
53
+ readonly request: "baron_native_request";
54
+ };
55
+ declare const RECIPE_TOOL_NAMES: {
56
+ readonly list: "baron_recipe_list";
57
+ readonly run: "baron_recipe_run";
58
+ };
59
+ declare const LOOP_TOOL_NAMES: {
60
+ readonly learningAppend: "baron_learning_append";
61
+ readonly learningQuery: "baron_learning_query";
62
+ readonly followupAppend: "baron_followup_append";
63
+ readonly followupList: "baron_followup_list";
64
+ };
65
+ /** A tool definition shaped for the MCP ListTools response (plain JSON Schema, no zod). */
66
+ interface ToolDefinition {
67
+ readonly name: string;
68
+ readonly description: string;
69
+ readonly inputSchema: {
70
+ readonly type: 'object';
71
+ readonly properties: Record<string, unknown>;
72
+ readonly required?: readonly string[];
73
+ readonly additionalProperties: false;
74
+ };
75
+ }
76
+ /** The MCP text result shape (structurally a CallToolResult); kept SDK-agnostic for testability. */
77
+ interface ToolResult {
78
+ readonly content: ReadonlyArray<{
79
+ readonly type: 'text';
80
+ readonly text: string;
81
+ }>;
82
+ readonly isError?: boolean;
83
+ readonly structuredContent?: Record<string, unknown>;
84
+ }
85
+ declare const TOOL_DEFINITIONS: readonly ToolDefinition[];
86
+ declare const SCM_TOOL_DEFINITIONS: readonly ToolDefinition[];
87
+ declare const CI_TOOL_DEFINITIONS: readonly ToolDefinition[];
88
+ declare const NOTIFY_TOOL_DEFINITIONS: readonly ToolDefinition[];
89
+ declare const DEPLOY_TOOL_DEFINITIONS: readonly ToolDefinition[];
90
+ declare const NATIVE_TOOL_DEFINITIONS: readonly ToolDefinition[];
91
+ declare const RECIPE_TOOL_DEFINITIONS: readonly ToolDefinition[];
92
+ declare const LOOP_TOOL_DEFINITIONS: readonly ToolDefinition[];
93
+ /**
94
+ * Dispatch an MCP tool call to the issues port. Marshals arguments and shapes errors only — it does
95
+ * no role/state translation (invariant #4) and holds no workflow opinion (invariant #3). Unknown
96
+ * tool names and bad arguments surface as isError results so the agent always sees them.
97
+ */
98
+ declare function callTool(port: IssuesPort, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
99
+ /** Dispatch an scm tool call to the scm port (marshalling + error shaping only). */
100
+ declare function callScmTool(port: ScmPort, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
101
+ /** Dispatch a knowledge-loop tool call (marshalling + error shaping only). */
102
+ declare function callLoopTool(loop: KnowledgeLoop, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
103
+ /** Dispatch an MCP tool call to the ci port. Marshals + shapes errors only. */
104
+ declare function callCiTool(port: CiPort, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
105
+ /** Dispatch an MCP tool call to the notify port. Marshals + shapes errors only. */
106
+ declare function callNotifyTool(port: NotifyPort, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
107
+ /** Dispatch an MCP tool call to the deploy port. Marshals + shapes errors only. */
108
+ declare function callDeployTool(port: DeployPort, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
109
+ /** Dispatch an MCP tool call to the recipe runner. Marshals + shapes errors only. */
110
+ declare function callRecipeTool(service: RecipeService, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
111
+ /** Dispatch the escape-hatch tool to the native access fn. Marshals + shapes errors only. */
112
+ declare function callNativeTool(access: NativeAccess, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
113
+ /** The tool definitions advertised for the currently-bound ports. */
114
+ declare function activeToolDefinitions(ports: McpPorts): ToolDefinition[];
115
+ /** Route a tool call to the right port by its name prefix; unbound ports / unknown names error. */
116
+ declare function dispatchTool(ports: McpPorts, name: string, args: Record<string, unknown> | undefined): Promise<ToolResult>;
117
+
118
+ declare const SERVER_INFO: {
119
+ readonly name: "baron";
120
+ readonly version: "0.0.0";
121
+ };
122
+ /**
123
+ * Wire the bound ports' primitives onto a low-level MCP {@link Server}. It advertises only the tools
124
+ * for ports present in {@link McpPorts} and routes each call to the right port by name prefix. The
125
+ * handlers only marshal — all translation lives in the ports (invariant #4). The pure tool-definition
126
+ * / result shapes are structurally the SDK's, cast at this single boundary to bridge readonly /
127
+ * zod-inferred nominal differences while keeping `tools.ts` SDK-free.
128
+ */
129
+ declare function createMcpServer(ports: McpPorts): Server;
130
+
131
+ /**
132
+ * Load the committed policy and build the ports it serves: the issues/scm ports it binds (either or
133
+ * both) plus the always-available local knowledge loop (markdown store under `.baron/knowledge`). A
134
+ * missing policy is a server-lifecycle failure (POLICY_NOT_FOUND). Credentials come from `env`
135
+ * (overlaid by a gitignored `.baron/credentials` file when present), never from the policy.
136
+ */
137
+ declare function loadPorts(root: string, env: Env): McpPorts;
138
+
139
+ export { CI_TOOL_DEFINITIONS, CI_TOOL_NAMES, DEPLOY_TOOL_DEFINITIONS, DEPLOY_TOOL_NAMES, LOOP_TOOL_DEFINITIONS, LOOP_TOOL_NAMES, MCP_TOOL_NAMES, type McpPorts, NATIVE_TOOL_DEFINITIONS, NATIVE_TOOL_NAMES, NOTIFY_TOOL_DEFINITIONS, NOTIFY_TOOL_NAMES, type NativeAccess, RECIPE_TOOL_DEFINITIONS, RECIPE_TOOL_NAMES, SCM_TOOL_DEFINITIONS, SCM_TOOL_NAMES, SERVER_INFO, TOOL_DEFINITIONS, type ToolDefinition, type ToolResult, activeToolDefinitions, callCiTool, callDeployTool, callLoopTool, callNativeTool, callNotifyTool, callRecipeTool, callScmTool, callTool, createMcpServer, dispatchTool, loadPorts };
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ import {
2
+ CI_TOOL_DEFINITIONS,
3
+ CI_TOOL_NAMES,
4
+ DEPLOY_TOOL_DEFINITIONS,
5
+ DEPLOY_TOOL_NAMES,
6
+ LOOP_TOOL_DEFINITIONS,
7
+ LOOP_TOOL_NAMES,
8
+ MCP_TOOL_NAMES,
9
+ NATIVE_TOOL_DEFINITIONS,
10
+ NATIVE_TOOL_NAMES,
11
+ NOTIFY_TOOL_DEFINITIONS,
12
+ NOTIFY_TOOL_NAMES,
13
+ RECIPE_TOOL_DEFINITIONS,
14
+ RECIPE_TOOL_NAMES,
15
+ SCM_TOOL_DEFINITIONS,
16
+ SCM_TOOL_NAMES,
17
+ SERVER_INFO,
18
+ TOOL_DEFINITIONS,
19
+ activeToolDefinitions,
20
+ callCiTool,
21
+ callDeployTool,
22
+ callLoopTool,
23
+ callNativeTool,
24
+ callNotifyTool,
25
+ callRecipeTool,
26
+ callScmTool,
27
+ callTool,
28
+ createMcpServer,
29
+ dispatchTool,
30
+ loadPorts
31
+ } from "./chunk-MUGSC3EW.js";
32
+ export {
33
+ CI_TOOL_DEFINITIONS,
34
+ CI_TOOL_NAMES,
35
+ DEPLOY_TOOL_DEFINITIONS,
36
+ DEPLOY_TOOL_NAMES,
37
+ LOOP_TOOL_DEFINITIONS,
38
+ LOOP_TOOL_NAMES,
39
+ MCP_TOOL_NAMES,
40
+ NATIVE_TOOL_DEFINITIONS,
41
+ NATIVE_TOOL_NAMES,
42
+ NOTIFY_TOOL_DEFINITIONS,
43
+ NOTIFY_TOOL_NAMES,
44
+ RECIPE_TOOL_DEFINITIONS,
45
+ RECIPE_TOOL_NAMES,
46
+ SCM_TOOL_DEFINITIONS,
47
+ SCM_TOOL_NAMES,
48
+ SERVER_INFO,
49
+ TOOL_DEFINITIONS,
50
+ activeToolDefinitions,
51
+ callCiTool,
52
+ callDeployTool,
53
+ callLoopTool,
54
+ callNativeTool,
55
+ callNotifyTool,
56
+ callRecipeTool,
57
+ callScmTool,
58
+ callTool,
59
+ createMcpServer,
60
+ dispatchTool,
61
+ loadPorts
62
+ };
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@lonca/baron-mcp-server",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "license": "Apache-2.0",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "baron-mcp": "./dist/bin.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "dependencies": {
21
+ "@modelcontextprotocol/sdk": "^1.29.0",
22
+ "@lonca/baron-core": "0.1.0",
23
+ "@lonca/baron-providers": "0.1.0",
24
+ "@lonca/baron-knowledge-loop": "0.1.0",
25
+ "@lonca/baron-recipes": "0.1.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^22.0.0",
29
+ "@lonca/baron-conformance": "0.1.0",
30
+ "@lonca/baron-adapter-github": "0.1.0"
31
+ },
32
+ "description": "Baron MCP server: drive issues, scm, ci, deploy, and notify across providers from any MCP client.",
33
+ "keywords": [
34
+ "baron",
35
+ "ai-agents",
36
+ "mcp",
37
+ "work-orchestration",
38
+ "devops",
39
+ "model-context-protocol",
40
+ "claude",
41
+ "server"
42
+ ],
43
+ "author": "Baron contributors",
44
+ "homepage": "https://github.com/loncadev/baron#readme",
45
+ "bugs": {
46
+ "url": "https://github.com/loncadev/baron/issues"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/loncadev/baron.git",
51
+ "directory": "packages/mcp-server"
52
+ },
53
+ "scripts": {
54
+ "build": "tsup src/index.ts src/bin.ts --format esm --dts --clean",
55
+ "typecheck": "tsc --noEmit"
56
+ }
57
+ }