Skip to content

Fix/mcp type mappings - #299

Closed
Khush7Chauhan wants to merge 1 commit into
accordproject:mainfrom
Khush7Chauhan:fix/mcp-type-mappings
Closed

Khush7Chauhan wants to merge 1 commit into
accordproject:mainfrom
Khush7Chauhan:fix/mcp-type-mappings

Conversation

@Khush7Chauhan

@Khush7Chauhan Khush7Chauhan commented Nov 15, 2026 •

Copy link
Copy Markdown

Follow-up to #282

Narrowed per review (#299 (review)).

What changed

  • server/tsconfig.json: "ignoreDeprecations": "6.0", with an inline comment
    naming the two deprecations it suppresses and their replacements.

Why there is no source change

#289 (f8df897) rewrote resource discovery. listResourcesForDiscovery()
already builds the MCP Resource explicitly and omits a null description:

...(template.description == null ? {} : { description: template.description }),

server/handlers/mcp.test.ts already fixtures description: null and asserts
the field is omitted. The ?? undefined blocks and the regression test from
the original follow-up were therefore superseded and have been dropped.

Compiler output

Only description ever produced a type error, and only with strictNullChecks
enabled (this tsconfig does not enable it):

handlers/mcp.ts(497,13): error TS2322: Type '() => Promise<{ resources: {
  ... description: string | null; ... }[]; }>' is not assignable to type
  'ListResourcesCallback'.
    Types of property 'description' are incompatible.
      Type 'string | null' is not assignable to type 'string | undefined'.

There is no corresponding error for template, templateHash, state,
agreementParties, signatures, historyEntries, attachments,
references, or metadata — they are not declared on the MCP Resource
type, so the extra coalescing was defensive, not a fix.

Deprecations being suppressed

Error Deprecated option Replacement
TS5107 "moduleResolution": "node" (node10) "node16" / "nodenext"
TS5101 "baseUrl" paths entries with no base directory

Both stop working in TypeScript 7.0. The suppression is scoped to the 6.x
window and should be removed once those options are migrated.

CI caveat

The repository pins TypeScript 5.8.3, which rejects the value:

tsconfig.json(14,29): error TS5103: Invalid value for '--ignoreDeprecations'.

The flag is valid from TypeScript 6. Verified clean on 6.0.3 with
"strict": false. Needs a decision: fold the TypeScript 6 bump into this PR,
or land the bump separately and rebase this on top of it.

Copilot AI balanced review requested due to automatic review settings November 15, 2026 17:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@mira-accord-project

Copy link
Copy Markdown

Thank you for this follow-up, and for the regression test covering the null template description. The change restores the ?? undefined mappings in the MCP resource callbacks and the ignoreDeprecations setting in server/tsconfig.json, as requested in #282. The CI runs are waiting for a maintainer to approve them, which is standard for first-time contributions. Niall Roche, who maintains this repository, has been asked to review the PR, and you will hear back in the PR thread.


Posted automatically by Mira, an Accord Project agent. A maintainer will follow up; they make the decisions on this.

@JayDS22 JayDS22 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partially right, but the compiler-error ask from the #282 split is still open.

Correct and justified: description coalescing. The MCP SDK Resource type declares description?: string | undefined; the Postgres column is string | null. The spread of t into the Resource literal creates a real type mismatch on that one field. The new regression test ("does not expose a null template description in listResources") pins the fix. Good.

Not justified by the compiler, as far as I can tell: the other coalesced fields. template, templateHash, state, agreementParties, signatures, historyEntries, attachments, references, metadata are APAP extensions that ride along on ...a; they are not declared on the MCP SDK's Resource interface. If TypeScript was flagging them, I would expect a specific error citing Resource. If it was not, these ?? undefined mappings are defensive but do not fix a real type error. Could you paste the exact tsc --noEmit output that shows which fields failed? That was the specific ask from the #282 split, and it is still what would settle whether the broader coalescing is needed or just noise.

ignoreDeprecations: "6.0" still needs the specific deprecation named. The flag silences a warning rather than fixing a cause. Without naming the deprecation this PR is suppressing, a future compiler upgrade will carry the suppression forward blindly. The commit comment on the tsconfig line (or the PR body) should name the deprecated option and the replacement path.

Suggest: narrow the coalescing to just description for now (unless the compiler output shows otherwise), and document the ignoreDeprecations reason inline. I would approve the narrowed version on sight.

@github-actions github-actions Bot added the maintainer-engaged A maintainer has commented or reviewed this item label Nov 18, 2026
…ppresses

The flag was added without saying which deprecation it silences. It
suppresses two TypeScript 6.0 deprecations:

- TS5107: `moduleResolution: "node"` (node10), replaced by `"node16"` or
  `"nodenext"`
- TS5101: `baseUrl`, replaced by `paths` entries that do not need a base
  directory

Both stop working in TypeScript 7.0, so the suppression is scoped to the
6.x window and should be removed once those options are migrated.

No source change is needed for the null-coalescing half of the follow-up:
the resource discovery rewrite in accordproject#289 already omits a null template
description when it builds the MCP Resource, and mcp.test.ts fixtures a
null description to pin it.

Signed-off-by: khush chauhan <khushchauhan2006@gmail.com>
@Khush7Chauhan

Copy link
Copy Markdown
Author

Narrowed to tsconfig-only. The description coalescing and its test were superseded by #289, which already omits a null description in listResourcesForDiscovery() and covers it in mcp.test.ts.

For the record, you were right on the other fields: no compiler error ever cited them — only description (TS2322, and only under --strictNullChecks).

ignoreDeprecations is now documented inline: TS5107 (moduleResolution: "node" → "node16"/"nodenext") and TS5101 (baseUrl → paths), both gone in TS 7.

One ask: the flag is only valid from TypeScript 6, and the repo pins 5.8.3, so tsc fails with TS5103: Invalid value for '--ignoreDeprecations' and four CI jobs are red. Fold the 6.0.3 bump (plus "strict": false) in here, or land it separately?

@JayDS22

JayDS22 commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Keep #299 narrow and defer. ignoreDeprecations: "6.0" is rejected by tsc@5.8.3 (the pinned version), so merging as-is turns four CI jobs red for everyone. The flag only becomes correct AFTER a TypeScript 6 bump lands. Bundling the bump plus strict: false into this PR trades a scoped doc clarification for a cross-cutting compiler-and-type-system change; strict: false also reverts the strict-null guarantee your own description finding depends on.

Suggest: close #299, reopen the ignoreDeprecations + inline-doc hunk as part of the TS 6.0 bump PR when that lands. Keep strict: false out regardless; the typed-error migration (services/errors.ts) relies on strict-null across the handlers that are still being migrated.

@Khush7Chauhan

Copy link
Copy Markdown
Author

Understood — I'll close this and keep the ignoreDeprecations + inline-doc hunk for the TypeScript 6 bump PR, without strict: false. Thanks for checking the pinned tsc version and for flagging that the typed-error migration depends on strict-null; I'll leave the compiler settings alone until the bump lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/kind:bugfix maintainer-engaged A maintainer has commented or reviewed this item

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants