@cyanheads/protein-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.
Files changed (109) hide show
  1. package/AGENTS.md +416 -0
  2. package/CLAUDE.md +416 -0
  3. package/Dockerfile +121 -0
  4. package/LICENSE +201 -0
  5. package/README.md +321 -0
  6. package/changelog/0.1.x/0.1.0.md +21 -0
  7. package/changelog/template.md +127 -0
  8. package/dist/config/server-config.d.ts +27 -0
  9. package/dist/config/server-config.d.ts.map +1 -0
  10. package/dist/config/server-config.js +110 -0
  11. package/dist/config/server-config.js.map +1 -0
  12. package/dist/index.d.ts +9 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +53 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/mcp-server/resources/definitions/af-summary.resource.d.ts +29 -0
  17. package/dist/mcp-server/resources/definitions/af-summary.resource.d.ts.map +1 -0
  18. package/dist/mcp-server/resources/definitions/af-summary.resource.js +61 -0
  19. package/dist/mcp-server/resources/definitions/af-summary.resource.js.map +1 -0
  20. package/dist/mcp-server/resources/definitions/index.d.ts +7 -0
  21. package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
  22. package/dist/mcp-server/resources/definitions/index.js +7 -0
  23. package/dist/mcp-server/resources/definitions/index.js.map +1 -0
  24. package/dist/mcp-server/resources/definitions/pdb-summary.resource.d.ts +31 -0
  25. package/dist/mcp-server/resources/definitions/pdb-summary.resource.d.ts.map +1 -0
  26. package/dist/mcp-server/resources/definitions/pdb-summary.resource.js +68 -0
  27. package/dist/mcp-server/resources/definitions/pdb-summary.resource.js.map +1 -0
  28. package/dist/mcp-server/tools/definitions/_schemas.d.ts +31 -0
  29. package/dist/mcp-server/tools/definitions/_schemas.d.ts.map +1 -0
  30. package/dist/mcp-server/tools/definitions/_schemas.js +82 -0
  31. package/dist/mcp-server/tools/definitions/_schemas.js.map +1 -0
  32. package/dist/mcp-server/tools/definitions/analyze-collection.tool.d.ts +61 -0
  33. package/dist/mcp-server/tools/definitions/analyze-collection.tool.d.ts.map +1 -0
  34. package/dist/mcp-server/tools/definitions/analyze-collection.tool.js +115 -0
  35. package/dist/mcp-server/tools/definitions/analyze-collection.tool.js.map +1 -0
  36. package/dist/mcp-server/tools/definitions/compare-structures.tool.d.ts +49 -0
  37. package/dist/mcp-server/tools/definitions/compare-structures.tool.d.ts.map +1 -0
  38. package/dist/mcp-server/tools/definitions/compare-structures.tool.js +168 -0
  39. package/dist/mcp-server/tools/definitions/compare-structures.tool.js.map +1 -0
  40. package/dist/mcp-server/tools/definitions/find-similar.tool.d.ts +67 -0
  41. package/dist/mcp-server/tools/definitions/find-similar.tool.d.ts.map +1 -0
  42. package/dist/mcp-server/tools/definitions/find-similar.tool.js +274 -0
  43. package/dist/mcp-server/tools/definitions/find-similar.tool.js.map +1 -0
  44. package/dist/mcp-server/tools/definitions/get-annotations.tool.d.ts +58 -0
  45. package/dist/mcp-server/tools/definitions/get-annotations.tool.d.ts.map +1 -0
  46. package/dist/mcp-server/tools/definitions/get-annotations.tool.js +180 -0
  47. package/dist/mcp-server/tools/definitions/get-annotations.tool.js.map +1 -0
  48. package/dist/mcp-server/tools/definitions/get-structure.tool.d.ts +78 -0
  49. package/dist/mcp-server/tools/definitions/get-structure.tool.d.ts.map +1 -0
  50. package/dist/mcp-server/tools/definitions/get-structure.tool.js +365 -0
  51. package/dist/mcp-server/tools/definitions/get-structure.tool.js.map +1 -0
  52. package/dist/mcp-server/tools/definitions/index.d.ts +12 -0
  53. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
  54. package/dist/mcp-server/tools/definitions/index.js +12 -0
  55. package/dist/mcp-server/tools/definitions/index.js.map +1 -0
  56. package/dist/mcp-server/tools/definitions/search-structures.tool.d.ts +71 -0
  57. package/dist/mcp-server/tools/definitions/search-structures.tool.d.ts.map +1 -0
  58. package/dist/mcp-server/tools/definitions/search-structures.tool.js +216 -0
  59. package/dist/mcp-server/tools/definitions/search-structures.tool.js.map +1 -0
  60. package/dist/mcp-server/tools/definitions/track-ligands.tool.d.ts +59 -0
  61. package/dist/mcp-server/tools/definitions/track-ligands.tool.d.ts.map +1 -0
  62. package/dist/mcp-server/tools/definitions/track-ligands.tool.js +195 -0
  63. package/dist/mcp-server/tools/definitions/track-ligands.tool.js.map +1 -0
  64. package/dist/services/alignment/alignment-service.d.ts +56 -0
  65. package/dist/services/alignment/alignment-service.d.ts.map +1 -0
  66. package/dist/services/alignment/alignment-service.js +129 -0
  67. package/dist/services/alignment/alignment-service.js.map +1 -0
  68. package/dist/services/alphafold/alphafold-service.d.ts +57 -0
  69. package/dist/services/alphafold/alphafold-service.d.ts.map +1 -0
  70. package/dist/services/alphafold/alphafold-service.js +84 -0
  71. package/dist/services/alphafold/alphafold-service.js.map +1 -0
  72. package/dist/services/beacons/beacons-service.d.ts +52 -0
  73. package/dist/services/beacons/beacons-service.d.ts.map +1 -0
  74. package/dist/services/beacons/beacons-service.js +63 -0
  75. package/dist/services/beacons/beacons-service.js.map +1 -0
  76. package/dist/services/foldseek/foldseek-service.d.ts +71 -0
  77. package/dist/services/foldseek/foldseek-service.d.ts.map +1 -0
  78. package/dist/services/foldseek/foldseek-service.js +131 -0
  79. package/dist/services/foldseek/foldseek-service.js.map +1 -0
  80. package/dist/services/rcsb/facets.d.ts +50 -0
  81. package/dist/services/rcsb/facets.d.ts.map +1 -0
  82. package/dist/services/rcsb/facets.js +59 -0
  83. package/dist/services/rcsb/facets.js.map +1 -0
  84. package/dist/services/rcsb/rcsb-service.d.ts +81 -0
  85. package/dist/services/rcsb/rcsb-service.d.ts.map +1 -0
  86. package/dist/services/rcsb/rcsb-service.js +473 -0
  87. package/dist/services/rcsb/rcsb-service.js.map +1 -0
  88. package/dist/services/rcsb/types.d.ts +150 -0
  89. package/dist/services/rcsb/types.d.ts.map +1 -0
  90. package/dist/services/rcsb/types.js +8 -0
  91. package/dist/services/rcsb/types.js.map +1 -0
  92. package/dist/services/shared/async.d.ts +41 -0
  93. package/dist/services/shared/async.d.ts.map +1 -0
  94. package/dist/services/shared/async.js +64 -0
  95. package/dist/services/shared/async.js.map +1 -0
  96. package/dist/services/shared/http.d.ts +54 -0
  97. package/dist/services/shared/http.d.ts.map +1 -0
  98. package/dist/services/shared/http.js +115 -0
  99. package/dist/services/shared/http.js.map +1 -0
  100. package/dist/services/shared/identifiers.d.ts +12 -0
  101. package/dist/services/shared/identifiers.d.ts.map +1 -0
  102. package/dist/services/shared/identifiers.js +23 -0
  103. package/dist/services/shared/identifiers.js.map +1 -0
  104. package/dist/services/uniprot/uniprot-service.d.ts +65 -0
  105. package/dist/services/uniprot/uniprot-service.d.ts.map +1 -0
  106. package/dist/services/uniprot/uniprot-service.js +146 -0
  107. package/dist/services/uniprot/uniprot-service.js.map +1 -0
  108. package/package.json +106 -0
  109. package/server.json +99 -0
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @fileoverview protein_analyze_collection — profile the PDB into distributions
3
+ * and trends (counts by method / organism / polymer type, resolution histograms,
4
+ * release-year timelines, and multidimensional cross-tabs) over an optional
5
+ * scoping query. Backed by RCSB's server-side facet engine: one call, compact
6
+ * buckets, no row pull, no SQL canvas. Fully portable.
7
+ * @module mcp-server/tools/definitions/analyze-collection.tool
8
+ */
9
+ import { z } from '@cyanheads/mcp-ts-core';
10
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
11
+ export declare const analyzeCollection: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
12
+ group_by: z.ZodArray<z.ZodEnum<{
13
+ method: "method";
14
+ organism: "organism";
15
+ resolution: "resolution";
16
+ molecular_weight: "molecular_weight";
17
+ polymer_type: "polymer_type";
18
+ release_year: "release_year";
19
+ }>>;
20
+ query: z.ZodOptional<z.ZodString>;
21
+ organism: z.ZodOptional<z.ZodString>;
22
+ method: z.ZodOptional<z.ZodString>;
23
+ max_resolution: z.ZodOptional<z.ZodNumber>;
24
+ content_type: z.ZodDefault<z.ZodEnum<{
25
+ experimental: "experimental";
26
+ predicted: "predicted";
27
+ all: "all";
28
+ }>>;
29
+ interval: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodEnum<{
30
+ year: "year";
31
+ month: "month";
32
+ quarter: "quarter";
33
+ }>]>>;
34
+ bucket_limit: z.ZodOptional<z.ZodNumber>;
35
+ }, z.core.$strip>, z.ZodObject<{
36
+ total: z.ZodNumber;
37
+ facets: z.ZodArray<z.ZodObject<{
38
+ dimension: z.ZodString;
39
+ buckets: z.ZodArray<z.ZodObject<{
40
+ label: z.ZodString;
41
+ count: z.ZodNumber;
42
+ children: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
+ dimension: z.ZodString;
44
+ buckets: z.ZodArray<z.ZodObject<{
45
+ label: z.ZodString;
46
+ count: z.ZodNumber;
47
+ }, z.core.$strip>>;
48
+ }, z.core.$strip>>>;
49
+ }, z.core.$strip>>;
50
+ truncated: z.ZodOptional<z.ZodBoolean>;
51
+ }, z.core.$strip>>;
52
+ }, z.core.$strip>, readonly [{
53
+ readonly reason: "unknown_dimension";
54
+ readonly code: JsonRpcErrorCode.InvalidParams;
55
+ readonly when: "A group_by value is outside the supported dimension set.";
56
+ readonly recovery: "Use a supported dimension: method, organism, polymer_type, resolution, release_year, or molecular_weight.";
57
+ }], {
58
+ readonly scope: z.ZodOptional<z.ZodString>;
59
+ readonly notice: z.ZodOptional<z.ZodString>;
60
+ }>;
61
+ //# sourceMappingURL=analyze-collection.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-collection.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/analyze-collection.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsH5B,CAAC"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * @fileoverview protein_analyze_collection — profile the PDB into distributions
3
+ * and trends (counts by method / organism / polymer type, resolution histograms,
4
+ * release-year timelines, and multidimensional cross-tabs) over an optional
5
+ * scoping query. Backed by RCSB's server-side facet engine: one call, compact
6
+ * buckets, no row pull, no SQL canvas. Fully portable.
7
+ * @module mcp-server/tools/definitions/analyze-collection.tool
8
+ */
9
+ import { tool, z } from '@cyanheads/mcp-ts-core';
10
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
11
+ import { getServerConfig } from '../../../config/server-config.js';
12
+ import { buildFacetSpec, FACET_DIMENSION_NAMES } from '../../../services/rcsb/facets.js';
13
+ import { getRcsbService } from '../../../services/rcsb/rcsb-service.js';
14
+ import { facetDimensionSchema, renderFacets, toFacetOutput } from './_schemas.js';
15
+ export const analyzeCollection = tool('protein_analyze_collection', {
16
+ title: 'protein-mcp-server: analyze collection',
17
+ description: 'Profile the PDB into distributions and trends over an optional scoping query: counts by method, ' +
18
+ 'organism, or polymer composition; resolution and molecular-weight histograms; release-year timelines; ' +
19
+ 'and multidimensional cross-tabs (e.g. method × release_year). Aggregation runs server-side at RCSB — ' +
20
+ 'one call returns compact buckets, no row pull. Pass one group_by dimension for a single breakdown, or ' +
21
+ 'two for a cross-tab (the first nests the second).',
22
+ annotations: { readOnlyHint: true, openWorldHint: true },
23
+ errors: [
24
+ {
25
+ reason: 'unknown_dimension',
26
+ code: JsonRpcErrorCode.InvalidParams,
27
+ when: 'A group_by value is outside the supported dimension set.',
28
+ recovery: 'Use a supported dimension: method, organism, polymer_type, resolution, release_year, or molecular_weight.',
29
+ },
30
+ ],
31
+ input: z.object({
32
+ group_by: z
33
+ .array(z.enum(FACET_DIMENSION_NAMES))
34
+ .min(1)
35
+ .max(2)
36
+ .describe('1 dimension for a breakdown, or 2 for a cross-tab (the first nests the second).'),
37
+ query: z
38
+ .string()
39
+ .optional()
40
+ .describe('Optional free-text scope (e.g. "kinase"); omit to profile the whole PDB.'),
41
+ organism: z.string().optional().describe('Optional source-organism scope.'),
42
+ method: z.string().optional().describe('Optional experimental-method scope.'),
43
+ max_resolution: z
44
+ .number()
45
+ .positive()
46
+ .optional()
47
+ .describe('Optional maximum-resolution scope (Å).'),
48
+ content_type: z
49
+ .enum(['experimental', 'predicted', 'all'])
50
+ .default('experimental')
51
+ .describe('Which structure universe to profile. Default experimental.'),
52
+ interval: z
53
+ .union([
54
+ z
55
+ .number()
56
+ .positive()
57
+ .describe('Numeric bin width for a value histogram (e.g. resolution Å).'),
58
+ z.enum(['year', 'month', 'quarter']).describe('Period granularity for a date histogram.'),
59
+ ])
60
+ .optional()
61
+ .describe('Bin width for a histogram dimension (number) or period for a date histogram (year/month/quarter).'),
62
+ bucket_limit: z
63
+ .number()
64
+ .int()
65
+ .min(1)
66
+ .max(500)
67
+ .optional()
68
+ .describe('Max buckets per dimension. Defaults to the server PROTEIN_FACET_BUCKET_CAP.'),
69
+ }),
70
+ output: z.object({
71
+ total: z.number().describe('Total entries in the scoped collection.'),
72
+ facets: z.array(facetDimensionSchema).describe('The requested breakdown(s).'),
73
+ }),
74
+ enrichment: {
75
+ scope: z.string().optional().describe('Echoed scope description for follow-up calls.'),
76
+ notice: z.string().optional().describe('Advisory note (e.g. bucket truncation, empty scope).'),
77
+ },
78
+ async handler(input, ctx) {
79
+ const cfg = getServerConfig();
80
+ const rcsb = getRcsbService();
81
+ const cap = input.bucket_limit ?? cfg.facetBucketCap;
82
+ const contentType = input.content_type === 'all'
83
+ ? undefined
84
+ : input.content_type === 'predicted'
85
+ ? 'computational'
86
+ : 'experimental';
87
+ const [primary, secondary] = input.group_by;
88
+ if (!primary)
89
+ throw ctx.fail('unknown_dimension', 'group_by requires at least one dimension.');
90
+ const spec = buildFacetSpec(primary, input.interval, secondary);
91
+ const { total, facets } = await rcsb.analyzeFacets({
92
+ ...(input.query ? { text: input.query } : {}),
93
+ ...(input.organism ? { organism: input.organism } : {}),
94
+ ...(input.method ? { method: input.method } : {}),
95
+ ...(typeof input.max_resolution === 'number'
96
+ ? { maxResolution: input.max_resolution }
97
+ : {}),
98
+ ...(contentType ? { contentType } : {}),
99
+ }, [spec], ctx);
100
+ const out = facets.map((f) => toFacetOutput(f, cap));
101
+ if (out.some((f) => f.truncated)) {
102
+ ctx.enrich.notice(`One or more dimensions exceeded ${cap} buckets and were capped; scope the query tighter for the long tail.`);
103
+ }
104
+ const scopeBits = [input.query, input.organism, input.method].filter(Boolean);
105
+ if (scopeBits.length > 0)
106
+ ctx.enrich({ scope: scopeBits.join(' · ') });
107
+ return { total, facets: out };
108
+ },
109
+ format: (result) => {
110
+ const lines = [`## Collection profile — ${result.total} entries`];
111
+ lines.push(...renderFacets(result.facets));
112
+ return [{ type: 'text', text: lines.join('\n') }];
113
+ },
114
+ });
115
+ //# sourceMappingURL=analyze-collection.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analyze-collection.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/analyze-collection.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAElF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,4BAA4B,EAAE;IAClE,KAAK,EAAE,wCAAwC;IAC/C,WAAW,EACT,kGAAkG;QAClG,wGAAwG;QACxG,uGAAuG;QACvG,wGAAwG;Q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AK,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9E,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC;YAAE,GAAG,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAEvE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;QACjB,MAAM,KAAK,GAAa,CAAC,2BAA2B,MAAM,CAAC,KAAK,UAAU,CAAC,CAAC;QAC5E,KAAK,CAAC,IAAI,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC3C,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @fileoverview protein_compare_structures — structural alignment of 2–10
3
+ * structures via the RCSB Structural Comparison service. Aligns each structure to
4
+ * a reference (default the first) or computes the full all-pairs matrix, fanning
5
+ * out pairwise async jobs with a concurrency cap and per-pair partial success.
6
+ * @module mcp-server/tools/definitions/compare-structures.tool
7
+ */
8
+ import { z } from '@cyanheads/mcp-ts-core';
9
+ export declare const compareStructures: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
10
+ structures: z.ZodArray<z.ZodObject<{
11
+ pdb_id: z.ZodString;
12
+ chain: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$strip>>;
14
+ reference: z.ZodDefault<z.ZodEnum<{
15
+ first: "first";
16
+ all_pairs: "all_pairs";
17
+ }>>;
18
+ method: z.ZodDefault<z.ZodEnum<{
19
+ "tm-align": "tm-align";
20
+ "fatcat-rigid": "fatcat-rigid";
21
+ "fatcat-flexible": "fatcat-flexible";
22
+ }>>;
23
+ timeout_s: z.ZodOptional<z.ZodNumber>;
24
+ }, z.core.$strip>, z.ZodObject<{
25
+ method: z.ZodString;
26
+ reference: z.ZodEnum<{
27
+ first: "first";
28
+ all_pairs: "all_pairs";
29
+ }>;
30
+ pairs: z.ZodArray<z.ZodObject<{
31
+ a: z.ZodString;
32
+ b: z.ZodString;
33
+ status: z.ZodEnum<{
34
+ complete: "complete";
35
+ computing: "computing";
36
+ failed: "failed";
37
+ }>;
38
+ tmScore: z.ZodOptional<z.ZodNumber>;
39
+ rmsd: z.ZodOptional<z.ZodNumber>;
40
+ alignedResidues: z.ZodOptional<z.ZodNumber>;
41
+ uuid: z.ZodOptional<z.ZodString>;
42
+ error: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>>;
44
+ }, z.core.$strip>, undefined, {
45
+ readonly pairsTotal: z.ZodNumber;
46
+ readonly computing: z.ZodNumber;
47
+ readonly notice: z.ZodOptional<z.ZodString>;
48
+ }>;
49
+ //# sourceMappingURL=compare-structures.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-structures.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/compare-structures.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAmEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6F5B,CAAC"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * @fileoverview protein_compare_structures — structural alignment of 2–10
3
+ * structures via the RCSB Structural Comparison service. Aligns each structure to
4
+ * a reference (default the first) or computes the full all-pairs matrix, fanning
5
+ * out pairwise async jobs with a concurrency cap and per-pair partial success.
6
+ * @module mcp-server/tools/definitions/compare-structures.tool
7
+ */
8
+ import { tool, z } from '@cyanheads/mcp-ts-core';
9
+ import { getServerConfig } from '../../../config/server-config.js';
10
+ import { getAlignmentService } from '../../../services/alignment/alignment-service.js';
11
+ import { mapWithConcurrency } from '../../../services/shared/async.js';
12
+ const inputSchema = z.object({
13
+ structures: z
14
+ .array(z
15
+ .object({
16
+ pdb_id: z.string().min(1).describe('PDB entry ID.'),
17
+ chain: z
18
+ .string()
19
+ .optional()
20
+ .describe('Chain (label_asym_id) to restrict the alignment to a single chain.'),
21
+ })
22
+ .describe('A structure to align, by PDB entry ID with optional chain.'))
23
+ .min(2)
24
+ .max(10)
25
+ .describe('The 2–10 structures to compare.'),
26
+ reference: z
27
+ .enum(['first', 'all_pairs'])
28
+ .default('first')
29
+ .describe('Align all to the first structure, or compute the full pairwise matrix.'),
30
+ method: z
31
+ .enum(['tm-align', 'fatcat-rigid', 'fatcat-flexible'])
32
+ .default('tm-align')
33
+ .describe('Alignment algorithm: tm-align, fatcat-rigid, or fatcat-flexible.'),
34
+ timeout_s: z
35
+ .number()
36
+ .int()
37
+ .min(5)
38
+ .max(120)
39
+ .optional()
40
+ .describe('Poll budget per pair in seconds before returning "computing". Defaults to the server setting.'),
41
+ });
42
+ const outputSchema = z.object({
43
+ method: z.string().describe('Alignment method used.'),
44
+ reference: z.enum(['first', 'all_pairs']).describe('Comparison mode used.'),
45
+ pairs: z
46
+ .array(z
47
+ .object({
48
+ a: z.string().describe('First structure of the pair (entry[.chain]).'),
49
+ b: z.string().describe('Second structure of the pair (entry[.chain]).'),
50
+ status: z.enum(['complete', 'computing', 'failed']).describe('Outcome for this pair.'),
51
+ tmScore: z.number().optional().describe('TM-score (0–1; higher is more similar).'),
52
+ rmsd: z.number().optional().describe('RMSD in Å over aligned residues.'),
53
+ alignedResidues: z.number().optional().describe('Number of aligned residue pairs.'),
54
+ uuid: z
55
+ .string()
56
+ .optional()
57
+ .describe('Alignment job UUID (present for computing/complete pairs).'),
58
+ error: z.string().optional().describe('Failure detail (failed pairs).'),
59
+ })
60
+ .describe('Alignment outcome for one structure pair.'))
61
+ .describe('One row per aligned pair.'),
62
+ });
63
+ export const compareStructures = tool('protein_compare_structures', {
64
+ title: 'protein-mcp-server: compare structures',
65
+ description: 'Structurally align 2–10 structures via the RCSB Structural Comparison service (TM-align / jFATCAT). ' +
66
+ 'reference:"first" aligns every structure to the first; reference:"all_pairs" computes the full pairwise ' +
67
+ 'matrix. Each pair is an independent async alignment job, fanned out with a concurrency cap and per-pair ' +
68
+ 'partial success — a pair still computing when the budget elapses returns status "computing" with its ' +
69
+ 'job UUID (re-call to resume), and a failed pair degrades its row without sinking the others. Returns ' +
70
+ 'TM-score, RMSD, and aligned-residue count per pair.',
71
+ annotations: { readOnlyHint: true, openWorldHint: true },
72
+ input: inputSchema,
73
+ output: outputSchema,
74
+ enrichment: {
75
+ pairsTotal: z.number().describe('Number of pairs compared.'),
76
+ computing: z.number().describe('Number of pairs still computing.'),
77
+ notice: z.string().optional().describe('Advisory note (pending pairs, failures).'),
78
+ },
79
+ async handler(input, ctx) {
80
+ const cfg = getServerConfig();
81
+ const structures = input.structures.slice(0, cfg.maxCompareStructures);
82
+ const timeoutMs = input.timeout_s ? input.timeout_s * 1000 : cfg.asyncPollTimeoutMs;
83
+ const method = input.method;
84
+ const pairs = buildPairs(structures, input.reference);
85
+ const alignment = getAlignmentService();
86
+ const rows = await mapWithConcurrency(pairs, cfg.fanoutConcurrency, async ([a, b]) => {
87
+ const outcome = await alignment.comparePair(toCompare(a), toCompare(b), method, timeoutMs, ctx);
88
+ const base = { a: label(a), b: label(b) };
89
+ if (outcome.status === 'complete') {
90
+ return {
91
+ ...base,
92
+ status: 'complete',
93
+ uuid: outcome.uuid,
94
+ ...(typeof outcome.scores.tmScore === 'number'
95
+ ? { tmScore: outcome.scores.tmScore }
96
+ : {}),
97
+ ...(typeof outcome.scores.rmsd === 'number' ? { rmsd: outcome.scores.rmsd } : {}),
98
+ ...(typeof outcome.scores.alignedResidues === 'number'
99
+ ? { alignedResidues: outcome.scores.alignedResidues }
100
+ : {}),
101
+ };
102
+ }
103
+ if (outcome.status === 'computing') {
104
+ return { ...base, status: 'computing', uuid: outcome.uuid };
105
+ }
106
+ return { ...base, status: 'failed', error: outcome.error };
107
+ });
108
+ const computing = rows.filter((r) => r.status === 'computing').length;
109
+ const failed = rows.filter((r) => r.status === 'failed').length;
110
+ ctx.enrich({ pairsTotal: rows.length, computing });
111
+ if (computing > 0 || failed > 0) {
112
+ ctx.enrich.notice(`${computing} pair(s) still computing${failed > 0 ? `, ${failed} failed` : ''}. ` +
113
+ `Re-call to resume computing pairs (cold alignment jobs typically finish within 30–60 s).`);
114
+ }
115
+ return { method, reference: input.reference, pairs: rows };
116
+ },
117
+ format: (result) => {
118
+ const lines = [`## Structure comparison (${result.method}, ${result.reference})`];
119
+ lines.push('\n| Pair | Status | TM-score | RMSD (Å) | Aligned |');
120
+ lines.push('|---|---|---|---|---|');
121
+ for (const p of result.pairs) {
122
+ const tm = typeof p.tmScore === 'number' ? p.tmScore.toFixed(3) : '—';
123
+ const rmsd = typeof p.rmsd === 'number' ? p.rmsd.toFixed(2) : '—';
124
+ const aligned = typeof p.alignedResidues === 'number' ? String(p.alignedResidues) : '—';
125
+ lines.push(`| ${p.a} ↔ ${p.b} | ${p.status} | ${tm} | ${rmsd} | ${aligned} |`);
126
+ }
127
+ const notes = result.pairs.filter((p) => p.error || p.uuid);
128
+ if (notes.length > 0) {
129
+ lines.push('');
130
+ for (const p of notes) {
131
+ if (p.error)
132
+ lines.push(`- ${p.a} ↔ ${p.b}: ${p.error}`);
133
+ if (p.uuid)
134
+ lines.push(`- ${p.a} ↔ ${p.b}: job ${p.uuid}${p.status === 'computing' ? ' (computing)' : ''}`);
135
+ }
136
+ }
137
+ return [{ type: 'text', text: lines.join('\n') }];
138
+ },
139
+ });
140
+ function buildPairs(structures, reference) {
141
+ const pairs = [];
142
+ if (reference === 'first') {
143
+ const [ref, ...rest] = structures;
144
+ if (ref)
145
+ for (const s of rest)
146
+ pairs.push([ref, s]);
147
+ }
148
+ else {
149
+ for (let i = 0; i < structures.length; i++) {
150
+ const a = structures[i];
151
+ if (!a)
152
+ continue;
153
+ for (let j = i + 1; j < structures.length; j++) {
154
+ const b = structures[j];
155
+ if (b)
156
+ pairs.push([a, b]);
157
+ }
158
+ }
159
+ }
160
+ return pairs;
161
+ }
162
+ function toCompare(s) {
163
+ return { entryId: s.pdb_id, ...(s.chain ? { asymId: s.chain } : {}) };
164
+ }
165
+ function label(s) {
166
+ return s.chain ? `${s.pdb_id.toUpperCase()}.${s.chain}` : s.pdb_id.toUpperCase();
167
+ }
168
+ //# sourceMappingURL=compare-structures.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compare-structures.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/compare-structures.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,UAAU,EAAE,CAAC;SACV,KAAK,CACJ,CAAC;SACE,MAAM,CAAC;QACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;QACnD,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,oEAAoE,CAAC;KAClF,CAAC;SACD,QAAQ,CAAC,4DAA4D,CAAC,CAC1E;SACA,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,CAAC,iCAAiC,CAAC;IAC9C,SAAS,EAAE,CAAC;SACT,IAAI,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;SAC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CAAC;AACf,CAAC;AAED,SAAS,SAAS,CAAC,CAAc;IAC/B,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACxE,CAAC;AAED,SAAS,KAAK,CAAC,CAAc;IAC3B,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;AACnF,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @fileoverview protein_find_similar — find structurally or evolutionarily related
3
+ * proteins. by:sequence runs a synchronous RCSB mmseqs2 search; by:structure runs
4
+ * an async Foldseek search against experimental + predicted databases (submit →
5
+ * poll → bounded timeout, returning "still computing" rather than blocking).
6
+ * @module mcp-server/tools/definitions/find-similar.tool
7
+ */
8
+ import { z } from '@cyanheads/mcp-ts-core';
9
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
10
+ export declare const findSimilar: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
11
+ by: z.ZodEnum<{
12
+ sequence: "sequence";
13
+ structure: "structure";
14
+ }>;
15
+ sequence: z.ZodOptional<z.ZodString>;
16
+ pdb_id: z.ZodOptional<z.ZodString>;
17
+ uniprot: z.ZodOptional<z.ZodString>;
18
+ databases: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ max_evalue: z.ZodOptional<z.ZodNumber>;
20
+ min_identity: z.ZodOptional<z.ZodNumber>;
21
+ limit: z.ZodDefault<z.ZodNumber>;
22
+ }, z.core.$strip>, z.ZodObject<{
23
+ by: z.ZodEnum<{
24
+ sequence: "sequence";
25
+ structure: "structure";
26
+ }>;
27
+ engine: z.ZodString;
28
+ status: z.ZodEnum<{
29
+ complete: "complete";
30
+ computing: "computing";
31
+ }>;
32
+ ticketId: z.ZodOptional<z.ZodString>;
33
+ hits: z.ZodArray<z.ZodObject<{
34
+ id: z.ZodString;
35
+ source: z.ZodEnum<{
36
+ experimental: "experimental";
37
+ predicted: "predicted";
38
+ }>;
39
+ score: z.ZodOptional<z.ZodNumber>;
40
+ evalue: z.ZodOptional<z.ZodNumber>;
41
+ identity: z.ZodOptional<z.ZodNumber>;
42
+ database: z.ZodOptional<z.ZodString>;
43
+ title: z.ZodOptional<z.ZodString>;
44
+ organism: z.ZodOptional<z.ZodString>;
45
+ uniprotAccession: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>, readonly [{
48
+ readonly reason: "missing_query";
49
+ readonly code: JsonRpcErrorCode.InvalidParams;
50
+ readonly when: "None of sequence, pdb_id, or uniprot was provided.";
51
+ readonly recovery: "Provide a raw sequence, a PDB entry ID, or a UniProt accession to search from.";
52
+ }, {
53
+ readonly reason: "no_sequence";
54
+ readonly code: JsonRpcErrorCode.NotFound;
55
+ readonly when: "A sequence could not be resolved from the given PDB ID or UniProt accession.";
56
+ readonly recovery: "Verify the identifier, or pass a raw one-letter sequence directly via the sequence parameter.";
57
+ }, {
58
+ readonly reason: "search_failed";
59
+ readonly code: JsonRpcErrorCode.ServiceUnavailable;
60
+ readonly when: "The Foldseek search service rejected or failed the structure job.";
61
+ readonly retryable: true;
62
+ readonly recovery: "Retry shortly; if it persists, verify the source structure has coordinates via protein_get_structure.";
63
+ }], {
64
+ totalCount: z.ZodOptional<z.ZodNumber>;
65
+ notice: z.ZodOptional<z.ZodString>;
66
+ }>;
67
+ //# sourceMappingURL=find-similar.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-similar.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-similar.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA6B,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAkGjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+DtB,CAAC"}