@withpica/mcp-server-directory 1.0.0 → 1.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +1 -0
  4. package/dist/client.js.map +1 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +1 -0
  7. package/dist/config.js.map +1 -1
  8. package/dist/index.js +1 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/prompts/index.d.ts +6 -5
  11. package/dist/prompts/index.d.ts.map +1 -1
  12. package/dist/prompts/index.js +136 -96
  13. package/dist/prompts/index.js.map +1 -1
  14. package/dist/resources/llms-primer.d.ts.map +1 -1
  15. package/dist/resources/llms-primer.js +1 -0
  16. package/dist/resources/llms-primer.js.map +1 -1
  17. package/dist/server.d.ts.map +1 -1
  18. package/dist/server.js +1 -0
  19. package/dist/server.js.map +1 -1
  20. package/dist/tools/index.d.ts.map +1 -1
  21. package/dist/tools/index.js +1 -0
  22. package/dist/tools/index.js.map +1 -1
  23. package/dist/tools/people.d.ts.map +1 -1
  24. package/dist/tools/people.js +1 -0
  25. package/dist/tools/people.js.map +1 -1
  26. package/dist/tools/recordings.d.ts.map +1 -1
  27. package/dist/tools/recordings.js +1 -0
  28. package/dist/tools/recordings.js.map +1 -1
  29. package/dist/tools/search.d.ts.map +1 -1
  30. package/dist/tools/search.js +1 -0
  31. package/dist/tools/search.js.map +1 -1
  32. package/dist/tools/works.d.ts.map +1 -1
  33. package/dist/tools/works.js +1 -0
  34. package/dist/tools/works.js.map +1 -1
  35. package/dist/utils/errors.d.ts.map +1 -1
  36. package/dist/utils/errors.js +1 -0
  37. package/dist/utils/errors.js.map +1 -1
  38. package/dist/utils/formatting.d.ts.map +1 -1
  39. package/dist/utils/formatting.js +1 -0
  40. package/dist/utils/formatting.js.map +1 -1
  41. package/jest.config.js +31 -0
  42. package/package.json +1 -1
  43. package/src/__tests__/prompts/index.test.ts +145 -0
  44. package/src/__tests__/prompts/prompt-eval-harness.test.ts +251 -0
  45. package/src/__tests__/tools/composability-chains.test.ts +98 -0
  46. package/src/__tests__/tools/people.test.ts +106 -0
  47. package/src/__tests__/tools/search.test.ts +94 -0
  48. package/src/__tests__/tools/works.test.ts +148 -0
  49. package/src/client.ts +128 -0
  50. package/src/config.ts +23 -0
  51. package/src/index.ts +36 -0
  52. package/src/prompts/index.ts +250 -0
  53. package/src/resources/llms-primer.ts +35 -0
  54. package/src/server.ts +134 -0
  55. package/src/tools/index.ts +71 -0
  56. package/src/tools/people.ts +215 -0
  57. package/src/tools/recordings.ts +145 -0
  58. package/src/tools/search.ts +63 -0
  59. package/src/tools/works.ts +273 -0
  60. package/src/utils/errors.ts +64 -0
  61. package/src/utils/formatting.ts +28 -0
  62. package/tsconfig.json +22 -0
@@ -0,0 +1,64 @@
1
+ // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
+
3
+ export class McpServerError extends Error {
4
+ constructor(
5
+ message: string,
6
+ public code: string,
7
+ public details?: any,
8
+ ) {
9
+ super(message);
10
+ this.name = "McpServerError";
11
+ Object.setPrototypeOf(this, McpServerError.prototype);
12
+ }
13
+ }
14
+
15
+ export class ToolExecutionError extends McpServerError {
16
+ constructor(message: string, details?: any) {
17
+ super(message, "TOOL_EXECUTION_ERROR", details);
18
+ this.name = "ToolExecutionError";
19
+ }
20
+ }
21
+
22
+ export function formatError(error: any): { type: string; text: string } {
23
+ if (error instanceof McpServerError) {
24
+ return {
25
+ type: "text",
26
+ text: JSON.stringify(
27
+ { error: error.code, message: error.message, details: error.details },
28
+ null,
29
+ 2,
30
+ ),
31
+ };
32
+ }
33
+
34
+ if (error instanceof Error) {
35
+ return {
36
+ type: "text",
37
+ text: JSON.stringify(
38
+ { error: "UNKNOWN_ERROR", message: error.message },
39
+ null,
40
+ 2,
41
+ ),
42
+ };
43
+ }
44
+
45
+ return {
46
+ type: "text",
47
+ text: JSON.stringify(
48
+ { error: "UNKNOWN_ERROR", message: String(error) },
49
+ null,
50
+ 2,
51
+ ),
52
+ };
53
+ }
54
+
55
+ export function logError(context: string, error: any): void {
56
+ const entry: Record<string, unknown> = {
57
+ level: "error",
58
+ context,
59
+ message: error instanceof Error ? error.message : String(error),
60
+ timestamp: new Date().toISOString(),
61
+ };
62
+ if (error instanceof Error && error.stack) entry.stack = error.stack;
63
+ console.error(JSON.stringify(entry));
64
+ }
@@ -0,0 +1,28 @@
1
+ // Copyright (c) 2024-2026 Withpica Ltd. All rights reserved.
2
+
3
+ export interface FormattedResult {
4
+ content: Array<{ type: string; text: string }>;
5
+ structuredContent?: Record<string, unknown>;
6
+ }
7
+
8
+ export function formatAsText(data: any): FormattedResult {
9
+ return {
10
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
11
+ structuredContent: data as Record<string, unknown>,
12
+ };
13
+ }
14
+
15
+ export function formatStructuredList<T>(
16
+ items: T[],
17
+ entityName: string,
18
+ metadata?: Record<string, any>,
19
+ ): FormattedResult {
20
+ const count = items.length;
21
+ const summary = `Found ${count} ${entityName}${count !== 1 ? "s" : ""}${
22
+ metadata?.query ? ` matching "${metadata.query}"` : ""
23
+ }.`;
24
+ return {
25
+ content: [{ type: "text", text: summary }],
26
+ structuredContent: { count, items, ...metadata } as Record<string, unknown>,
27
+ };
28
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "Node16",
5
+ "moduleResolution": "Node16",
6
+ "lib": ["ES2022"],
7
+ "outDir": "./dist",
8
+ "rootDir": "./src",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "resolveJsonModule": true,
14
+ "declaration": true,
15
+ "declarationMap": true,
16
+ "sourceMap": true,
17
+ "isolatedModules": true,
18
+ "types": ["node", "jest"]
19
+ },
20
+ "include": ["src/**/*"],
21
+ "exclude": ["node_modules", "dist", "src/__tests__"]
22
+ }