openharness-mcp 0.0.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.
- package/package.json +27 -0
- package/src/index.ts +18 -0
- package/src/server.ts +30 -0
- package/tsconfig.json +8 -0
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "openharness-mcp",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "OTel MCP server — exposes query_metrics, query_logs, query_traces to agents.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"openharness-mcp": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"clean": "rm -rf dist"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"openharness-core": "workspace:*"
|
|
25
|
+
},
|
|
26
|
+
"license": "MIT"
|
|
27
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @openharness/mcp
|
|
3
|
+
*
|
|
4
|
+
* An MCP server that wraps the local OTel stack and exposes three tools to agents:
|
|
5
|
+
*
|
|
6
|
+
* query_metrics(promql: string) → VictoriaMetrics instant query
|
|
7
|
+
* query_logs(logql: string) → VictoriaLogs query
|
|
8
|
+
* query_traces(traceql: string) → Tempo TraceQL search
|
|
9
|
+
*
|
|
10
|
+
* Agents can verify their own work without knowing local ports or query syntax specifics.
|
|
11
|
+
* Ports are read from .open-harness.json with fallback to DEFAULT_PORTS.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* openharness mcp start (via CLI)
|
|
15
|
+
* npx @openharness/mcp (standalone)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export { startMcpServer } from './server.js';
|
package/src/server.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DEFAULT_PORTS, type HarnessConfig } from 'openharness-core';
|
|
2
|
+
|
|
3
|
+
export interface McpServerOptions {
|
|
4
|
+
config?: HarnessConfig;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Starts the MCP server. Reads port config from .open-harness.json if available,
|
|
9
|
+
* falling back to DEFAULT_PORTS.
|
|
10
|
+
*
|
|
11
|
+
* Exposes three MCP tools:
|
|
12
|
+
* - query_metrics → PromQL against VictoriaMetrics
|
|
13
|
+
* - query_logs → LogQL against VictoriaLogs
|
|
14
|
+
* - query_traces → TraceQL against Tempo
|
|
15
|
+
*/
|
|
16
|
+
export async function startMcpServer(options: McpServerOptions = {}): Promise<void> {
|
|
17
|
+
const ports = {
|
|
18
|
+
...DEFAULT_PORTS,
|
|
19
|
+
...options.config?.ports,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// TODO: implement MCP server using @modelcontextprotocol/sdk
|
|
23
|
+
// Tools: query_metrics, query_logs, query_traces
|
|
24
|
+
// Each tool proxies to the corresponding local OTel backend.
|
|
25
|
+
|
|
26
|
+
console.log('openharness mcp server starting');
|
|
27
|
+
console.log(` VictoriaMetrics → http://localhost:${ports.victoriametrics}`);
|
|
28
|
+
console.log(` VictoriaLogs → http://localhost:${ports.victorialogs}`);
|
|
29
|
+
console.log(` Tempo → http://localhost:${ports.tempo}`);
|
|
30
|
+
}
|