@phosra/mcp 0.2.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/dist/api-client.d.ts +24 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +54 -0
- package/dist/api-client.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +22 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +99 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +31 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +858 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +40 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP execution layer for Phosra MCP tools.
|
|
3
|
+
*
|
|
4
|
+
* Each tool call is resolved to an HTTP request against the Phosra REST API,
|
|
5
|
+
* executed via fetch(), and the response returned as a plain JSON object.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolDefinition, PhosraConfig } from "./types.js";
|
|
8
|
+
/** The result returned from every tool execution. */
|
|
9
|
+
export interface ToolCallResult {
|
|
10
|
+
/** True when the HTTP call returned a 2xx status. */
|
|
11
|
+
ok: boolean;
|
|
12
|
+
/** HTTP status code (0 if the request failed entirely). */
|
|
13
|
+
status: number;
|
|
14
|
+
/** Parsed response body (JSON object, or error object). */
|
|
15
|
+
data: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Execute a single tool call against the Phosra API.
|
|
19
|
+
*
|
|
20
|
+
* Never throws -- returns an error-shaped result on failure so the LLM
|
|
21
|
+
* always receives structured feedback.
|
|
22
|
+
*/
|
|
23
|
+
export declare function executeToolCall(toolDef: ToolDefinition, input: Record<string, unknown>, config: PhosraConfig): Promise<ToolCallResult>;
|
|
24
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,EAAE,EAAE,OAAO,CAAC;IACZ,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,cAAc,CAAC,CA2CzB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP execution layer for Phosra MCP tools.
|
|
3
|
+
*
|
|
4
|
+
* Each tool call is resolved to an HTTP request against the Phosra REST API,
|
|
5
|
+
* executed via fetch(), and the response returned as a plain JSON object.
|
|
6
|
+
*/
|
|
7
|
+
import { resolveToolPath } from "./tools.js";
|
|
8
|
+
/**
|
|
9
|
+
* Execute a single tool call against the Phosra API.
|
|
10
|
+
*
|
|
11
|
+
* Never throws -- returns an error-shaped result on failure so the LLM
|
|
12
|
+
* always receives structured feedback.
|
|
13
|
+
*/
|
|
14
|
+
export async function executeToolCall(toolDef, input, config) {
|
|
15
|
+
const { path, query, body } = resolveToolPath(toolDef, input);
|
|
16
|
+
let url = `${config.baseUrl}${path}`;
|
|
17
|
+
const queryStr = new URLSearchParams(query).toString();
|
|
18
|
+
if (queryStr)
|
|
19
|
+
url += `?${queryStr}`;
|
|
20
|
+
const headers = {
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
23
|
+
};
|
|
24
|
+
const fetchOpts = {
|
|
25
|
+
method: toolDef.http.method,
|
|
26
|
+
headers,
|
|
27
|
+
};
|
|
28
|
+
if (body) {
|
|
29
|
+
fetchOpts.body = JSON.stringify(body);
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const res = await fetch(url, fetchOpts);
|
|
33
|
+
const text = await res.text();
|
|
34
|
+
let data;
|
|
35
|
+
try {
|
|
36
|
+
data = JSON.parse(text);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
data = text;
|
|
40
|
+
}
|
|
41
|
+
return { ok: res.ok, status: res.status, data };
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return {
|
|
45
|
+
ok: false,
|
|
46
|
+
status: 0,
|
|
47
|
+
data: {
|
|
48
|
+
error: "request_failed",
|
|
49
|
+
message: err instanceof Error ? err.message : String(err),
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAY7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAuB,EACvB,KAA8B,EAC9B,MAAoB;IAEpB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAE9D,IAAI,GAAG,GAAG,GAAG,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;IACvD,IAAI,QAAQ;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*
|
|
5
|
+
* Starts a stdio-based MCP server that exposes all 42 Phosra child-safety
|
|
6
|
+
* tools to any MCP-compatible client (Claude Desktop, Cursor, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* phosra-mcp --api-key=YOUR_KEY
|
|
10
|
+
* phosra-mcp --api-key=YOUR_KEY --api-url=https://custom.endpoint/api/v1
|
|
11
|
+
*
|
|
12
|
+
* Environment variables (used as fallbacks):
|
|
13
|
+
* PHOSRA_API_KEY - Phosra API key
|
|
14
|
+
* PHOSRA_API_URL - Phosra API base URL
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;GAaG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Phosra MCP server CLI entry point.
|
|
4
|
+
*
|
|
5
|
+
* Starts a stdio-based MCP server that exposes all 42 Phosra child-safety
|
|
6
|
+
* tools to any MCP-compatible client (Claude Desktop, Cursor, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* phosra-mcp --api-key=YOUR_KEY
|
|
10
|
+
* phosra-mcp --api-key=YOUR_KEY --api-url=https://custom.endpoint/api/v1
|
|
11
|
+
*
|
|
12
|
+
* Environment variables (used as fallbacks):
|
|
13
|
+
* PHOSRA_API_KEY - Phosra API key
|
|
14
|
+
* PHOSRA_API_URL - Phosra API base URL
|
|
15
|
+
*/
|
|
16
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
17
|
+
import { buildServer } from "./server.js";
|
|
18
|
+
const DEFAULT_API_URL = "https://phosra-api.fly.dev/api/v1";
|
|
19
|
+
// -- Parse CLI args --------------------------------------------------
|
|
20
|
+
function parseArgs() {
|
|
21
|
+
let apiKey;
|
|
22
|
+
let apiUrl;
|
|
23
|
+
for (const arg of process.argv.slice(2)) {
|
|
24
|
+
if (arg.startsWith("--api-key=")) {
|
|
25
|
+
apiKey = arg.slice("--api-key=".length);
|
|
26
|
+
}
|
|
27
|
+
else if (arg.startsWith("--api-url=")) {
|
|
28
|
+
apiUrl = arg.slice("--api-url=".length);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// Fall back to environment variables
|
|
32
|
+
apiKey = apiKey || process.env.PHOSRA_API_KEY;
|
|
33
|
+
apiUrl = apiUrl || process.env.PHOSRA_API_URL || DEFAULT_API_URL;
|
|
34
|
+
if (!apiKey) {
|
|
35
|
+
console.error("Error: Phosra API key is required.\n\n" +
|
|
36
|
+
"Provide it via:\n" +
|
|
37
|
+
" --api-key=YOUR_KEY (CLI argument)\n" +
|
|
38
|
+
" PHOSRA_API_KEY (environment variable)\n\n" +
|
|
39
|
+
"Get your API key at https://phosra.com/dashboard/api-keys");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
return { apiKey, apiUrl };
|
|
43
|
+
}
|
|
44
|
+
// -- Main ------------------------------------------------------------
|
|
45
|
+
async function main() {
|
|
46
|
+
const { apiKey, apiUrl } = parseArgs();
|
|
47
|
+
const server = buildServer({ apiKey, baseUrl: apiUrl });
|
|
48
|
+
const transport = new StdioServerTransport();
|
|
49
|
+
console.error(`Phosra MCP server v0.1.0`);
|
|
50
|
+
console.error(`API endpoint: ${apiUrl}`);
|
|
51
|
+
console.error(`Registering 42 tools...`);
|
|
52
|
+
await server.connect(transport);
|
|
53
|
+
console.error("Server running on stdio. Ready for MCP client connections.");
|
|
54
|
+
}
|
|
55
|
+
main().catch((err) => {
|
|
56
|
+
console.error("Fatal error starting Phosra MCP server:", err);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|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E,CAAC;IAEvC,MAAM,MAAM,GAAG,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC1C,OAAO,CAAC,KAAK,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAEzC,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,4DAA4D,CAAC,CAAC;AAC9E,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,yCAAyC,EAAE,GAAG,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server factory for Phosra.
|
|
3
|
+
*
|
|
4
|
+
* Registers all 42 Phosra tools with the MCP SDK so that any
|
|
5
|
+
* MCP-compatible client (Claude Desktop, Cursor, etc.) can call them.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import type { PhosraConfig } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Build and return a configured MCP server with all Phosra tools registered.
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { buildServer } from "@phosra/mcp";
|
|
15
|
+
* import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
16
|
+
*
|
|
17
|
+
* const server = buildServer({ apiKey: "...", baseUrl: "..." });
|
|
18
|
+
* await server.connect(new StdioServerTransport());
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildServer(config: PhosraConfig): McpServer;
|
|
22
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA4E/C;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAoC3D"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server factory for Phosra.
|
|
3
|
+
*
|
|
4
|
+
* Registers all 42 Phosra tools with the MCP SDK so that any
|
|
5
|
+
* MCP-compatible client (Claude Desktop, Cursor, etc.) can call them.
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
import { TOOLS } from "./tools.js";
|
|
10
|
+
import { executeToolCall } from "./api-client.js";
|
|
11
|
+
/**
|
|
12
|
+
* Convert a single JSON Schema property descriptor to a Zod schema.
|
|
13
|
+
*
|
|
14
|
+
* Handles the types that appear in the Phosra tool definitions:
|
|
15
|
+
* string, integer, number, boolean, array, object
|
|
16
|
+
*/
|
|
17
|
+
function jsonSchemaToZod(prop) {
|
|
18
|
+
let schema;
|
|
19
|
+
switch (prop.type) {
|
|
20
|
+
case "string":
|
|
21
|
+
if (prop.enum && prop.enum.length > 0) {
|
|
22
|
+
// z.enum requires at least one element
|
|
23
|
+
schema = z.enum(prop.enum);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
schema = z.string();
|
|
27
|
+
}
|
|
28
|
+
break;
|
|
29
|
+
case "integer":
|
|
30
|
+
case "number":
|
|
31
|
+
schema = z.number();
|
|
32
|
+
break;
|
|
33
|
+
case "boolean":
|
|
34
|
+
schema = z.boolean();
|
|
35
|
+
break;
|
|
36
|
+
case "array":
|
|
37
|
+
if (prop.items) {
|
|
38
|
+
schema = z.array(jsonSchemaToZod(prop.items));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
schema = z.array(z.unknown());
|
|
42
|
+
}
|
|
43
|
+
break;
|
|
44
|
+
case "object":
|
|
45
|
+
// Generic object -- we can't know the shape at this level
|
|
46
|
+
schema = z.record(z.unknown());
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
schema = z.unknown();
|
|
50
|
+
}
|
|
51
|
+
if (prop.description) {
|
|
52
|
+
schema = schema.describe(prop.description);
|
|
53
|
+
}
|
|
54
|
+
return schema;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Convert a tool's JSON Schema `properties` block into a Zod object shape.
|
|
58
|
+
* All properties are marked optional (the Phosra API performs its own validation).
|
|
59
|
+
*/
|
|
60
|
+
function buildZodShape(properties) {
|
|
61
|
+
const shape = {};
|
|
62
|
+
for (const [key, prop] of Object.entries(properties)) {
|
|
63
|
+
shape[key] = jsonSchemaToZod(prop).optional();
|
|
64
|
+
}
|
|
65
|
+
return shape;
|
|
66
|
+
}
|
|
67
|
+
// -- Server factory --------------------------------------------------
|
|
68
|
+
/**
|
|
69
|
+
* Build and return a configured MCP server with all Phosra tools registered.
|
|
70
|
+
*
|
|
71
|
+
* Usage:
|
|
72
|
+
* ```ts
|
|
73
|
+
* import { buildServer } from "@phosra/mcp";
|
|
74
|
+
* import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
75
|
+
*
|
|
76
|
+
* const server = buildServer({ apiKey: "...", baseUrl: "..." });
|
|
77
|
+
* await server.connect(new StdioServerTransport());
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export function buildServer(config) {
|
|
81
|
+
const server = new McpServer({
|
|
82
|
+
name: "phosra",
|
|
83
|
+
version: "0.1.0",
|
|
84
|
+
});
|
|
85
|
+
for (const tool of TOOLS) {
|
|
86
|
+
const properties = (tool.input_schema.properties ?? {});
|
|
87
|
+
const zodShape = buildZodShape(properties);
|
|
88
|
+
server.tool(tool.name, tool.description, zodShape, async (params) => {
|
|
89
|
+
const result = await executeToolCall(tool, params, config);
|
|
90
|
+
const text = JSON.stringify(result.data, null, 2);
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: "text", text }],
|
|
93
|
+
isError: !result.ok,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return server;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAmB,MAAM,KAAK,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAYlD;;;;;GAKG;AACH,SAAS,eAAe,CAAC,IAAoB;IAC3C,IAAI,MAAkB,CAAC;IAEvB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,QAAQ;YACX,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtC,uCAAuC;gBACvC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAA6B,CAAC,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACN,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;YACtB,CAAC;YACD,MAAM;QACR,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,MAAM,GA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ACjB,CAAC,CAAC;IAEH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,IAAI,EAAE,CAGrD,CAAC;QAEF,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC;QAE3C,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,QAAQ,EACR,KAAK,EAAE,MAAM,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,MAAM,eAAe,CAClC,IAAI,EACJ,MAAiC,EACjC,MAAM,CACP,CAAC;YAEF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;YAElD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;gBAC1C,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE;aACpB,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool definitions for the Phosra API.
|
|
3
|
+
* Each tool maps 1:1 to a REST endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Adapted from web/src/lib/playground/tools.ts for standalone use.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolDefinition } from "./types.js";
|
|
8
|
+
export type { ToolDefinition };
|
|
9
|
+
export declare const TOOLS: ToolDefinition[];
|
|
10
|
+
/**
|
|
11
|
+
* Build an Anthropic-compatible tool list from definitions.
|
|
12
|
+
* Strips the `http` metadata, returning only name + description + input_schema.
|
|
13
|
+
*/
|
|
14
|
+
export declare function toAnthropicTools(): {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
input_schema: Record<string, unknown>;
|
|
18
|
+
}[];
|
|
19
|
+
/**
|
|
20
|
+
* Resolve a tool path with parameter substitution.
|
|
21
|
+
*
|
|
22
|
+
* Path parameters like {family_id} are extracted from input.
|
|
23
|
+
* For GET requests, remaining params become query-string pairs.
|
|
24
|
+
* For non-GET requests, remaining params become JSON body fields.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveToolPath(tool: ToolDefinition, input: Record<string, unknown>): {
|
|
27
|
+
path: string;
|
|
28
|
+
query: Record<string, string>;
|
|
29
|
+
body: Record<string, unknown> | null;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,YAAY,EAAE,cAAc,EAAE,CAAC;AAK/B,eAAO,MAAM,KAAK,EAAE,cAAc,EAq2BjC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB;;;;IAM/B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACtC,CAsBA"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,858 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool definitions for the Phosra API.
|
|
3
|
+
* Each tool maps 1:1 to a REST endpoint.
|
|
4
|
+
*
|
|
5
|
+
* Adapted from web/src/lib/playground/tools.ts for standalone use.
|
|
6
|
+
*/
|
|
7
|
+
const str = (desc) => ({ type: "string", description: desc });
|
|
8
|
+
const int = (desc) => ({ type: "integer", description: desc });
|
|
9
|
+
export const TOOLS = [
|
|
10
|
+
// -- Auth --------------------------------------------------
|
|
11
|
+
{
|
|
12
|
+
name: "get_current_user",
|
|
13
|
+
description: "Get the current authenticated user's profile (name, email, ID).",
|
|
14
|
+
input_schema: { type: "object", properties: {}, required: [] },
|
|
15
|
+
http: { method: "GET", path: "/auth/me" },
|
|
16
|
+
},
|
|
17
|
+
// -- Quick Setup -------------------------------------------
|
|
18
|
+
{
|
|
19
|
+
name: "quick_setup",
|
|
20
|
+
description: "One-step onboarding: creates a family, adds a child, generates age-appropriate policy rules, and activates the policy. If family_id is provided, uses that existing family. Strictness can be 'recommended', 'strict', or 'relaxed'.",
|
|
21
|
+
input_schema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
child_name: str("The child's display name"),
|
|
25
|
+
birth_date: str("Child's birth date in YYYY-MM-DD format"),
|
|
26
|
+
strictness: str("One of: recommended, strict, relaxed (default: recommended)"),
|
|
27
|
+
family_id: str("Optional: existing family UUID to add the child to"),
|
|
28
|
+
family_name: str("Optional: name for a new family (defaults to '{child_name}'s Family')"),
|
|
29
|
+
},
|
|
30
|
+
required: ["child_name", "birth_date"],
|
|
31
|
+
},
|
|
32
|
+
http: { method: "POST", path: "/setup/quick" },
|
|
33
|
+
},
|
|
34
|
+
// -- Families ----------------------------------------------
|
|
35
|
+
{
|
|
36
|
+
name: "list_families",
|
|
37
|
+
description: "List all families the current user belongs to.",
|
|
38
|
+
input_schema: { type: "object", properties: {}, required: [] },
|
|
39
|
+
http: { method: "GET", path: "/families" },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "create_family",
|
|
43
|
+
description: "Create a new family group.",
|
|
44
|
+
input_schema: {
|
|
45
|
+
type: "object",
|
|
46
|
+
properties: { name: str("Family name") },
|
|
47
|
+
required: ["name"],
|
|
48
|
+
},
|
|
49
|
+
http: { method: "POST", path: "/families" },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "get_family",
|
|
53
|
+
description: "Get details of a specific family.",
|
|
54
|
+
input_schema: {
|
|
55
|
+
type: "object",
|
|
56
|
+
properties: { family_id: str("Family UUID") },
|
|
57
|
+
required: ["family_id"],
|
|
58
|
+
},
|
|
59
|
+
http: { method: "GET", path: "/families/{family_id}" },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: "update_family",
|
|
63
|
+
description: "Update a family's name.",
|
|
64
|
+
input_schema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: {
|
|
67
|
+
family_id: str("Family UUID"),
|
|
68
|
+
name: str("New family name"),
|
|
69
|
+
},
|
|
70
|
+
required: ["family_id", "name"],
|
|
71
|
+
},
|
|
72
|
+
http: { method: "PUT", path: "/families/{family_id}" },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "delete_family",
|
|
76
|
+
description: "Delete a family and all its children, policies, and rules.",
|
|
77
|
+
input_schema: {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: { family_id: str("Family UUID") },
|
|
80
|
+
required: ["family_id"],
|
|
81
|
+
},
|
|
82
|
+
http: { method: "DELETE", path: "/families/{family_id}" },
|
|
83
|
+
},
|
|
84
|
+
// -- Family Members ----------------------------------------
|
|
85
|
+
{
|
|
86
|
+
name: "list_family_members",
|
|
87
|
+
description: "List all members of a family with their roles (owner, parent, guardian).",
|
|
88
|
+
input_schema: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: { family_id: str("Family UUID") },
|
|
91
|
+
required: ["family_id"],
|
|
92
|
+
},
|
|
93
|
+
http: { method: "GET", path: "/families/{family_id}/members" },
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: "add_family_member",
|
|
97
|
+
description: "Add a user to a family with a specific role.",
|
|
98
|
+
input_schema: {
|
|
99
|
+
type: "object",
|
|
100
|
+
properties: {
|
|
101
|
+
family_id: str("Family UUID"),
|
|
102
|
+
user_id: str("User UUID to add"),
|
|
103
|
+
role: str("Role: owner, parent, or guardian"),
|
|
104
|
+
},
|
|
105
|
+
required: ["family_id", "user_id", "role"],
|
|
106
|
+
},
|
|
107
|
+
http: { method: "POST", path: "/families/{family_id}/members" },
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "remove_family_member",
|
|
111
|
+
description: "Remove a member from a family.",
|
|
112
|
+
input_schema: {
|
|
113
|
+
type: "object",
|
|
114
|
+
properties: {
|
|
115
|
+
family_id: str("Family UUID"),
|
|
116
|
+
member_id: str("Member UUID to remove"),
|
|
117
|
+
},
|
|
118
|
+
required: ["family_id", "member_id"],
|
|
119
|
+
},
|
|
120
|
+
http: {
|
|
121
|
+
method: "DELETE",
|
|
122
|
+
path: "/families/{family_id}/members/{member_id}",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
// -- Children ----------------------------------------------
|
|
126
|
+
{
|
|
127
|
+
name: "list_children",
|
|
128
|
+
description: "List all children in a family.",
|
|
129
|
+
input_schema: {
|
|
130
|
+
type: "object",
|
|
131
|
+
properties: { family_id: str("Family UUID") },
|
|
132
|
+
required: ["family_id"],
|
|
133
|
+
},
|
|
134
|
+
http: { method: "GET", path: "/families/{family_id}/children" },
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "create_child",
|
|
138
|
+
description: "Add a new child to a family. Birth date determines age-appropriate ratings.",
|
|
139
|
+
input_schema: {
|
|
140
|
+
type: "object",
|
|
141
|
+
properties: {
|
|
142
|
+
family_id: str("Family UUID"),
|
|
143
|
+
name: str("Child's display name"),
|
|
144
|
+
birth_date: str("Birth date in YYYY-MM-DD format"),
|
|
145
|
+
},
|
|
146
|
+
required: ["family_id", "name", "birth_date"],
|
|
147
|
+
},
|
|
148
|
+
http: { method: "POST", path: "/families/{family_id}/children" },
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "get_child",
|
|
152
|
+
description: "Get details of a specific child including age and family.",
|
|
153
|
+
input_schema: {
|
|
154
|
+
type: "object",
|
|
155
|
+
properties: { child_id: str("Child UUID") },
|
|
156
|
+
required: ["child_id"],
|
|
157
|
+
},
|
|
158
|
+
http: { method: "GET", path: "/children/{child_id}" },
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "update_child",
|
|
162
|
+
description: "Update a child's name or birth date.",
|
|
163
|
+
input_schema: {
|
|
164
|
+
type: "object",
|
|
165
|
+
properties: {
|
|
166
|
+
child_id: str("Child UUID"),
|
|
167
|
+
name: str("New name"),
|
|
168
|
+
birth_date: str("New birth date in YYYY-MM-DD format"),
|
|
169
|
+
},
|
|
170
|
+
required: ["child_id"],
|
|
171
|
+
},
|
|
172
|
+
http: { method: "PUT", path: "/children/{child_id}" },
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "delete_child",
|
|
176
|
+
description: "Delete a child and all their policies and rules.",
|
|
177
|
+
input_schema: {
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: { child_id: str("Child UUID") },
|
|
180
|
+
required: ["child_id"],
|
|
181
|
+
},
|
|
182
|
+
http: { method: "DELETE", path: "/children/{child_id}" },
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "get_child_age_ratings",
|
|
186
|
+
description: "Get the recommended content ratings for a child based on their age, across all 5 rating systems (MPAA, TV, ESRB, PEGI, CSM).",
|
|
187
|
+
input_schema: {
|
|
188
|
+
type: "object",
|
|
189
|
+
properties: { child_id: str("Child UUID") },
|
|
190
|
+
required: ["child_id"],
|
|
191
|
+
},
|
|
192
|
+
http: { method: "GET", path: "/children/{child_id}/age-ratings" },
|
|
193
|
+
},
|
|
194
|
+
// -- Policies ----------------------------------------------
|
|
195
|
+
{
|
|
196
|
+
name: "list_policies",
|
|
197
|
+
description: "List all policies for a child.",
|
|
198
|
+
input_schema: {
|
|
199
|
+
type: "object",
|
|
200
|
+
properties: { child_id: str("Child UUID") },
|
|
201
|
+
required: ["child_id"],
|
|
202
|
+
},
|
|
203
|
+
http: { method: "GET", path: "/children/{child_id}/policies" },
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "create_policy",
|
|
207
|
+
description: "Create a new policy for a child. Policies start in 'draft' status.",
|
|
208
|
+
input_schema: {
|
|
209
|
+
type: "object",
|
|
210
|
+
properties: {
|
|
211
|
+
child_id: str("Child UUID"),
|
|
212
|
+
name: str("Policy name"),
|
|
213
|
+
priority: int("Priority (higher = takes precedence)"),
|
|
214
|
+
},
|
|
215
|
+
required: ["child_id", "name"],
|
|
216
|
+
},
|
|
217
|
+
http: { method: "POST", path: "/children/{child_id}/policies" },
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "get_policy",
|
|
221
|
+
description: "Get details of a specific policy.",
|
|
222
|
+
input_schema: {
|
|
223
|
+
type: "object",
|
|
224
|
+
properties: { policy_id: str("Policy UUID") },
|
|
225
|
+
required: ["policy_id"],
|
|
226
|
+
},
|
|
227
|
+
http: { method: "GET", path: "/policies/{policy_id}" },
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "update_policy",
|
|
231
|
+
description: "Update a policy's name or priority.",
|
|
232
|
+
input_schema: {
|
|
233
|
+
type: "object",
|
|
234
|
+
properties: {
|
|
235
|
+
policy_id: str("Policy UUID"),
|
|
236
|
+
name: str("New policy name"),
|
|
237
|
+
priority: int("New priority"),
|
|
238
|
+
},
|
|
239
|
+
required: ["policy_id"],
|
|
240
|
+
},
|
|
241
|
+
http: { method: "PUT", path: "/policies/{policy_id}" },
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "delete_policy",
|
|
245
|
+
description: "Delete a policy and all its rules.",
|
|
246
|
+
input_schema: {
|
|
247
|
+
type: "object",
|
|
248
|
+
properties: { policy_id: str("Policy UUID") },
|
|
249
|
+
required: ["policy_id"],
|
|
250
|
+
},
|
|
251
|
+
http: { method: "DELETE", path: "/policies/{policy_id}" },
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: "activate_policy",
|
|
255
|
+
description: "Activate a policy so its rules are enforced.",
|
|
256
|
+
input_schema: {
|
|
257
|
+
type: "object",
|
|
258
|
+
properties: { policy_id: str("Policy UUID") },
|
|
259
|
+
required: ["policy_id"],
|
|
260
|
+
},
|
|
261
|
+
http: { method: "POST", path: "/policies/{policy_id}/activate" },
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "pause_policy",
|
|
265
|
+
description: "Pause a policy to temporarily stop enforcement.",
|
|
266
|
+
input_schema: {
|
|
267
|
+
type: "object",
|
|
268
|
+
properties: { policy_id: str("Policy UUID") },
|
|
269
|
+
required: ["policy_id"],
|
|
270
|
+
},
|
|
271
|
+
http: { method: "POST", path: "/policies/{policy_id}/pause" },
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
name: "generate_rules_from_age",
|
|
275
|
+
description: "Auto-generate age-appropriate rules for a policy based on the child's birth date. Replaces existing rules with defaults for the child's age group.",
|
|
276
|
+
input_schema: {
|
|
277
|
+
type: "object",
|
|
278
|
+
properties: { policy_id: str("Policy UUID") },
|
|
279
|
+
required: ["policy_id"],
|
|
280
|
+
},
|
|
281
|
+
http: { method: "POST", path: "/policies/{policy_id}/generate-from-age" },
|
|
282
|
+
},
|
|
283
|
+
// -- Rules -------------------------------------------------
|
|
284
|
+
{
|
|
285
|
+
name: "list_rules",
|
|
286
|
+
description: "List all rules in a policy. Returns each rule's category, enabled status, and JSON config.",
|
|
287
|
+
input_schema: {
|
|
288
|
+
type: "object",
|
|
289
|
+
properties: { policy_id: str("Policy UUID") },
|
|
290
|
+
required: ["policy_id"],
|
|
291
|
+
},
|
|
292
|
+
http: { method: "GET", path: "/policies/{policy_id}/rules" },
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: "create_rule",
|
|
296
|
+
description: "Create a new rule in a policy. Category must be one of the 45 supported categories. Config is a JSON object specific to the category.",
|
|
297
|
+
input_schema: {
|
|
298
|
+
type: "object",
|
|
299
|
+
properties: {
|
|
300
|
+
policy_id: str("Policy UUID"),
|
|
301
|
+
category: str("Rule category (e.g., time_daily_limit, content_rating, web_safesearch)"),
|
|
302
|
+
enabled: { type: "boolean", description: "Whether the rule is active" },
|
|
303
|
+
config: {
|
|
304
|
+
type: "object",
|
|
305
|
+
description: "Category-specific configuration JSON",
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
required: ["policy_id", "category", "enabled", "config"],
|
|
309
|
+
},
|
|
310
|
+
http: { method: "POST", path: "/policies/{policy_id}/rules" },
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: "bulk_upsert_rules",
|
|
314
|
+
description: "Create or update multiple rules at once for a policy.",
|
|
315
|
+
input_schema: {
|
|
316
|
+
type: "object",
|
|
317
|
+
properties: {
|
|
318
|
+
policy_id: str("Policy UUID"),
|
|
319
|
+
rules: {
|
|
320
|
+
type: "array",
|
|
321
|
+
description: "Array of rule objects with category, enabled, and config",
|
|
322
|
+
items: { type: "object" },
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
required: ["policy_id", "rules"],
|
|
326
|
+
},
|
|
327
|
+
http: { method: "PUT", path: "/policies/{policy_id}/rules/bulk" },
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
name: "update_rule",
|
|
331
|
+
description: "Update a specific rule's enabled status or config.",
|
|
332
|
+
input_schema: {
|
|
333
|
+
type: "object",
|
|
334
|
+
properties: {
|
|
335
|
+
rule_id: str("Rule UUID"),
|
|
336
|
+
enabled: { type: "boolean", description: "Whether the rule is active" },
|
|
337
|
+
config: {
|
|
338
|
+
type: "object",
|
|
339
|
+
description: "Updated configuration JSON",
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
required: ["rule_id"],
|
|
343
|
+
},
|
|
344
|
+
http: { method: "PUT", path: "/rules/{rule_id}" },
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: "delete_rule",
|
|
348
|
+
description: "Delete a specific rule from a policy.",
|
|
349
|
+
input_schema: {
|
|
350
|
+
type: "object",
|
|
351
|
+
properties: { rule_id: str("Rule UUID") },
|
|
352
|
+
required: ["rule_id"],
|
|
353
|
+
},
|
|
354
|
+
http: { method: "DELETE", path: "/rules/{rule_id}" },
|
|
355
|
+
},
|
|
356
|
+
// -- Platforms ---------------------------------------------
|
|
357
|
+
{
|
|
358
|
+
name: "list_platforms",
|
|
359
|
+
description: "List all platforms Phosra can integrate with, including their category, compliance tier, auth type, and capabilities.",
|
|
360
|
+
input_schema: { type: "object", properties: {}, required: [] },
|
|
361
|
+
http: { method: "GET", path: "/platforms" },
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
name: "get_platform",
|
|
365
|
+
description: "Get details of a specific platform including capabilities and manual setup steps.",
|
|
366
|
+
input_schema: {
|
|
367
|
+
type: "object",
|
|
368
|
+
properties: {
|
|
369
|
+
platform_id: str("Platform ID (e.g., 'nextdns', 'android', 'netflix')"),
|
|
370
|
+
},
|
|
371
|
+
required: ["platform_id"],
|
|
372
|
+
},
|
|
373
|
+
http: { method: "GET", path: "/platforms/{platform_id}" },
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
name: "list_platforms_by_category",
|
|
377
|
+
description: "Filter platforms by category: dns, streaming, gaming, device, browser.",
|
|
378
|
+
input_schema: {
|
|
379
|
+
type: "object",
|
|
380
|
+
properties: { category: str("Platform category") },
|
|
381
|
+
required: ["category"],
|
|
382
|
+
},
|
|
383
|
+
http: { method: "GET", path: "/platforms/by-category" },
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
name: "list_platforms_by_capability",
|
|
387
|
+
description: "Filter platforms by capability: web_filtering, content_rating, time_limit, etc.",
|
|
388
|
+
input_schema: {
|
|
389
|
+
type: "object",
|
|
390
|
+
properties: { capability: str("Capability name") },
|
|
391
|
+
required: ["capability"],
|
|
392
|
+
},
|
|
393
|
+
http: { method: "GET", path: "/platforms/by-capability" },
|
|
394
|
+
},
|
|
395
|
+
// -- Compliance Links --------------------------------------
|
|
396
|
+
{
|
|
397
|
+
name: "list_compliance_links",
|
|
398
|
+
description: "List all platform connections for a family, showing verification status and last enforcement.",
|
|
399
|
+
input_schema: {
|
|
400
|
+
type: "object",
|
|
401
|
+
properties: { family_id: str("Family UUID") },
|
|
402
|
+
required: ["family_id"],
|
|
403
|
+
},
|
|
404
|
+
http: { method: "GET", path: "/families/{family_id}/compliance" },
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
name: "connect_platform",
|
|
408
|
+
description: "Connect a platform to the family by providing credentials for verification.",
|
|
409
|
+
input_schema: {
|
|
410
|
+
type: "object",
|
|
411
|
+
properties: {
|
|
412
|
+
family_id: str("Family UUID"),
|
|
413
|
+
platform_id: str("Platform ID"),
|
|
414
|
+
credentials: {
|
|
415
|
+
type: "object",
|
|
416
|
+
description: "Platform-specific credentials (api_key, oauth_token, etc.)",
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
required: ["family_id", "platform_id", "credentials"],
|
|
420
|
+
},
|
|
421
|
+
http: { method: "POST", path: "/compliance" },
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
name: "disconnect_platform",
|
|
425
|
+
description: "Disconnect a platform from the family.",
|
|
426
|
+
input_schema: {
|
|
427
|
+
type: "object",
|
|
428
|
+
properties: { link_id: str("Compliance link UUID") },
|
|
429
|
+
required: ["link_id"],
|
|
430
|
+
},
|
|
431
|
+
http: { method: "DELETE", path: "/compliance/{link_id}" },
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: "verify_connection",
|
|
435
|
+
description: "Re-verify an existing platform connection (test that credentials still work).",
|
|
436
|
+
input_schema: {
|
|
437
|
+
type: "object",
|
|
438
|
+
properties: { link_id: str("Compliance link UUID") },
|
|
439
|
+
required: ["link_id"],
|
|
440
|
+
},
|
|
441
|
+
http: { method: "POST", path: "/compliance/{link_id}/verify" },
|
|
442
|
+
},
|
|
443
|
+
// -- Enforcement -------------------------------------------
|
|
444
|
+
{
|
|
445
|
+
name: "trigger_enforcement",
|
|
446
|
+
description: "Push the child's active policy rules to connected platforms. If platform_ids is provided, only those platforms are targeted; otherwise enforcement fans out to ALL connected platforms. Returns the job ID for tracking.",
|
|
447
|
+
input_schema: {
|
|
448
|
+
type: "object",
|
|
449
|
+
properties: {
|
|
450
|
+
child_id: str("Child UUID"),
|
|
451
|
+
platform_ids: {
|
|
452
|
+
type: "array",
|
|
453
|
+
items: { type: "string" },
|
|
454
|
+
description: "Optional list of platform IDs to target (e.g., ['netflix', 'youtube']). If omitted, pushes to ALL connected platforms. Valid IDs: netflix, paramount_plus, youtube_tv, peacock, prime_video, youtube, nextdns, android, fire_tablet, apple_watch, fire_tv_stick.",
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
required: ["child_id"],
|
|
458
|
+
},
|
|
459
|
+
http: { method: "POST", path: "/children/{child_id}/enforce" },
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
name: "list_enforcement_jobs",
|
|
463
|
+
description: "List enforcement job history for a child.",
|
|
464
|
+
input_schema: {
|
|
465
|
+
type: "object",
|
|
466
|
+
properties: { child_id: str("Child UUID") },
|
|
467
|
+
required: ["child_id"],
|
|
468
|
+
},
|
|
469
|
+
http: { method: "GET", path: "/children/{child_id}/enforcement/jobs" },
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
name: "get_enforcement_job",
|
|
473
|
+
description: "Get status of a specific enforcement job.",
|
|
474
|
+
input_schema: {
|
|
475
|
+
type: "object",
|
|
476
|
+
properties: { job_id: str("Enforcement job UUID") },
|
|
477
|
+
required: ["job_id"],
|
|
478
|
+
},
|
|
479
|
+
http: { method: "GET", path: "/enforcement/jobs/{job_id}" },
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
name: "get_enforcement_results",
|
|
483
|
+
description: "Get per-platform results of an enforcement job: rules_applied, rules_skipped, rules_failed, and any error messages.",
|
|
484
|
+
input_schema: {
|
|
485
|
+
type: "object",
|
|
486
|
+
properties: { job_id: str("Enforcement job UUID") },
|
|
487
|
+
required: ["job_id"],
|
|
488
|
+
},
|
|
489
|
+
http: { method: "GET", path: "/enforcement/jobs/{job_id}/results" },
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
name: "retry_enforcement",
|
|
493
|
+
description: "Retry a failed enforcement job.",
|
|
494
|
+
input_schema: {
|
|
495
|
+
type: "object",
|
|
496
|
+
properties: { job_id: str("Enforcement job UUID") },
|
|
497
|
+
required: ["job_id"],
|
|
498
|
+
},
|
|
499
|
+
http: { method: "POST", path: "/enforcement/jobs/{job_id}/retry" },
|
|
500
|
+
},
|
|
501
|
+
// -- Ratings -----------------------------------------------
|
|
502
|
+
{
|
|
503
|
+
name: "list_rating_systems",
|
|
504
|
+
description: "List all 5 content rating systems (MPAA, TV, ESRB, PEGI, CSM).",
|
|
505
|
+
input_schema: { type: "object", properties: {}, required: [] },
|
|
506
|
+
http: { method: "GET", path: "/ratings/systems" },
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
name: "get_ratings_for_age",
|
|
510
|
+
description: "Get recommended maximum ratings across all systems for a specific age.",
|
|
511
|
+
input_schema: {
|
|
512
|
+
type: "object",
|
|
513
|
+
properties: { age: int("Child's age in years") },
|
|
514
|
+
required: ["age"],
|
|
515
|
+
},
|
|
516
|
+
http: { method: "GET", path: "/ratings/by-age" },
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
name: "convert_rating",
|
|
520
|
+
description: "Get equivalent ratings in other systems for a given rating (cross-system mapping).",
|
|
521
|
+
input_schema: {
|
|
522
|
+
type: "object",
|
|
523
|
+
properties: { rating_id: str("Rating UUID") },
|
|
524
|
+
required: ["rating_id"],
|
|
525
|
+
},
|
|
526
|
+
http: { method: "GET", path: "/ratings/{rating_id}/convert" },
|
|
527
|
+
},
|
|
528
|
+
// -- Reports -----------------------------------------------
|
|
529
|
+
{
|
|
530
|
+
name: "family_overview_report",
|
|
531
|
+
description: "Get a health dashboard for a family: children, active policies, sync status, recent enforcement jobs, and recommendations.",
|
|
532
|
+
input_schema: {
|
|
533
|
+
type: "object",
|
|
534
|
+
properties: { family_id: str("Family UUID") },
|
|
535
|
+
required: ["family_id"],
|
|
536
|
+
},
|
|
537
|
+
http: { method: "GET", path: "/families/{family_id}/reports/overview" },
|
|
538
|
+
},
|
|
539
|
+
// -- Webhooks ----------------------------------------------
|
|
540
|
+
{
|
|
541
|
+
name: "list_webhooks",
|
|
542
|
+
description: "List webhook subscriptions for a family.",
|
|
543
|
+
input_schema: {
|
|
544
|
+
type: "object",
|
|
545
|
+
properties: { family_id: str("Family UUID") },
|
|
546
|
+
required: ["family_id"],
|
|
547
|
+
},
|
|
548
|
+
http: { method: "GET", path: "/families/{family_id}/webhooks" },
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: "create_webhook",
|
|
552
|
+
description: "Register a webhook endpoint to receive event notifications.",
|
|
553
|
+
input_schema: {
|
|
554
|
+
type: "object",
|
|
555
|
+
properties: {
|
|
556
|
+
family_id: str("Family UUID"),
|
|
557
|
+
url: str("Webhook URL"),
|
|
558
|
+
events: {
|
|
559
|
+
type: "array",
|
|
560
|
+
items: { type: "string" },
|
|
561
|
+
description: "Events to subscribe to",
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
required: ["family_id", "url", "events"],
|
|
565
|
+
},
|
|
566
|
+
http: { method: "POST", path: "/webhooks" },
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
name: "test_webhook",
|
|
570
|
+
description: "Send a test delivery to a webhook endpoint.",
|
|
571
|
+
input_schema: {
|
|
572
|
+
type: "object",
|
|
573
|
+
properties: { webhook_id: str("Webhook UUID") },
|
|
574
|
+
required: ["webhook_id"],
|
|
575
|
+
},
|
|
576
|
+
http: { method: "POST", path: "/webhooks/{webhook_id}/test" },
|
|
577
|
+
},
|
|
578
|
+
// -- Sources -----------------------------------------------
|
|
579
|
+
{
|
|
580
|
+
name: "list_available_sources",
|
|
581
|
+
description: "List all available parental control source adapters that can be connected.",
|
|
582
|
+
input_schema: { type: "object", properties: {}, required: [] },
|
|
583
|
+
http: { method: "GET", path: "/sources/available" },
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
name: "connect_source",
|
|
587
|
+
description: "Connect a parental control app as a source for a child.",
|
|
588
|
+
input_schema: {
|
|
589
|
+
type: "object",
|
|
590
|
+
properties: {
|
|
591
|
+
child_id: str("Child ID"),
|
|
592
|
+
family_id: str("Family ID"),
|
|
593
|
+
source: str("Source slug (e.g., 'bark', 'qustodio')"),
|
|
594
|
+
credentials: {
|
|
595
|
+
type: "object",
|
|
596
|
+
description: "Source credentials (for managed sources)",
|
|
597
|
+
},
|
|
598
|
+
auto_sync: {
|
|
599
|
+
type: "boolean",
|
|
600
|
+
description: "Enable automatic sync on policy changes",
|
|
601
|
+
},
|
|
602
|
+
},
|
|
603
|
+
required: ["child_id", "family_id", "source"],
|
|
604
|
+
},
|
|
605
|
+
http: { method: "POST", path: "/sources" },
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
name: "get_source",
|
|
609
|
+
description: "Get details of a connected source.",
|
|
610
|
+
input_schema: {
|
|
611
|
+
type: "object",
|
|
612
|
+
properties: { source_id: str("Source ID") },
|
|
613
|
+
required: ["source_id"],
|
|
614
|
+
},
|
|
615
|
+
http: { method: "GET", path: "/sources/{source_id}" },
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
name: "list_child_sources",
|
|
619
|
+
description: "List all connected sources for a child.",
|
|
620
|
+
input_schema: {
|
|
621
|
+
type: "object",
|
|
622
|
+
properties: { child_id: str("Child ID") },
|
|
623
|
+
required: ["child_id"],
|
|
624
|
+
},
|
|
625
|
+
http: { method: "GET", path: "/children/{child_id}/sources" },
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: "sync_source",
|
|
629
|
+
description: "Push all active policy rules to a connected source.",
|
|
630
|
+
input_schema: {
|
|
631
|
+
type: "object",
|
|
632
|
+
properties: {
|
|
633
|
+
source_id: str("Source ID"),
|
|
634
|
+
sync_mode: str("Sync mode: full or incremental (default: full)"),
|
|
635
|
+
},
|
|
636
|
+
required: ["source_id"],
|
|
637
|
+
},
|
|
638
|
+
http: { method: "POST", path: "/sources/{source_id}/sync" },
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
name: "push_source_rule",
|
|
642
|
+
description: "Push a single rule to a connected source.",
|
|
643
|
+
input_schema: {
|
|
644
|
+
type: "object",
|
|
645
|
+
properties: {
|
|
646
|
+
source_id: str("Source ID"),
|
|
647
|
+
category: str("Rule category"),
|
|
648
|
+
value: {
|
|
649
|
+
type: "object",
|
|
650
|
+
description: "Rule value/config",
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
required: ["source_id", "category"],
|
|
654
|
+
},
|
|
655
|
+
http: { method: "POST", path: "/sources/{source_id}/rules" },
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
name: "get_source_guided_steps",
|
|
659
|
+
description: "Get manual setup instructions for a guided-tier source.",
|
|
660
|
+
input_schema: {
|
|
661
|
+
type: "object",
|
|
662
|
+
properties: {
|
|
663
|
+
source_id: str("Source ID"),
|
|
664
|
+
category: str("Rule category for guided steps"),
|
|
665
|
+
},
|
|
666
|
+
required: ["source_id", "category"],
|
|
667
|
+
},
|
|
668
|
+
http: {
|
|
669
|
+
method: "GET",
|
|
670
|
+
path: "/sources/{source_id}/guide/{category}",
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: "list_source_sync_jobs",
|
|
675
|
+
description: "List sync job history for a source.",
|
|
676
|
+
input_schema: {
|
|
677
|
+
type: "object",
|
|
678
|
+
properties: {
|
|
679
|
+
source_id: str("Source ID"),
|
|
680
|
+
limit: int("Max jobs to return"),
|
|
681
|
+
},
|
|
682
|
+
required: ["source_id"],
|
|
683
|
+
},
|
|
684
|
+
http: { method: "GET", path: "/sources/{source_id}/jobs" },
|
|
685
|
+
},
|
|
686
|
+
{
|
|
687
|
+
name: "get_source_sync_results",
|
|
688
|
+
description: "Get per-rule results for a sync job.",
|
|
689
|
+
input_schema: {
|
|
690
|
+
type: "object",
|
|
691
|
+
properties: {
|
|
692
|
+
source_id: str("Source ID"),
|
|
693
|
+
job_id: str("Sync job ID"),
|
|
694
|
+
},
|
|
695
|
+
required: ["source_id", "job_id"],
|
|
696
|
+
},
|
|
697
|
+
http: {
|
|
698
|
+
method: "GET",
|
|
699
|
+
path: "/sources/{source_id}/jobs/{job_id}/results",
|
|
700
|
+
},
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
name: "disconnect_source",
|
|
704
|
+
description: "Disconnect a parental control source.",
|
|
705
|
+
input_schema: {
|
|
706
|
+
type: "object",
|
|
707
|
+
properties: { source_id: str("Source ID") },
|
|
708
|
+
required: ["source_id"],
|
|
709
|
+
},
|
|
710
|
+
http: { method: "DELETE", path: "/sources/{source_id}" },
|
|
711
|
+
},
|
|
712
|
+
// -- Brief (Phase 3 + T2) ----------------------------------
|
|
713
|
+
{
|
|
714
|
+
name: "list_brief",
|
|
715
|
+
description: "List Brief items for the authenticated family. The Brief is what changed in child-safety for this family — laws, platform changes, CSM tier shifts. Filter by status (unread/read/acted/dismissed) and source kind.",
|
|
716
|
+
input_schema: {
|
|
717
|
+
type: "object",
|
|
718
|
+
properties: {
|
|
719
|
+
status: {
|
|
720
|
+
type: "string",
|
|
721
|
+
enum: ["unread", "read", "acted", "dismissed"],
|
|
722
|
+
description: "Filter by status (default: all statuses)",
|
|
723
|
+
},
|
|
724
|
+
kind: {
|
|
725
|
+
type: "string",
|
|
726
|
+
enum: ["legislation", "platform_capability", "csm_tier", "compliance_alert", "news"],
|
|
727
|
+
description: "Filter by source kind",
|
|
728
|
+
},
|
|
729
|
+
limit: int("Max items to return (default 50, max 200)"),
|
|
730
|
+
},
|
|
731
|
+
},
|
|
732
|
+
http: { method: "GET", path: "/brief" },
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
name: "get_brief_item",
|
|
736
|
+
description: "Get a single Brief item by ID, including its full recommended_action payload (the proposed policy diff).",
|
|
737
|
+
input_schema: {
|
|
738
|
+
type: "object",
|
|
739
|
+
properties: { id: str("Brief item ID (UUID)") },
|
|
740
|
+
required: ["id"],
|
|
741
|
+
},
|
|
742
|
+
http: { method: "GET", path: "/brief/{id}" },
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: "mark_brief_read",
|
|
746
|
+
description: "Mark a Brief item as read (without applying its proposed action).",
|
|
747
|
+
input_schema: {
|
|
748
|
+
type: "object",
|
|
749
|
+
properties: { id: str("Brief item ID (UUID)") },
|
|
750
|
+
required: ["id"],
|
|
751
|
+
},
|
|
752
|
+
http: { method: "POST", path: "/brief/{id}/read" },
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
name: "dismiss_brief_item",
|
|
756
|
+
description: "Dismiss a Brief item — the family decides this signal is not actionable.",
|
|
757
|
+
input_schema: {
|
|
758
|
+
type: "object",
|
|
759
|
+
properties: { id: str("Brief item ID (UUID)") },
|
|
760
|
+
required: ["id"],
|
|
761
|
+
},
|
|
762
|
+
http: { method: "POST", path: "/brief/{id}/dismiss" },
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
name: "mark_brief_acted",
|
|
766
|
+
description: "Mark a Brief item as acted-upon (the family addressed the underlying issue manually, without applying the proposed diff).",
|
|
767
|
+
input_schema: {
|
|
768
|
+
type: "object",
|
|
769
|
+
properties: { id: str("Brief item ID (UUID)") },
|
|
770
|
+
required: ["id"],
|
|
771
|
+
},
|
|
772
|
+
http: { method: "POST", path: "/brief/{id}/acted" },
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: "apply_brief_item",
|
|
776
|
+
description: "AUTONOMOUS LOOP: Apply the proposed policy diff on a Brief item. This adds the missing rule categories to the affected child policies via Phosra's PolicyService. Returns the per-policy outcome (added / skipped_already_present / failed). Only works on items with recommended_action.kind == 'policy_diff'.",
|
|
777
|
+
input_schema: {
|
|
778
|
+
type: "object",
|
|
779
|
+
properties: { id: str("Brief item ID (UUID)") },
|
|
780
|
+
required: ["id"],
|
|
781
|
+
},
|
|
782
|
+
http: { method: "POST", path: "/brief/{id}/apply" },
|
|
783
|
+
},
|
|
784
|
+
// -- Decisions (Phase 2: audit trail) ----------------------
|
|
785
|
+
{
|
|
786
|
+
name: "list_decisions",
|
|
787
|
+
description: "List enforcement decisions Phosra has made on behalf of the family, with full provenance (law citation, rule, platform, policy version). Paginated.",
|
|
788
|
+
input_schema: {
|
|
789
|
+
type: "object",
|
|
790
|
+
properties: {
|
|
791
|
+
from: str("RFC3339 start of date range (inclusive)"),
|
|
792
|
+
to: str("RFC3339 end of date range (inclusive)"),
|
|
793
|
+
rule: str("Filter by exact rule_category"),
|
|
794
|
+
provider: str("Filter by exact provider/platform_id"),
|
|
795
|
+
outcome: {
|
|
796
|
+
type: "string",
|
|
797
|
+
enum: ["applied", "failed", "skipped"],
|
|
798
|
+
description: "Filter by outcome",
|
|
799
|
+
},
|
|
800
|
+
page: int("Page number (1-indexed, default 1)"),
|
|
801
|
+
page_size: int("Items per page (default 50, max 200)"),
|
|
802
|
+
},
|
|
803
|
+
},
|
|
804
|
+
http: { method: "GET", path: "/decisions" },
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
name: "get_decision",
|
|
808
|
+
description: "Get a single decision row by ID with full provenance.",
|
|
809
|
+
input_schema: {
|
|
810
|
+
type: "object",
|
|
811
|
+
properties: {
|
|
812
|
+
id: str("Decision ID (composite of result_id:outcome:rule)"),
|
|
813
|
+
},
|
|
814
|
+
required: ["id"],
|
|
815
|
+
},
|
|
816
|
+
http: { method: "GET", path: "/decisions/{id}" },
|
|
817
|
+
},
|
|
818
|
+
];
|
|
819
|
+
/**
|
|
820
|
+
* Build an Anthropic-compatible tool list from definitions.
|
|
821
|
+
* Strips the `http` metadata, returning only name + description + input_schema.
|
|
822
|
+
*/
|
|
823
|
+
export function toAnthropicTools() {
|
|
824
|
+
return TOOLS.map((t) => ({
|
|
825
|
+
name: t.name,
|
|
826
|
+
description: t.description,
|
|
827
|
+
input_schema: t.input_schema,
|
|
828
|
+
}));
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Resolve a tool path with parameter substitution.
|
|
832
|
+
*
|
|
833
|
+
* Path parameters like {family_id} are extracted from input.
|
|
834
|
+
* For GET requests, remaining params become query-string pairs.
|
|
835
|
+
* For non-GET requests, remaining params become JSON body fields.
|
|
836
|
+
*/
|
|
837
|
+
export function resolveToolPath(tool, input) {
|
|
838
|
+
let path = tool.http.path;
|
|
839
|
+
const query = {};
|
|
840
|
+
const bodyKeys = {};
|
|
841
|
+
for (const [key, value] of Object.entries(input)) {
|
|
842
|
+
const placeholder = `{${key}}`;
|
|
843
|
+
if (path.includes(placeholder)) {
|
|
844
|
+
path = path.replace(placeholder, String(value));
|
|
845
|
+
}
|
|
846
|
+
else if (tool.http.method === "GET") {
|
|
847
|
+
query[key] = String(value);
|
|
848
|
+
}
|
|
849
|
+
else {
|
|
850
|
+
bodyKeys[key] = value;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
const body = tool.http.method === "GET" || Object.keys(bodyKeys).length === 0
|
|
854
|
+
? null
|
|
855
|
+
: bodyKeys;
|
|
856
|
+
return { path, query, body };
|
|
857
|
+
}
|
|
858
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,QAAiB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAC/E,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,SAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;AAEhF,MAAM,CAAC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AAC;IAED,MAAM,IAAI,GACR,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC;QAC9D,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,QAAQ,CAAC;IAEf,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC/B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the Phosra MCP server.
|
|
3
|
+
*/
|
|
4
|
+
/** A single MCP tool definition that maps 1:1 to a Phosra REST endpoint. */
|
|
5
|
+
export interface ToolDefinition {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
input_schema: Record<string, unknown>;
|
|
9
|
+
http: {
|
|
10
|
+
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
11
|
+
path: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Configuration required to connect to the Phosra API. */
|
|
15
|
+
export interface PhosraConfig {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,IAAI,EAAE;QACJ,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;QACpD,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,2DAA2D;AAC3D,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@phosra/mcp",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Phosra MCP server — expose 50+ child-safety policy tools to any MCP-compatible AI client",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"phosra-mcp": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/server.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/server.js",
|
|
12
|
+
"./tools": "./dist/tools.js"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/jakeklinvexgloo/phosra.git",
|
|
17
|
+
"directory": "packages/mcp-server"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://www.phosra.com/docs/mcp",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/jakeklinvexgloo/phosra/issues"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"dev": "tsc --watch",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
30
|
+
"zod": "^3.24.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.0.0",
|
|
34
|
+
"typescript": "^5.7.0"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"license": "MIT"
|
|
40
|
+
}
|