From 9bf9bb369d7e15fe8b69de9d96f869f2b5009de6 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Wed, 4 Jun 2025 18:25:26 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8C=20IMPROVE:=20agent.run=20with=20mc?= =?UTF-8?q?p=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 12 ++++++ .prettierrc.json | 9 +++++ packages/cli/README.md | 43 +++++++++++++--------- packages/langbase/src/langbase/langbase.ts | 13 +++++++ 4 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 .editorconfig create mode 100644 .prettierrc.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3f816aa --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.yml] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..8b8f817 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,9 @@ +{ + "trailingComma": "none", + "arrowParens": "avoid", + "singleQuote": true, + "printWidth": 80, + "useTabs": true, + "tabWidth": 4, + "semi": true +} \ No newline at end of file diff --git a/packages/cli/README.md b/packages/cli/README.md index abe4ea5..3febe48 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -3,56 +3,63 @@ The Langbase CLI is a command-line interface for Langbase. It provides a set of commands to interact with the Langbase SDK and perform various tasks related to AI development. ## Usage + ### Langbase Docs MCP Server Integrate the Langbase Docs MCP server into your IDEs and Claude Desktop. #### Cursor + - Open Cursor settings - Navigate to the MCP settings - Click on the `+` button to add a new global MCP server - Paste the following configuration in the `mcp.json` file: + ```json { - "mcpServers": { - "Langbase": { - "command": "npx", - "args": ["@langbase/cli","docs-mcp-server"] - } - } + "mcpServers": { + "Langbase": { + "command": "npx", + "args": ["@langbase/cli", "docs-mcp-server"] + } + } } ``` #### Windsurf + - Navigate to Windsurf - Settings > Advanced Settings - You will find the option to Add Server - Click “Add custom server +” - Paste the following configuration in the `mcp_config.json` file: + ```json { - "mcpServers": { - "Langbase": { - "command": "npx", - "args": ["@langbase/cli", "docs-mcp-server"] - } - } + "mcpServers": { + "Langbase": { + "command": "npx", + "args": ["@langbase/cli", "docs-mcp-server"] + } + } } ``` #### Claude Desktop + - Open Claude Desktop File Menu - Navigate to the settings - Go to Developer Tab - Click on the Edit Config button - Paste the following configuration in the `claude_desktop_config.json` file: + ```json { - "mcpServers": { - "Langbase": { - "command": "npx", - "args": ["@langbase/cli", "docs-mcp-server"] - } - } + "mcpServers": { + "Langbase": { + "command": "npx", + "args": ["@langbase/cli", "docs-mcp-server"] + } + } } ``` diff --git a/packages/langbase/src/langbase/langbase.ts b/packages/langbase/src/langbase/langbase.ts index b73572e..5b01ebf 100644 --- a/packages/langbase/src/langbase/langbase.ts +++ b/packages/langbase/src/langbase/langbase.ts @@ -43,6 +43,7 @@ export interface AgentRunOptionsBase { max_completion_tokens?: number; response_format?: ResponseFormat; customModelParams?: Record; + mcp_servers?: McpServerSchema[]; } export interface AgentRunOptions extends AgentRunOptionsBase { @@ -96,6 +97,18 @@ export interface AgentRunResponse { }; } +export interface McpServerSchema { + name: string; + type: 'url'; + url: string; + authorization_token?: string | null; + tool_configuration?: { + allowed_tools?: string[] | null; + enabled?: boolean; + } | null; + custom_headers?: any | null; +} + export interface RunResponseStream { stream: ReadableStream; threadId: string | null;