Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🪪 fix: Support MCP Server Titles With Hyphens (#15094)

Danny Avilad602452c05ed
diff --git a/client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/BasicInfoSection.tsx b/client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/BasicInfoSection.tsx
index fd78d0bced..d1574336f3 100644
--- a/client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/BasicInfoSection.tsx
+++ b/client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/BasicInfoSection.tsx
@@ -1,5 +1,6 @@
import { useFormContext } from 'react-hook-form';
import { Input, Label, Textarea } from '@librechat/client';
+import { MCP_SERVER_TITLE_PATTERN } from 'librechat-data-provider';
import type { MCPServerFormData } from '../hooks/useMCPServerForm';
import MCPIcon from '~/components/SidePanel/Agents/MCPIcon';
import { useLocalize } from '~/hooks';
@@ -52,7 +53,7 @@ export default function BasicInfoSection() {
{...register('title', {
required: localize('com_ui_field_required'),
pattern: {
- value: /^[a-zA-Z0-9 ]+$/,
+ value: MCP_SERVER_TITLE_PATTERN,
message: localize('com_ui_mcp_title_invalid'),
},
})}
diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.json
index 49253657f7..5ad9bdf4d8 100644
--- a/client/src/locales/en/translation.json
+++ b/client/src/locales/en/translation.json
@@ -1527,7 +1527,7 @@
"com_ui_mcp_servers_allow_share": "Allow users to share MCP servers",
"com_ui_mcp_servers_allow_share_public": "Allow users to share MCP servers publicly",
"com_ui_mcp_servers_allow_use": "Allow users to use MCP servers",
- "com_ui_mcp_title_invalid": "Title can only contain letters, numbers, and spaces",
+ "com_ui_mcp_title_invalid": "Title must start with a letter or number and can include spaces, hyphens, and apostrophes",
"com_ui_mcp_tool_options": "Tool Options",
"com_ui_mcp_transport": "Transport",
"com_ui_mcp_type_sse": "SSE",
diff --git a/packages/data-provider/specs/mcp.spec.ts b/packages/data-provider/specs/mcp.spec.ts
index a52e2f59e9..31c8ac160f 100644
--- a/packages/data-provider/specs/mcp.spec.ts
+++ b/packages/data-provider/specs/mcp.spec.ts
@@ -6,6 +6,48 @@ import {
MCP_USER_INPUT_FIELDS,
} from '../src/mcp';
+describe('MCP server title validation', () => {
+ const titleCases = [
+ ['hyphenated ASCII title', 'Read-Only Tools'],
+ ['accented title', "Générateur d'images"],
+ ['Unicode title', '画像ツール'],
+ ['typographic apostrophe', 'Today’s Tools'],
+ ];
+
+ it.each(titleCases)('accepts a %s in configured MCP servers', (_label, title) => {
+ const result = MCPOptionsSchema.safeParse({
+ type: 'sse',
+ url: 'https://mcp-server.com/sse',
+ title,
+ });
+
+ expect(result.success).toBe(true);
+ });
+
+ it.each(titleCases)('accepts a %s from the MCP Builder', (_label, title) => {
+ const result = MCPServerUserInputSchema.safeParse({
+ type: 'sse',
+ url: 'https://mcp-server.com/sse',
+ title,
+ });
+
+ expect(result.success).toBe(true);
+ });
+
+ it.each(['', ' ', '-Tools', "'Tools", 'Tools@Home'])(
+ 'rejects an invalid MCP server title: %p',
+ (title) => {
+ const result = MCPServerUserInputSchema.safeParse({
+ type: 'sse',
+ url: 'https://mcp-server.com/sse',
+ title,
+ });
+
+ expect(result.success).toBe(false);
+ },
+ );
+});
+
describe('MCPOptionsSchema', () => {
describe('OBO transport support', () => {
it('should accept obo on SSE transport', () => {
diff --git a/packages/data-provider/src/mcp.ts b/packages/data-provider/src/mcp.ts
index 677fcdef34..8d3309667c 100644
--- a/packages/data-provider/src/mcp.ts
+++ b/packages/data-provider/src/mcp.ts
@@ -154,12 +154,16 @@ const OboOptionsSchema = z.object({
scopes: z.string().min(1),
});
+export const MCP_SERVER_TITLE_PATTERN = new RegExp(
+ "^[\\p{L}\\p{N}][\\p{L}\\p{N}\\p{M}'’ -]*$",
+ 'u',
+);
+export const MCP_SERVER_TITLE_ERROR =
+ 'Title must start with a letter or number and can include spaces, hyphens, and apostrophes';
+
const BaseOptionsSchema = z.object({
- /** Display name for the MCP server - only letters, numbers, and spaces allowed */
- title: z
- .string()
- .regex(/^[a-zA-Z0-9 ]+$/, 'Title can only contain letters, numbers, and spaces')
- .optional(),
+ /** Display name for the MCP server */
+ title: z.string().regex(MCP_SERVER_TITLE_PATTERN, MCP_SERVER_TITLE_ERROR).optional(),
/** Description of the MCP server */
description: z.string().optional(),
/**