Skip to content

feat(mcp-chat): added shared libraires and extension points#8370

Open
fjudith wants to merge 34 commits into
backstage:mainfrom
alithya-oss:feat/mcp-chat-backend-v2a
Open

feat(mcp-chat): added shared libraires and extension points#8370
fjudith wants to merge 34 commits into
backstage:mainfrom
alithya-oss:feat/mcp-chat-backend-v2a

Conversation

@fjudith
Copy link
Copy Markdown
Contributor

@fjudith fjudith commented Mar 30, 2026

Hey, I just made a Pull Request!

Starts the Implementation of #7976 following the adr011 and (superseeds #8196).

  • add the isomorphic package for shared types and future support for translations and permissions
  • add the node library to share the extension point between the backend and backend module
Current > Phase 1 < Phase 2
current phase 1 phase 2

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

@backstage-goalie
Copy link
Copy Markdown
Contributor

backstage-goalie Bot commented Mar 30, 2026

Unexpected Changesets

The following changeset(s) reference packages that have not been changed in this PR:

  • /home/runner/work/community-plugins/community-plugins/workspaces/tech-insights/.changeset/cyan-ducks-mate.md: @backstage-community/plugin-tech-insights-maturity

Note that only changes that affect the published package require changesets, for example changes to tests and storybook stories do not require changesets.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/plugin-mcp-chat-backend workspaces/mcp-chat/plugins/mcp-chat-backend minor v0.11.0
@backstage-community/plugin-mcp-chat-common workspaces/mcp-chat/plugins/mcp-chat-common minor v0.1.0
@backstage-community/plugin-mcp-chat-node workspaces/mcp-chat/plugins/mcp-chat-node minor v0.1.0
@backstage-community/plugin-mcp-chat workspaces/mcp-chat/plugins/mcp-chat minor v0.7.1

@fjudith fjudith force-pushed the feat/mcp-chat-backend-v2a branch from f6bd506 to 23e0387 Compare March 30, 2026 00:55
@fjudith fjudith force-pushed the feat/mcp-chat-backend-v2a branch 2 times, most recently from fdf8074 to 783ad0e Compare April 4, 2026 00:11
@fjudith
Copy link
Copy Markdown
Contributor Author

fjudith commented Apr 5, 2026

@Lucifergene the PR is ready for review

@Lucifergene
Copy link
Copy Markdown
Contributor

This is a great work @fjudith
Need some more time to go through, but will get back soon.

fjudith added 15 commits May 6, 2026 21:19
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
…ckage

Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
… package

Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
see: comments backstage#8196
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
fjudith added 3 commits May 8, 2026 21:11
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
@backstage-service backstage-service added the workspace/tech-insights Used to tag tech-insights workspace issues and pull requests label May 9, 2026
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Copilot AI review requested due to automatic review settings May 9, 2026 01:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 54 out of 56 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

workspaces/mcp-chat/plugins/mcp-chat-common/src/types.ts:654

  • ConversationRow is described as an internal DB row shape, but it’s tagged @public which exposes it as part of the common package public API (and locks its schema for consumers). Either revert the tag to @internal (preferred for DB row types), or update the documentation to reflect that it’s intended for external consumption and stability guarantees apply.

Comment thread workspaces/tech-insights/.changeset/cyan-ducks-mate.md
Comment thread workspaces/mcp-chat/plugins/mcp-chat/package.json
Comment thread workspaces/mcp-chat/plugins/mcp-chat-common/package.json
Comment thread workspaces/mcp-chat/plugins/mcp-chat-node/package.json
Comment thread workspaces/mcp-chat/plugins/mcp-chat-node/src/extensions.ts
Comment thread workspaces/mcp-chat/plugins/mcp-chat-backend/src/index.ts
Comment thread workspaces/mcp-chat/plugins/mcp-chat-backend/package.json
Comment thread workspaces/mcp-chat/.changeset/sixty-sides-yell.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Florian JUDITH <florian.judith.b@gmail.com>
Copilot AI review requested due to automatic review settings May 9, 2026 01:58
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI review requested due to automatic review settings May 9, 2026 02:31
fjudith added 3 commits May 8, 2026 22:39
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

fjudith added 3 commits May 8, 2026 22:53
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Signed-off-by: Florian JUDITH <florian.judith@alithya.com>
Copilot AI review requested due to automatic review settings May 11, 2026 00:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 54 out of 56 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (2)

workspaces/mcp-chat/plugins/mcp-chat-backend/src/services/MCPClientServiceImpl.ts:95

  • MCPClientServiceImpl initializes the LLM provider in the constructor (this.llmProvider = this.initializeLLMProvider();). Because provider modules register via the extension point during backend initialization, there’s no guarantee the extension-point providers have been registered before this constructor runs, which can cause the built-in factory path to be taken (or even throw) and the extension provider to be ignored for the lifetime of the service. Consider deferring LLM provider resolution until after initialization (e.g., lazily on first use), or wiring initialization so the plugin waits for provider registration before constructing MCPClientServiceImpl.
  constructor(options: Options) {
    this.logger = options.logger;
    this.config = options.config;
    this.extensionProviders = options.extensionProviders ?? new Map();
    this.toolCallTimeout =
      this.config.getOptionalNumber('mcpChat.toolCallTimeout') ??
      DEFAULT_MCP_TOOL_CALL_TIMEOUT_MS;
    this.llmProvider = this.initializeLLMProvider();
    this.mcpServers = this.initializeMCPServers();
    this.systemPrompt =
      this.config.getOptionalString('mcpChat.systemPrompt') ||
      "You are a helpful assistant. When using tools, provide a clear, readable summary of the results rather than showing raw data. Focus on answering the user's question with the information gathered.";
  }

workspaces/mcp-chat/plugins/mcp-chat-common/src/types.ts:654

  • The doc comment says ConversationRow is “Used internally for database operations”, but the TSDoc tag was changed to @public. If this type is meant to remain internal implementation detail, it should stay @internal (or be excluded from the public barrel exports). If it’s intentionally public now, please update the comment to reflect that it’s part of the supported API surface.

Comment on lines 97 to +111
private initializeLLMProvider(): LLMProvider {
try {
const providerConfig = getConfig(this.config);

// Check if an extension-point provider was registered for this type
const extensionProvider = this.extensionProviders.get(
providerConfig.type,
);
if (extensionProvider) {
this.logger.info(
`Using extension-point LLM Provider: ${providerConfig.type}, Model: ${providerConfig.model}`,
);
return extensionProvider;
}

Comment on lines +101 to +110
// Check if an extension-point provider was registered for this type
const extensionProvider = this.extensionProviders.get(
providerConfig.type,
);
if (extensionProvider) {
this.logger.info(
`Using extension-point LLM Provider: ${providerConfig.type}, Model: ${providerConfig.model}`,
);
return extensionProvider;
}
Comment on lines +40 to +51
const providers = new Map<string, LLMProvider>();

env.registerExtensionPoint(llmProviderExtensionPoint, {
registerProvider(type, provider) {
if (providers.has(type)) {
// As documented in the interface: replace and warn
console.warn(
`LLM provider with type '${type}' is already registered and will be replaced`,
);
}
providers.set(type, provider);
},
Comment on lines +57 to +60
/** Maximum number of tokens to generate (default: 1000 for OpenAI-compatible, 4096 for Claude, 8192 for Gemini) */
maxTokens?: number;
/** Temperature for response randomness, between 0 and 1 (default: 0.7) */
temperature?: number;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workspace/mcp-chat workspace/tech-insights Used to tag tech-insights workspace issues and pull requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants