src/platform/packages/shared/kbn-mcp-dev-server/README.md
@kbn/mcp-dev-server starts a local Model Context Protocol (MCP) server that Kibana engineers can run while working on Kibana.
For more information on Model Context Protocol, see modelcontextprotocol.io.
From the Kibana repo root:
node scripts/mcp_dev
This starts a stdio MCP Server.
Add the following snippet to your settings for your AI Coding IDE so it will automatically start/attach to the dev server (it assumes you use nvm):
{
"mcpServers": {
"Kibana Dev": {
"command": "bash",
"args": [
"-lc",
"source \"$NVM_DIR/nvm.sh\" && cd ${KIBANA_WORKSPACE} && nvm use --silent && node ./scripts/mcp_dev.js"
]
}
}
}
For Gemini CLI with sandbox enabled, you will need to create a custom Seatbelt profile in $KIBANA_WORKSPACE/.gemini/sandbox-macos-kibana.sb like:
(version 1)
;; allow everything by default
(allow default)
;; deny all writes EXCEPT under specific paths
(deny file-write*)
(allow file-write*
(subpath (param "TARGET_DIR"))
(subpath (param "TMP_DIR"))
(subpath (param "CACHE_DIR"))
(subpath (string-append (param "HOME_DIR") "/.gemini"))
(subpath (string-append (param "HOME_DIR") "/.npm"))
(subpath (string-append (param "HOME_DIR") "/.nvm"))
(subpath (string-append (param "HOME_DIR") "/.cache"))
(subpath (string-append (param "HOME_DIR") "/.gitconfig"))
;; Allow writes to included directories from --include-directories
(subpath (param "INCLUDE_DIR_0"))
(subpath (param "INCLUDE_DIR_1"))
(subpath (param "INCLUDE_DIR_2"))
(subpath (param "INCLUDE_DIR_3"))
(subpath (param "INCLUDE_DIR_4"))
(literal "/dev/stdout")
(literal "/dev/stderr")
(literal "/dev/null")
)
Then add environment file named $KIBANA_WORKSPACE/.env file to your KIBANA_WORKSPACE with:
SEATBELT_PROFILE=kibana
ProTip: Create a global .gitignore_global to exclude .env and .gemini directories so they don't get commited.
This document outlines the process of adding a new tool to the MCP dev server.
Create a new file for your tool inside src/platform/packages/shared/kbn-mcp-dev-server/src/tools. The file name should be descriptive of the tool's functionality (e.g., my_new_tool.ts).
Inside the new file, create a ToolDefinition object. This object will contain the tool's name, description, input schema, and handler function.
Example: src/platform/packages/shared/kbn-mcp-dev-server/src/tools/my_new_tool.ts
import { z } from '@kbn/zod/v4';
import { ToolDefinition } from '@kbn/mcp-server-common';
// Define the input schema for your tool using Zod
const myNewToolInputSchema = z.object({
myArgument: z.string().describe("A description for this argument"),
});
// Implement the tool's logic in a function
async function myNewTool(input: z.infer<typeof myNewToolInputSchema>): Promise<string> {
// Your tool's logic goes here
return `You passed the argument: ${input.myArgument}`;
}
// Create the tool definition
export const myNewTool: ToolDefinition<typeof myNewToolInputSchema> = {
name: 'my_new_tool',
description: 'A brief description of what my new tool does.',
inputSchema: myNewToolInputSchema,
handler: async (input) => {
const result = await myNewTool(input);
return {
content: [
{
type: 'text',
text: result,
},
],
};
},
};
Open src/platform/packages/shared/kbn-mcp-dev-server/src/server/index.ts and follow these steps:
Add an import statement at the top of the file to import your new tool's definition.
import { myNewTool } from '../tools/my_new_tool';
Use the addTool helper function to register your new tool.
addTool(server, myNewTool);
By following these steps, you can successfully add and register a new tool to the MCP dev server, making it available for use.
The following tools are available in the MCP Dev Server.
For semantic code search, please use the semantic-code-search-mcp-server. This server provides a suite of tools for exploring and understanding the Kibana codebase.
Contact @simianhacker for details on how to get started.