-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Agent Builder] MCP connector #240893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ppisljar
wants to merge
27
commits into
elastic:main
Choose a base branch
from
ppisljar:agentbuilder/mcp_connector
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,904
−38
Open
[Agent Builder] MCP connector #240893
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e47b0f4
[Inference] POC: MCP Connector
dgieselaar 5a40df2
Refactoring
dgieselaar ffa9725
improve auth...
ppisljar c91f355
agent builder integration
ppisljar 1db7606
Auth UI
ppisljar c132390
cleanup
ppisljar d20c7cd
caching
ppisljar b1f981d
cleanup
ppisljar 47d0875
[CI] Auto-commit changed files from 'node scripts/lint_packages --fix'
kibanamachine e58b363
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine 796f39a
[CI] Auto-commit changed files from 'node scripts/generate codeowners'
kibanamachine 1c2e3d7
[CI] Auto-commit changed files from 'node scripts/eslint_all_files --…
kibanamachine 3cf945f
ts fix
ppisljar 3f5e5a5
ts fix
ppisljar 00e083d
remove ai infra changes
ppisljar 4316bfb
Merge branch 'main' into agentbuilder/mcp_connector
ppisljar 6d26853
fix translations
ppisljar e3ac428
pr review feedback
ppisljar 31cb147
Merge branch 'main' into agentbuilder/mcp_connector
ppisljar 02deb5b
...
ppisljar 64b6561
removing test connection button
ppisljar 6383a37
Changes from node scripts/lint_ts_projects --fix
kibanamachine fd00f66
fix tests
ppisljar 47ac13f
Merge remote-tracking branch 'origin/agentbuilder/mcp_connector' into…
ppisljar aa77812
Changes from node scripts/lint_ts_projects --fix
kibanamachine 98395f5
view tool
ppisljar b8934e4
Merge branch 'main' into agentbuilder/mcp_connector
ppisljar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ target | |
| .jruby | ||
| .idea | ||
| .claude | ||
| claude.md | ||
| .cursor | ||
| .windsurf | ||
| *.iml | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
x-pack/platform/packages/shared/kbn-mcp-connector-common/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # @kbn/mcp-connector-common | ||
|
|
||
| Empty package generated by @kbn/generate | ||
60 changes: 60 additions & 0 deletions
60
x-pack/platform/packages/shared/kbn-mcp-connector-common/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| export type { | ||
| MCPConnectorConfig, | ||
| MCPConnectorHTTPServiceConfig, | ||
| MCPConnectorAuthType, | ||
| MCPConnectorSecrets, | ||
| MCPConnectorSecretsNone, | ||
| MCPConnectorSecretsBearer, | ||
| MCPConnectorSecretsApiKey, | ||
| MCPConnectorSecretsBasic, | ||
| MCPConnectorSecretsCustomHeaders, | ||
| MCPConnectorSubActionType, | ||
| MCPCallToolParams, | ||
| MCPListToolsParams, | ||
| MCPExecutorParams, | ||
| } from './src/connector'; | ||
|
|
||
| export { | ||
| MCP_CONNECTOR_SUB_ACTION_TYPE_CALL_TOOL, | ||
| MCP_CONNECTOR_SUB_ACTION_TYPE_LIST_TOOLS, | ||
| } from './src/connector'; | ||
|
|
||
| export type { | ||
| CallToolRequest, | ||
| CallToolResponse, | ||
| Tool, | ||
| ToolProviderMetadata, | ||
| ListToolsResponse, | ||
| ContentPart, | ||
| TextPart, | ||
| } from './src/client'; | ||
|
|
||
| export { MCP_CONNECTOR_TYPE_ID, MCP_CONNECTOR_TITLE } from './src/constants'; | ||
|
|
||
| export { | ||
| MCP_NAMESPACE_PREFIX, | ||
| isMcpToolId, | ||
| createMcpToolId, | ||
| parseMcpToolId, | ||
| } from './src/namespaces'; | ||
|
|
||
| export { createProviderMetadata } from './src/provider_metadata'; | ||
|
|
||
| export { | ||
| MCPConnectorConfigSchema, | ||
| MCPConnectorHTTPServiceConfigSchema, | ||
| MCPConnectorSecretsSchema, | ||
| MCPConnectorSecretsNoneSchema, | ||
| MCPConnectorSecretsBearerSchema, | ||
| MCPConnectorSecretsApiKeySchema, | ||
| MCPConnectorSecretsBasicSchema, | ||
| MCPConnectorSecretsCustomHeadersSchema, | ||
| MCPExecutorParamsSchema, | ||
| } from './src/schema'; |
12 changes: 12 additions & 0 deletions
12
x-pack/platform/packages/shared/kbn-mcp-connector-common/jest.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| module.exports = { | ||
| preset: '@kbn/test/jest_node', | ||
| rootDir: '../../../../..', | ||
| roots: ['<rootDir>/x-pack/platform/packages/shared/kbn-mcp-connector-common'], | ||
| }; |
7 changes: 7 additions & 0 deletions
7
x-pack/platform/packages/shared/kbn-mcp-connector-common/kibana.jsonc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "shared-common", | ||
| "id": "@kbn/mcp-connector-common", | ||
| "owner": "@elastic/workchat-eng", | ||
| "group": "platform", | ||
| "visibility": "shared" | ||
| } |
6 changes: 6 additions & 0 deletions
6
x-pack/platform/packages/shared/kbn-mcp-connector-common/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "@kbn/mcp-connector-common", | ||
| "private": true, | ||
| "version": "1.0.0", | ||
| "license": "Elastic License 2.0" | ||
| } |
69 changes: 69 additions & 0 deletions
69
x-pack/platform/packages/shared/kbn-mcp-connector-common/src/client.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| export interface CallToolRequest { | ||
| name: string; | ||
| arguments?: Record<string, any>; | ||
| } | ||
|
|
||
| export interface TextPart { | ||
| type: 'text'; | ||
| text: string; | ||
| } | ||
|
|
||
| export type ContentPart = TextPart; | ||
|
|
||
| export interface CallToolResponse { | ||
| content: ContentPart[]; | ||
| /** | ||
| * Optional provider metadata for attribution and audit trails. | ||
| * Included in tool execution results for tracking and logging. | ||
| */ | ||
| provider?: ToolProviderMetadata; | ||
| } | ||
|
|
||
| /** | ||
| * Metadata about the provider of a tool. | ||
| * Used for attribution, audit trails, and UI display. | ||
| */ | ||
| export interface ToolProviderMetadata { | ||
| /** | ||
| * Provider identifier (e.g., 'mcp.github') | ||
| */ | ||
| id: string; | ||
| /** | ||
| * Human-readable provider name (e.g., 'GitHub MCP Server') | ||
| */ | ||
| name: string; | ||
| /** | ||
| * Provider type constant | ||
| */ | ||
| type: 'mcp'; | ||
| /** | ||
| * Unique ID of the MCP connector (from config.uniqueId) | ||
| */ | ||
| uniqueId: string; | ||
| /** | ||
| * Optional description of when to use this MCP server (for LLM context) | ||
| */ | ||
| description?: string; | ||
| } | ||
|
|
||
| export interface Tool { | ||
| name: string; | ||
| description?: string; | ||
| inputSchema: Record<string, unknown>; | ||
| /** | ||
| * Optional provider metadata for attribution and audit trails. | ||
| * When present, indicates the source of the tool (e.g., which MCP connector). | ||
| */ | ||
| provider?: ToolProviderMetadata; | ||
| } | ||
|
|
||
| export interface ListToolsResponse { | ||
| tools: Tool[]; | ||
| } |
98 changes: 98 additions & 0 deletions
98
x-pack/platform/packages/shared/kbn-mcp-connector-common/src/connector.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
| import type { TypeOf } from '@kbn/config-schema'; | ||
| import type { | ||
| MCPConnectorHTTPServiceConfigSchema, | ||
| MCPConnectorConfigSchema, | ||
| MCPConnectorSecretsNoneSchema, | ||
| MCPConnectorSecretsBearerSchema, | ||
| MCPConnectorSecretsApiKeySchema, | ||
| MCPConnectorSecretsBasicSchema, | ||
| MCPConnectorSecretsCustomHeadersSchema, | ||
| MCPConnectorSecretsSchema, | ||
| } from './schema'; | ||
|
|
||
| /** | ||
| * Authentication type selector. | ||
| * | ||
| * Determines which authentication method is used. The actual credentials | ||
| * are stored in the secrets object (encrypted), while this type is stored | ||
| * in config (not encrypted). | ||
| */ | ||
| export type MCPConnectorAuthType = 'none' | 'bearer' | 'apiKey' | 'basic' | 'customHeaders'; | ||
|
|
||
| /** | ||
| * MCP connector HTTP service configuration. | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorHTTPServiceConfig = TypeOf<typeof MCPConnectorHTTPServiceConfigSchema>; | ||
|
|
||
| /** | ||
| * MCP connector configuration. | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorConfig = TypeOf<typeof MCPConnectorConfigSchema>; | ||
|
|
||
| /** | ||
| * No authentication secrets. | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorSecretsNone = TypeOf<typeof MCPConnectorSecretsNoneSchema>; | ||
|
|
||
| /** | ||
| * Bearer token authentication secrets. | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorSecretsBearer = TypeOf<typeof MCPConnectorSecretsBearerSchema>; | ||
|
|
||
| /** | ||
| * API key authentication secrets. | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorSecretsApiKey = TypeOf<typeof MCPConnectorSecretsApiKeySchema>; | ||
|
|
||
| /** | ||
| * Basic authentication secrets. | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorSecretsBasic = TypeOf<typeof MCPConnectorSecretsBasicSchema>; | ||
|
|
||
| /** | ||
| * Custom headers authentication secrets. | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorSecretsCustomHeaders = TypeOf< | ||
| typeof MCPConnectorSecretsCustomHeadersSchema | ||
| >; | ||
|
|
||
| /** | ||
| * MCP connector secrets (discriminated union). | ||
| * Derived from schema. | ||
| */ | ||
| export type MCPConnectorSecrets = TypeOf<typeof MCPConnectorSecretsSchema>; | ||
|
|
||
| export const MCP_CONNECTOR_SUB_ACTION_TYPE_LIST_TOOLS = 'listTools'; | ||
| export const MCP_CONNECTOR_SUB_ACTION_TYPE_CALL_TOOL = 'callTool'; | ||
|
|
||
| export type MCPConnectorSubActionType = | ||
| | typeof MCP_CONNECTOR_SUB_ACTION_TYPE_LIST_TOOLS | ||
| | typeof MCP_CONNECTOR_SUB_ACTION_TYPE_CALL_TOOL; | ||
|
|
||
| export interface MCPListToolsParams { | ||
| subAction: typeof MCP_CONNECTOR_SUB_ACTION_TYPE_LIST_TOOLS; | ||
| subActionParams: {}; | ||
| } | ||
|
|
||
| export interface MCPCallToolParams { | ||
| subAction: typeof MCP_CONNECTOR_SUB_ACTION_TYPE_CALL_TOOL; | ||
| subActionParams: { | ||
| name: string; | ||
| arguments?: Record<string, any>; | ||
| }; | ||
| } | ||
|
|
||
| export type MCPExecutorParams = MCPListToolsParams | MCPCallToolParams; |
17 changes: 17 additions & 0 deletions
17
x-pack/platform/packages/shared/kbn-mcp-connector-common/src/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import { i18n } from '@kbn/i18n'; | ||
|
|
||
| export const MCP_CONNECTOR_TITLE = i18n.translate( | ||
| 'xpack.stackConnectors.components.mcp.connectorTypeTitle', | ||
| { | ||
| defaultMessage: 'MCP Connector', | ||
| } | ||
| ); | ||
|
|
||
| export const MCP_CONNECTOR_TYPE_ID = '.mcp'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: dummy readme content