@inspectr/mcplab-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.
- package/README.md +86 -0
- package/dist/http-handler.d.ts +3 -0
- package/dist/http-handler.d.ts.map +1 -0
- package/dist/http-handler.js +2 -0
- package/dist/http-handler.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +2 -0
- package/dist/prompts.js.map +1 -0
- package/dist/runtime.d.ts +35 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +1948 -0
- package/dist/runtime.js.map +1 -0
- package/dist/server-factory.d.ts +2 -0
- package/dist/server-factory.d.ts.map +1 -0
- package/dist/server-factory.js +2 -0
- package/dist/server-factory.js.map +1 -0
- package/dist/tools.d.ts +2 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +2 -0
- package/dist/tools.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# MCPLab MCP Server
|
|
2
|
+
|
|
3
|
+
MCP server that exposes MCPLab authoring and execution helpers for other LLM clients.
|
|
4
|
+
|
|
5
|
+
## Focus
|
|
6
|
+
|
|
7
|
+
- Generate MCPLab YAML entries for `servers`, `agents`, and especially `scenarios`
|
|
8
|
+
- Validate configs via `@inspectr/mcplab-core` (`loadConfig`, `selectScenarios`)
|
|
9
|
+
- Run evaluations and inspect run artifacts
|
|
10
|
+
- Provide scenario-authoring prompts for MCP-capable clients
|
|
11
|
+
|
|
12
|
+
## Run (Streamable HTTP)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm run build -w @inspectr/mcplab-mcp-server
|
|
16
|
+
node packages/mcp-server/dist/index.js
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Defaults:
|
|
20
|
+
|
|
21
|
+
- Host: `127.0.0.1`
|
|
22
|
+
- Port: `3011`
|
|
23
|
+
- MCP endpoint: `/mcp`
|
|
24
|
+
|
|
25
|
+
Override with `MCP_HOST`, `MCP_PORT`, and `MCP_PATH`.
|
|
26
|
+
|
|
27
|
+
## Minimal Manual-Test MCP Servers (Dev Only)
|
|
28
|
+
|
|
29
|
+
These tiny servers are useful for manual testing in MCP Lab (connectivity, auth, OAuth Debugger).
|
|
30
|
+
They live outside the published package code in:
|
|
31
|
+
|
|
32
|
+
- `/Users/tim.haselaars/Sites/mcp-evaluation/dev/mcp-test-servers`
|
|
33
|
+
|
|
34
|
+
### 1) Public (no auth)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm run mcp:test:public
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Defaults:
|
|
41
|
+
- Base URL: `http://127.0.0.1:3111`
|
|
42
|
+
- MCP endpoint: `/mcp`
|
|
43
|
+
|
|
44
|
+
### 2) Bearer-protected
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
MCP_TEST_BEARER_TOKEN=demo-bearer-token npm run mcp:test:bearer
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Defaults:
|
|
51
|
+
- Base URL: `http://127.0.0.1:3112`
|
|
52
|
+
- MCP endpoint: `/mcp`
|
|
53
|
+
- Protected probe endpoint: `/probe`
|
|
54
|
+
|
|
55
|
+
### 3) OAuth mock (for OAuth Debugger)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run mcp:test:oauth-mock
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Defaults:
|
|
62
|
+
- Base URL: `http://127.0.0.1:3113`
|
|
63
|
+
- MCP endpoint: `/mcp` (bearer-protected after token exchange)
|
|
64
|
+
- OAuth endpoints:
|
|
65
|
+
- `/.well-known/oauth-protected-resource`
|
|
66
|
+
- `/.well-known/oauth-authorization-server`
|
|
67
|
+
- `/authorize`
|
|
68
|
+
- `/token`
|
|
69
|
+
- `/register` (DCR)
|
|
70
|
+
- `/client-metadata.json` (CIMD)
|
|
71
|
+
- `/probe` (protected resource probe)
|
|
72
|
+
|
|
73
|
+
Default pre-registered client:
|
|
74
|
+
- `client_id`: `mcplab-debugger`
|
|
75
|
+
- `client_secret`: `mcplab-debugger-secret`
|
|
76
|
+
- `redirect_url`: `http://localhost:6274/oauth/`
|
|
77
|
+
- `scope`: `openid profile mcp`
|
|
78
|
+
|
|
79
|
+
## Useful Tools
|
|
80
|
+
|
|
81
|
+
- `mcplab_generate_scenario_entry`
|
|
82
|
+
- `mcplab_validate_config`
|
|
83
|
+
- `mcplab_list_library`
|
|
84
|
+
- `mcplab_get_library_item`
|
|
85
|
+
- `mcplab_run_eval`
|
|
86
|
+
- `mcplab_read_run_artifact`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-handler.d.ts","sourceRoot":"","sources":["../src/http-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-handler.js","sourceRoot":"","sources":["../src/http-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { defaultMcplabMcpServerOptionsFromEnv, startMcplabMcpServer } from './runtime.js';
|
|
3
|
+
async function main() {
|
|
4
|
+
const runtime = await startMcplabMcpServer(defaultMcplabMcpServerOptionsFromEnv());
|
|
5
|
+
const shutdown = async () => {
|
|
6
|
+
await runtime.close();
|
|
7
|
+
process.exit(0);
|
|
8
|
+
};
|
|
9
|
+
process.on('SIGINT', () => {
|
|
10
|
+
void shutdown();
|
|
11
|
+
});
|
|
12
|
+
process.on('SIGTERM', () => {
|
|
13
|
+
void shutdown();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
main().catch((error) => {
|
|
17
|
+
console.error('[mcplab-mcp-server] fatal error:', error);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oCAAoC,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE1F,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,oCAAoC,EAAE,CAAC,CAAC;IAEnF,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;QAC1B,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACxB,KAAK,QAAQ,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;QACzB,KAAK,QAAQ,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type IncomingMessage, type ServerResponse } from 'node:http';
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
4
|
+
export type SessionRuntime = {
|
|
5
|
+
transport: StreamableHTTPServerTransport;
|
|
6
|
+
server: McpServer;
|
|
7
|
+
};
|
|
8
|
+
export interface McplabMcpServerOptions {
|
|
9
|
+
host: string;
|
|
10
|
+
port: number;
|
|
11
|
+
path: string;
|
|
12
|
+
logger?: Pick<Console, 'log' | 'error'>;
|
|
13
|
+
}
|
|
14
|
+
export interface McplabMcpServerRuntime {
|
|
15
|
+
host: string;
|
|
16
|
+
port: number;
|
|
17
|
+
path: string;
|
|
18
|
+
close(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare function startMcplabMcpServer(
|
|
21
|
+
options: McplabMcpServerOptions
|
|
22
|
+
): Promise<McplabMcpServerRuntime>;
|
|
23
|
+
export declare function defaultMcplabMcpServerOptionsFromEnv(): McplabMcpServerOptions;
|
|
24
|
+
export declare function createConfiguredServer(): McpServer;
|
|
25
|
+
export declare function registerTools(server: McpServer): void;
|
|
26
|
+
export declare function registerPrompts(server: McpServer): void;
|
|
27
|
+
export declare function handleMcplabMcpHttpRequest(
|
|
28
|
+
req: IncomingMessage,
|
|
29
|
+
res: ServerResponse,
|
|
30
|
+
sessions: Map<string, SessionRuntime>,
|
|
31
|
+
options?: {
|
|
32
|
+
path?: string;
|
|
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