@agent-lint/mcp 0.3.0 → 0.3.3
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/CHANGELOG.md +38 -0
- package/README.md +32 -108
- package/dist/bin.js +1 -1
- package/dist/catalog.d.ts +5 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/{chunk-ZYDIOQXE.js → chunk-DYP46E6V.js} +147 -115
- package/dist/chunk-DYP46E6V.js.map +1 -0
- package/dist/http.d.ts +2 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/tools/emit-maintenance-snippet.d.ts.map +1 -1
- package/dist/tools/get-guidelines.d.ts.map +1 -1
- package/dist/tools/plan-workspace-autofix.d.ts.map +1 -1
- package/dist/tools/quick-check.d.ts.map +1 -1
- package/dist/transport-security.d.ts +1 -1
- package/dist/transport-security.d.ts.map +1 -1
- package/package.json +14 -10
- package/dist/chunk-ZYDIOQXE.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @agent-lint/mcp Changelog
|
|
2
|
+
|
|
3
|
+
## [0.3.3]
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- GitLab publish jobs now support both plain and file-based `NPM_TOKEN` variables and fail fast on invalid npm auth
|
|
8
|
+
|
|
9
|
+
## [0.3.2]
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- README and npm description now use the current public positioning around structured, current, codebase-aware agent context
|
|
14
|
+
- Public repository cleanup removed internal planning docs from the published surface
|
|
15
|
+
|
|
16
|
+
## [0.3.1]
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- README, npm metadata, and release metadata now match the current 4-tool MCP surface
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Tool timeout wiring is now attached to the active public tools
|
|
25
|
+
- Server version resolution now prefers the package version instead of unrelated workspace env values
|
|
26
|
+
|
|
27
|
+
## [0.3.0]
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Read-only MCP server with 4 tools and 3 resources
|
|
32
|
+
- Stdio and HTTP transports
|
|
33
|
+
- Programmatic server creation helpers
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Current tool timeout wiring now matches the public tool surface
|
|
38
|
+
- Server version reporting now resolves to the real package version
|
package/README.md
CHANGED
|
@@ -1,121 +1,39 @@
|
|
|
1
1
|
# @agent-lint/mcp
|
|
2
2
|
|
|
3
|
-
MCP server for
|
|
3
|
+
Read-only MCP server for keeping `AGENTS.md`, rules, and skills structured, current, and codebase-aware.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
## What It Does
|
|
8
|
-
|
|
9
|
-
Provides a [Model Context Protocol](https://modelcontextprotocol.io/) server that guides your coding agent in creating, maintaining, and improving AI-agent context artifacts:
|
|
10
|
-
|
|
11
|
-
- `AGENTS.md` / `CLAUDE.md`
|
|
12
|
-
- Skills, Rules, Workflows, Plans
|
|
13
|
-
|
|
14
|
-
Comprehensive guidelines, workspace scanning, maintenance rules, and repeatable improvement loops — all without calling any LLM.
|
|
15
|
-
|
|
16
|
-
## Quick Start
|
|
5
|
+
## Start the Server
|
|
17
6
|
|
|
18
7
|
```bash
|
|
19
8
|
npx -y @agent-lint/mcp
|
|
20
9
|
```
|
|
21
10
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
### Cursor
|
|
25
|
-
|
|
26
|
-
Add to `.cursor/mcp.json`:
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{
|
|
30
|
-
"mcpServers": {
|
|
31
|
-
"agentlint": {
|
|
32
|
-
"command": "npx",
|
|
33
|
-
"args": ["-y", "@agent-lint/mcp"]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Claude Desktop
|
|
40
|
-
|
|
41
|
-
Add to `claude_desktop_config.json`:
|
|
42
|
-
|
|
43
|
-
```json
|
|
44
|
-
{
|
|
45
|
-
"mcpServers": {
|
|
46
|
-
"agentlint": {
|
|
47
|
-
"command": "npx",
|
|
48
|
-
"args": ["-y", "@agent-lint/mcp"]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### VS Code
|
|
55
|
-
|
|
56
|
-
Add to `.vscode/mcp.json`:
|
|
57
|
-
|
|
58
|
-
```json
|
|
59
|
-
{
|
|
60
|
-
"servers": {
|
|
61
|
-
"agentlint": {
|
|
62
|
-
"type": "stdio",
|
|
63
|
-
"command": "npx",
|
|
64
|
-
"args": ["-y", "@agent-lint/mcp"]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
11
|
+
For most users, the fastest setup path is still:
|
|
69
12
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
Add to `.windsurf/mcp_config.json`:
|
|
73
|
-
|
|
74
|
-
```json
|
|
75
|
-
{
|
|
76
|
-
"mcpServers": {
|
|
77
|
-
"agentlint": {
|
|
78
|
-
"command": "npx",
|
|
79
|
-
"args": ["-y", "@agent-lint/mcp"]
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
13
|
+
```bash
|
|
14
|
+
npx @agent-lint/cli init
|
|
83
15
|
```
|
|
84
16
|
|
|
85
|
-
##
|
|
17
|
+
## Current Tool Surface
|
|
86
18
|
|
|
87
|
-
| Tool |
|
|
88
|
-
|
|
|
89
|
-
| `agentlint_get_guidelines` |
|
|
90
|
-
| `agentlint_plan_workspace_autofix` |
|
|
91
|
-
| `agentlint_quick_check` |
|
|
92
|
-
| `agentlint_emit_maintenance_snippet` |
|
|
19
|
+
| Tool | Purpose |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `agentlint_get_guidelines` | Return artifact guidance before creating or updating context files |
|
|
22
|
+
| `agentlint_plan_workspace_autofix` | Scan a workspace and return a step-by-step fix plan |
|
|
23
|
+
| `agentlint_quick_check` | Decide whether recent code changes require context updates |
|
|
24
|
+
| `agentlint_emit_maintenance_snippet` | Return a reusable maintenance rule snippet for supported IDEs |
|
|
93
25
|
|
|
94
|
-
##
|
|
26
|
+
## Current Resource Surface
|
|
95
27
|
|
|
96
|
-
| Resource |
|
|
97
|
-
|
|
|
98
|
-
| `agentlint://guidelines/{type}` |
|
|
99
|
-
| `agentlint://template/{type}` | Skeleton template for
|
|
100
|
-
| `agentlint://path-hints/{type}` |
|
|
101
|
-
|
|
102
|
-
## Supported Artifact Types
|
|
103
|
-
|
|
104
|
-
| Type | File Patterns |
|
|
105
|
-
| ---- | ------------- |
|
|
106
|
-
| **Agents** | `AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md` |
|
|
107
|
-
| **Rules** | `.cursor/rules/*.md`, `.windsurf/rules/*.md` |
|
|
108
|
-
| **Skills** | `.cursor/skills/*/SKILL.md`, `.windsurf/skills/*/SKILL.md` |
|
|
109
|
-
| **Workflows** | `.cursor/workflows/*.md`, `.windsurf/workflows/*.md` |
|
|
110
|
-
| **Plans** | `docs/*.md`, `.windsurf/plans/*.md` |
|
|
111
|
-
|
|
112
|
-
## Quality Metrics (12)
|
|
113
|
-
|
|
114
|
-
`clarity` · `specificity` · `scope-control` · `completeness` · `actionability` · `verifiability` · `safety` · `injection-resistance` · `secret-hygiene` · `token-efficiency` · `platform-fit` · `maintainability`
|
|
28
|
+
| Resource | Purpose |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| `agentlint://guidelines/{type}` | Readable guidelines for one artifact type |
|
|
31
|
+
| `agentlint://template/{type}` | Skeleton template for a new artifact |
|
|
32
|
+
| `agentlint://path-hints/{type}` | IDE-specific file discovery hints |
|
|
115
33
|
|
|
116
34
|
## Programmatic Usage
|
|
117
35
|
|
|
118
|
-
```
|
|
36
|
+
```ts
|
|
119
37
|
import { createAgentLintMcpServer } from "@agent-lint/mcp";
|
|
120
38
|
|
|
121
39
|
const server = createAgentLintMcpServer({
|
|
@@ -129,17 +47,23 @@ const server = createAgentLintMcpServer({
|
|
|
129
47
|
npx @agent-lint/mcp --http --port 3001
|
|
130
48
|
```
|
|
131
49
|
|
|
132
|
-
|
|
50
|
+
Notes:
|
|
51
|
+
|
|
52
|
+
- HTTP mode keeps the public surface read-only.
|
|
53
|
+
- Workspace scanning is disabled in HTTP mode unless you explicitly enable it.
|
|
54
|
+
|
|
55
|
+
## Design Constraints
|
|
133
56
|
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
57
|
+
- No server-side LLM calls
|
|
58
|
+
- No database or cache
|
|
59
|
+
- No file writes from the MCP server
|
|
60
|
+
- Local stderr logging only
|
|
138
61
|
|
|
139
62
|
## Related
|
|
140
63
|
|
|
141
|
-
- [
|
|
142
|
-
- [
|
|
64
|
+
- [Root README](https://github.com/samilytu/agentlint)
|
|
65
|
+
- [CLI package](https://www.npmjs.com/package/@agent-lint/cli)
|
|
66
|
+
- [Authoritative publish source](https://gitlab.com/bsamilozturk/agentlint)
|
|
143
67
|
|
|
144
68
|
## License
|
|
145
69
|
|
package/dist/bin.js
CHANGED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CURRENT_TOOL_IDS: readonly ["agentlint_get_guidelines", "agentlint_plan_workspace_autofix", "agentlint_quick_check", "agentlint_emit_maintenance_snippet"];
|
|
2
|
+
export declare const CURRENT_RESOURCE_URIS: readonly ["agentlint://guidelines/{type}", "agentlint://template/{type}", "agentlint://path-hints/{type}"];
|
|
3
|
+
export declare const CURRENT_TOOL_TIMEOUTS: Record<(typeof CURRENT_TOOL_IDS)[number], number>;
|
|
4
|
+
export declare const LEGACY_TOOL_TIMEOUT_ALIASES: Record<string, number>;
|
|
5
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,0IAKnB,CAAC;AAEX,eAAO,MAAM,qBAAqB,4GAIxB,CAAC;AAEX,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAKnF,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAU9D,CAAC"}
|
|
@@ -18915,6 +18915,115 @@ function registerAgentLintResources(server) {
|
|
|
18915
18915
|
);
|
|
18916
18916
|
}
|
|
18917
18917
|
|
|
18918
|
+
// src/logger.ts
|
|
18919
|
+
function logMcp(level, event, fields = {}) {
|
|
18920
|
+
const payload = {
|
|
18921
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
18922
|
+
level,
|
|
18923
|
+
event,
|
|
18924
|
+
...fields
|
|
18925
|
+
};
|
|
18926
|
+
console.error(JSON.stringify(payload));
|
|
18927
|
+
}
|
|
18928
|
+
|
|
18929
|
+
// src/catalog.ts
|
|
18930
|
+
var CURRENT_TOOL_TIMEOUTS = {
|
|
18931
|
+
agentlint_get_guidelines: 3e4,
|
|
18932
|
+
agentlint_plan_workspace_autofix: 6e4,
|
|
18933
|
+
agentlint_quick_check: 3e4,
|
|
18934
|
+
agentlint_emit_maintenance_snippet: 1e4
|
|
18935
|
+
};
|
|
18936
|
+
var LEGACY_TOOL_TIMEOUT_ALIASES = {
|
|
18937
|
+
analyze_artifact: 3e4,
|
|
18938
|
+
analyze_workspace_artifacts: 6e4,
|
|
18939
|
+
analyze_context_bundle: 3e4,
|
|
18940
|
+
prepare_artifact_fix_context: 3e4,
|
|
18941
|
+
submit_client_assessment: 3e4,
|
|
18942
|
+
suggest_patch: 3e4,
|
|
18943
|
+
quality_gate_artifact: 3e4,
|
|
18944
|
+
apply_patches: 15e3,
|
|
18945
|
+
validate_export: 1e4
|
|
18946
|
+
};
|
|
18947
|
+
|
|
18948
|
+
// src/transport-security.ts
|
|
18949
|
+
var MAX_JSONRPC_MESSAGE_BYTES = 10 * 1024 * 1024;
|
|
18950
|
+
var TOOL_TIMEOUTS = {
|
|
18951
|
+
...CURRENT_TOOL_TIMEOUTS,
|
|
18952
|
+
...LEGACY_TOOL_TIMEOUT_ALIASES
|
|
18953
|
+
};
|
|
18954
|
+
var DEFAULT_TOOL_TIMEOUT_MS = 3e4;
|
|
18955
|
+
function applyMessageSizeGuard(transport, maxBytes = MAX_JSONRPC_MESSAGE_BYTES) {
|
|
18956
|
+
const originalStart = transport.start.bind(transport);
|
|
18957
|
+
transport.start = async function() {
|
|
18958
|
+
await originalStart();
|
|
18959
|
+
const downstream = transport.onmessage;
|
|
18960
|
+
if (!downstream) {
|
|
18961
|
+
return;
|
|
18962
|
+
}
|
|
18963
|
+
transport.onmessage = (message, extra) => {
|
|
18964
|
+
const serialized = JSON.stringify(message);
|
|
18965
|
+
const byteLength = Buffer.byteLength(serialized, "utf8");
|
|
18966
|
+
if (byteLength > maxBytes) {
|
|
18967
|
+
logMcp("warn", "transport.message_too_large", {
|
|
18968
|
+
byteLength,
|
|
18969
|
+
maxBytes,
|
|
18970
|
+
preview: serialized.slice(0, 200)
|
|
18971
|
+
});
|
|
18972
|
+
if (transport.onerror) {
|
|
18973
|
+
transport.onerror(
|
|
18974
|
+
new Error(`JSON-RPC message too large: ${byteLength} bytes (limit: ${maxBytes} bytes)`)
|
|
18975
|
+
);
|
|
18976
|
+
}
|
|
18977
|
+
return;
|
|
18978
|
+
}
|
|
18979
|
+
downstream(message, extra);
|
|
18980
|
+
};
|
|
18981
|
+
};
|
|
18982
|
+
return transport;
|
|
18983
|
+
}
|
|
18984
|
+
var ToolTimeoutError = class extends Error {
|
|
18985
|
+
toolName;
|
|
18986
|
+
timeoutMs;
|
|
18987
|
+
constructor(toolName, timeoutMs) {
|
|
18988
|
+
super(`Tool "${toolName}" timed out after ${timeoutMs}ms`);
|
|
18989
|
+
this.name = "ToolTimeoutError";
|
|
18990
|
+
this.toolName = toolName;
|
|
18991
|
+
this.timeoutMs = timeoutMs;
|
|
18992
|
+
}
|
|
18993
|
+
};
|
|
18994
|
+
function getToolTimeout(toolName) {
|
|
18995
|
+
return TOOL_TIMEOUTS[toolName] ?? DEFAULT_TOOL_TIMEOUT_MS;
|
|
18996
|
+
}
|
|
18997
|
+
async function withToolTimeout(toolName, fn, timeoutMs) {
|
|
18998
|
+
const ms = timeoutMs ?? getToolTimeout(toolName);
|
|
18999
|
+
return new Promise((resolve, reject) => {
|
|
19000
|
+
let settled = false;
|
|
19001
|
+
const timer = setTimeout(() => {
|
|
19002
|
+
if (!settled) {
|
|
19003
|
+
settled = true;
|
|
19004
|
+
logMcp("warn", "tool.timeout", { toolName, timeoutMs: ms });
|
|
19005
|
+
reject(new ToolTimeoutError(toolName, ms));
|
|
19006
|
+
}
|
|
19007
|
+
}, ms);
|
|
19008
|
+
fn().then(
|
|
19009
|
+
(result) => {
|
|
19010
|
+
if (!settled) {
|
|
19011
|
+
settled = true;
|
|
19012
|
+
clearTimeout(timer);
|
|
19013
|
+
resolve(result);
|
|
19014
|
+
}
|
|
19015
|
+
},
|
|
19016
|
+
(error48) => {
|
|
19017
|
+
if (!settled) {
|
|
19018
|
+
settled = true;
|
|
19019
|
+
clearTimeout(timer);
|
|
19020
|
+
reject(error48);
|
|
19021
|
+
}
|
|
19022
|
+
}
|
|
19023
|
+
);
|
|
19024
|
+
});
|
|
19025
|
+
}
|
|
19026
|
+
|
|
18918
19027
|
// src/tools/schema-compat.ts
|
|
18919
19028
|
function asInputSchema(schema) {
|
|
18920
19029
|
return schema;
|
|
@@ -18948,8 +19057,9 @@ function toErrorResult(message) {
|
|
|
18948
19057
|
|
|
18949
19058
|
// src/tools/get-guidelines.ts
|
|
18950
19059
|
function registerGetGuidelinesTool(server) {
|
|
19060
|
+
const toolName = "agentlint_get_guidelines";
|
|
18951
19061
|
server.registerTool(
|
|
18952
|
-
|
|
19062
|
+
toolName,
|
|
18953
19063
|
{
|
|
18954
19064
|
title: "Get Guidelines",
|
|
18955
19065
|
description: "Returns comprehensive Markdown guidelines for creating or updating a context artifact (AGENTS.md, skills, rules, workflows, plans). Includes mandatory sections, do/don't lists, anti-patterns, quality checklist, template skeleton, and client-specific hints. Call this tool before creating or editing any AI agent context artifact file.",
|
|
@@ -18962,11 +19072,11 @@ function registerGetGuidelinesTool(server) {
|
|
|
18962
19072
|
},
|
|
18963
19073
|
asToolHandler(async (args) => {
|
|
18964
19074
|
try {
|
|
18965
|
-
const markdown = buildGuidelines(args.type, args.client ?? "generic");
|
|
19075
|
+
const markdown = await withToolTimeout(toolName, async () => buildGuidelines(args.type, args.client ?? "generic"));
|
|
18966
19076
|
return toMarkdownResult(markdown);
|
|
18967
19077
|
} catch (error48) {
|
|
18968
19078
|
const message = error48 instanceof Error ? error48.message : "Unknown error";
|
|
18969
|
-
return toErrorResult(
|
|
19079
|
+
return toErrorResult(`${toolName} failed: ${message}`);
|
|
18970
19080
|
}
|
|
18971
19081
|
})
|
|
18972
19082
|
);
|
|
@@ -18974,11 +19084,12 @@ function registerGetGuidelinesTool(server) {
|
|
|
18974
19084
|
|
|
18975
19085
|
// src/tools/plan-workspace-autofix.ts
|
|
18976
19086
|
function registerPlanWorkspaceAutofixTool(server, options2) {
|
|
19087
|
+
const toolName = "agentlint_plan_workspace_autofix";
|
|
18977
19088
|
if (!options2.enabled) {
|
|
18978
19089
|
return;
|
|
18979
19090
|
}
|
|
18980
19091
|
server.registerTool(
|
|
18981
|
-
|
|
19092
|
+
toolName,
|
|
18982
19093
|
{
|
|
18983
19094
|
title: "Plan Workspace Autofix",
|
|
18984
19095
|
description: "Scans the workspace for all AI agent context artifact files (AGENTS.md, CLAUDE.md, skills, rules, workflows, plans), identifies missing files and incomplete sections, and returns a step-by-step Markdown action plan. The LLM should execute the plan using its file reading and editing capabilities. Call this when the user asks to review, fix, or improve all context artifacts in a project.",
|
|
@@ -18992,11 +19103,11 @@ function registerPlanWorkspaceAutofixTool(server, options2) {
|
|
|
18992
19103
|
asToolHandler(async (args) => {
|
|
18993
19104
|
try {
|
|
18994
19105
|
const rootPath = args.rootPath ?? process.cwd();
|
|
18995
|
-
const plan = buildWorkspaceAutofixPlan(rootPath);
|
|
19106
|
+
const plan = await withToolTimeout(toolName, async () => buildWorkspaceAutofixPlan(rootPath));
|
|
18996
19107
|
return toMarkdownResult(plan.markdown);
|
|
18997
19108
|
} catch (error48) {
|
|
18998
19109
|
const message = error48 instanceof Error ? error48.message : "Unknown error";
|
|
18999
|
-
return toErrorResult(
|
|
19110
|
+
return toErrorResult(`${toolName} failed: ${message}`);
|
|
19000
19111
|
}
|
|
19001
19112
|
})
|
|
19002
19113
|
);
|
|
@@ -19004,8 +19115,9 @@ function registerPlanWorkspaceAutofixTool(server, options2) {
|
|
|
19004
19115
|
|
|
19005
19116
|
// src/tools/quick-check.ts
|
|
19006
19117
|
function registerQuickCheckTool(server) {
|
|
19118
|
+
const toolName = "agentlint_quick_check";
|
|
19007
19119
|
server.registerTool(
|
|
19008
|
-
|
|
19120
|
+
toolName,
|
|
19009
19121
|
{
|
|
19010
19122
|
title: "Quick Check",
|
|
19011
19123
|
description: "Checks whether recent code changes require updates to AI agent context artifacts. Provide changed file paths and/or a description of what changed. Returns signals indicating which artifacts (AGENTS.md, rules, workflows, etc.) may need updating and what action to take. Call this after structural changes like adding modules, changing configs, or modifying dependencies.",
|
|
@@ -19018,11 +19130,11 @@ function registerQuickCheckTool(server) {
|
|
|
19018
19130
|
},
|
|
19019
19131
|
asToolHandler(async (args) => {
|
|
19020
19132
|
try {
|
|
19021
|
-
const result = runQuickCheck(args.changedPaths, args.changeDescription);
|
|
19133
|
+
const result = await withToolTimeout(toolName, async () => runQuickCheck(args.changedPaths, args.changeDescription));
|
|
19022
19134
|
return toMarkdownResult(result.markdown);
|
|
19023
19135
|
} catch (error48) {
|
|
19024
19136
|
const message = error48 instanceof Error ? error48.message : "Unknown error";
|
|
19025
|
-
return toErrorResult(
|
|
19137
|
+
return toErrorResult(`${toolName} failed: ${message}`);
|
|
19026
19138
|
}
|
|
19027
19139
|
})
|
|
19028
19140
|
);
|
|
@@ -19030,8 +19142,9 @@ function registerQuickCheckTool(server) {
|
|
|
19030
19142
|
|
|
19031
19143
|
// src/tools/emit-maintenance-snippet.ts
|
|
19032
19144
|
function registerEmitMaintenanceSnippetTool(server) {
|
|
19145
|
+
const toolName = "agentlint_emit_maintenance_snippet";
|
|
19033
19146
|
server.registerTool(
|
|
19034
|
-
|
|
19147
|
+
toolName,
|
|
19035
19148
|
{
|
|
19036
19149
|
title: "Emit Maintenance Snippet",
|
|
19037
19150
|
description: "Returns a persistent rule snippet that you should add to the user's IDE rules file. Once added, these rules ensure the LLM agent automatically maintains context artifacts (AGENTS.md, skills, rules, workflows, plans) whenever structural changes happen. Supports Cursor, Windsurf, VS Code, Claude Code, and generic formats. Call this when the user asks to set up automatic context maintenance.",
|
|
@@ -19044,11 +19157,11 @@ function registerEmitMaintenanceSnippetTool(server) {
|
|
|
19044
19157
|
},
|
|
19045
19158
|
asToolHandler(async (args) => {
|
|
19046
19159
|
try {
|
|
19047
|
-
const result = buildMaintenanceSnippet(args.client ?? "generic");
|
|
19160
|
+
const result = await withToolTimeout(toolName, async () => buildMaintenanceSnippet(args.client ?? "generic"));
|
|
19048
19161
|
return toMarkdownResult(result.markdown);
|
|
19049
19162
|
} catch (error48) {
|
|
19050
19163
|
const message = error48 instanceof Error ? error48.message : "Unknown error";
|
|
19051
|
-
return toErrorResult(
|
|
19164
|
+
return toErrorResult(`${toolName} failed: ${message}`);
|
|
19052
19165
|
}
|
|
19053
19166
|
})
|
|
19054
19167
|
);
|
|
@@ -19063,6 +19176,7 @@ function registerAgentLintTools(server, options2) {
|
|
|
19063
19176
|
}
|
|
19064
19177
|
|
|
19065
19178
|
// src/server.ts
|
|
19179
|
+
import { readFileSync } from "fs";
|
|
19066
19180
|
import { McpServer as McpServer2 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
19067
19181
|
var DEFAULT_MCP_SERVER_NAME = "agentlint";
|
|
19068
19182
|
var DEFAULT_MCP_INSTRUCTIONS = [
|
|
@@ -19075,7 +19189,22 @@ var DEFAULT_MCP_INSTRUCTIONS = [
|
|
|
19075
19189
|
"Apply recommended changes directly using your file editing capabilities."
|
|
19076
19190
|
].join(" ");
|
|
19077
19191
|
function resolveServerVersion() {
|
|
19078
|
-
|
|
19192
|
+
if (process.env.npm_package_name === "@agent-lint/mcp" && process.env.npm_package_version) {
|
|
19193
|
+
return process.env.npm_package_version;
|
|
19194
|
+
}
|
|
19195
|
+
if ("0.3.3".length > 0) {
|
|
19196
|
+
return "0.3.3";
|
|
19197
|
+
}
|
|
19198
|
+
try {
|
|
19199
|
+
const pkg = JSON.parse(
|
|
19200
|
+
readFileSync(new URL("../package.json", import.meta.url), "utf-8")
|
|
19201
|
+
);
|
|
19202
|
+
if (typeof pkg.version === "string" && pkg.version.length > 0) {
|
|
19203
|
+
return pkg.version;
|
|
19204
|
+
}
|
|
19205
|
+
} catch {
|
|
19206
|
+
}
|
|
19207
|
+
return "0.0.0-dev";
|
|
19079
19208
|
}
|
|
19080
19209
|
function resolveWorkspaceScanEnabled(options2) {
|
|
19081
19210
|
if (typeof options2.enableWorkspaceScan === "boolean") {
|
|
@@ -19087,7 +19216,7 @@ function resolveWorkspaceScanEnabled(options2) {
|
|
|
19087
19216
|
if (options2.transportMode === "http") {
|
|
19088
19217
|
return process.env.MCP_ENABLE_WORKSPACE_SCAN === "true";
|
|
19089
19218
|
}
|
|
19090
|
-
return process.env.MCP_ENABLE_WORKSPACE_SCAN
|
|
19219
|
+
return process.env.MCP_ENABLE_WORKSPACE_SCAN !== "false";
|
|
19091
19220
|
}
|
|
19092
19221
|
function resolveInstructions(options2, workspaceScanEnabled) {
|
|
19093
19222
|
if (options2.instructions) {
|
|
@@ -19125,103 +19254,6 @@ function createAgentLintMcpServer(options2 = {}) {
|
|
|
19125
19254
|
return server;
|
|
19126
19255
|
}
|
|
19127
19256
|
|
|
19128
|
-
// src/logger.ts
|
|
19129
|
-
function logMcp(level, event, fields = {}) {
|
|
19130
|
-
const payload = {
|
|
19131
|
-
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19132
|
-
level,
|
|
19133
|
-
event,
|
|
19134
|
-
...fields
|
|
19135
|
-
};
|
|
19136
|
-
console.error(JSON.stringify(payload));
|
|
19137
|
-
}
|
|
19138
|
-
|
|
19139
|
-
// src/transport-security.ts
|
|
19140
|
-
var MAX_JSONRPC_MESSAGE_BYTES = 10 * 1024 * 1024;
|
|
19141
|
-
var TOOL_TIMEOUTS = {
|
|
19142
|
-
analyze_artifact: 3e4,
|
|
19143
|
-
analyze_workspace_artifacts: 6e4,
|
|
19144
|
-
analyze_context_bundle: 3e4,
|
|
19145
|
-
prepare_artifact_fix_context: 3e4,
|
|
19146
|
-
submit_client_assessment: 3e4,
|
|
19147
|
-
suggest_patch: 3e4,
|
|
19148
|
-
quality_gate_artifact: 3e4,
|
|
19149
|
-
apply_patches: 15e3,
|
|
19150
|
-
validate_export: 1e4
|
|
19151
|
-
};
|
|
19152
|
-
var DEFAULT_TOOL_TIMEOUT_MS = 3e4;
|
|
19153
|
-
function applyMessageSizeGuard(transport, maxBytes = MAX_JSONRPC_MESSAGE_BYTES) {
|
|
19154
|
-
const originalStart = transport.start.bind(transport);
|
|
19155
|
-
transport.start = async function() {
|
|
19156
|
-
await originalStart();
|
|
19157
|
-
const downstream = transport.onmessage;
|
|
19158
|
-
if (!downstream) {
|
|
19159
|
-
return;
|
|
19160
|
-
}
|
|
19161
|
-
transport.onmessage = (message, extra) => {
|
|
19162
|
-
const serialized = JSON.stringify(message);
|
|
19163
|
-
const byteLength = Buffer.byteLength(serialized, "utf8");
|
|
19164
|
-
if (byteLength > maxBytes) {
|
|
19165
|
-
logMcp("warn", "transport.message_too_large", {
|
|
19166
|
-
byteLength,
|
|
19167
|
-
maxBytes,
|
|
19168
|
-
preview: serialized.slice(0, 200)
|
|
19169
|
-
});
|
|
19170
|
-
if (transport.onerror) {
|
|
19171
|
-
transport.onerror(
|
|
19172
|
-
new Error(`JSON-RPC message too large: ${byteLength} bytes (limit: ${maxBytes} bytes)`)
|
|
19173
|
-
);
|
|
19174
|
-
}
|
|
19175
|
-
return;
|
|
19176
|
-
}
|
|
19177
|
-
downstream(message, extra);
|
|
19178
|
-
};
|
|
19179
|
-
};
|
|
19180
|
-
return transport;
|
|
19181
|
-
}
|
|
19182
|
-
var ToolTimeoutError = class extends Error {
|
|
19183
|
-
toolName;
|
|
19184
|
-
timeoutMs;
|
|
19185
|
-
constructor(toolName, timeoutMs) {
|
|
19186
|
-
super(`Tool "${toolName}" timed out after ${timeoutMs}ms`);
|
|
19187
|
-
this.name = "ToolTimeoutError";
|
|
19188
|
-
this.toolName = toolName;
|
|
19189
|
-
this.timeoutMs = timeoutMs;
|
|
19190
|
-
}
|
|
19191
|
-
};
|
|
19192
|
-
function getToolTimeout(toolName) {
|
|
19193
|
-
return TOOL_TIMEOUTS[toolName] ?? DEFAULT_TOOL_TIMEOUT_MS;
|
|
19194
|
-
}
|
|
19195
|
-
async function withToolTimeout(toolName, fn, timeoutMs) {
|
|
19196
|
-
const ms = timeoutMs ?? getToolTimeout(toolName);
|
|
19197
|
-
return new Promise((resolve, reject) => {
|
|
19198
|
-
let settled = false;
|
|
19199
|
-
const timer = setTimeout(() => {
|
|
19200
|
-
if (!settled) {
|
|
19201
|
-
settled = true;
|
|
19202
|
-
logMcp("warn", "tool.timeout", { toolName, timeoutMs: ms });
|
|
19203
|
-
reject(new ToolTimeoutError(toolName, ms));
|
|
19204
|
-
}
|
|
19205
|
-
}, ms);
|
|
19206
|
-
fn().then(
|
|
19207
|
-
(result) => {
|
|
19208
|
-
if (!settled) {
|
|
19209
|
-
settled = true;
|
|
19210
|
-
clearTimeout(timer);
|
|
19211
|
-
resolve(result);
|
|
19212
|
-
}
|
|
19213
|
-
},
|
|
19214
|
-
(error48) => {
|
|
19215
|
-
if (!settled) {
|
|
19216
|
-
settled = true;
|
|
19217
|
-
clearTimeout(timer);
|
|
19218
|
-
reject(error48);
|
|
19219
|
-
}
|
|
19220
|
-
}
|
|
19221
|
-
);
|
|
19222
|
-
});
|
|
19223
|
-
}
|
|
19224
|
-
|
|
19225
19257
|
// src/stdio.ts
|
|
19226
19258
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
19227
19259
|
async function runStdioServer() {
|
|
@@ -19601,9 +19633,6 @@ async function runHttpServer(options2 = {}) {
|
|
|
19601
19633
|
export {
|
|
19602
19634
|
registerAgentLintPrompts,
|
|
19603
19635
|
registerAgentLintResources,
|
|
19604
|
-
registerAgentLintTools,
|
|
19605
|
-
DEFAULT_MCP_SERVER_NAME,
|
|
19606
|
-
createAgentLintMcpServer,
|
|
19607
19636
|
logMcp,
|
|
19608
19637
|
MAX_JSONRPC_MESSAGE_BYTES,
|
|
19609
19638
|
TOOL_TIMEOUTS,
|
|
@@ -19612,6 +19641,9 @@ export {
|
|
|
19612
19641
|
ToolTimeoutError,
|
|
19613
19642
|
getToolTimeout,
|
|
19614
19643
|
withToolTimeout,
|
|
19644
|
+
registerAgentLintTools,
|
|
19645
|
+
DEFAULT_MCP_SERVER_NAME,
|
|
19646
|
+
createAgentLintMcpServer,
|
|
19615
19647
|
runStdioServer,
|
|
19616
19648
|
startRateLimitCleanup,
|
|
19617
19649
|
stopRateLimitCleanup,
|
|
@@ -19641,4 +19673,4 @@ strip-bom-string/index.js:
|
|
|
19641
19673
|
* Released under the MIT License.
|
|
19642
19674
|
*)
|
|
19643
19675
|
*/
|
|
19644
|
-
//# sourceMappingURL=chunk-
|
|
19676
|
+
//# sourceMappingURL=chunk-DYP46E6V.js.map
|