MCP Server with OpenAI Integration
Uses Cloudflare Tunnel to expose the local MCP server publicly, enabling external API access and webhook integration for automated service communication
Enables automatic function calling integration with OpenAI's API, allowing the MCP server to respond to OpenAI requests through webhooks and Cloudflare tunnels for seamless AI-powered interactions
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server with OpenAI Integrationwhat's the weather like in Tokyo right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server with OpenAI Integration
Este proyecto demuestra cómo crear un servidor MCP (Model Context Protocol) personalizado con una herramienta de clima e integrarlo con OpenAI usando Cloudflare Tunnel.
🚀 Características
Servidor MCP personalizado con herramienta de clima
Integración automática con OpenAI usando tu propio código
Túnel de Cloudflare para exposición pública
TypeScript completamente tipado
Function calling automático sin intervención manual
Related MCP server: Python Weather MCP Server
📁 Estructura del Proyecto
mcp-server-openai-sdk/
├── src/
│ ├── index.ts # Servidor MCP principal
│ ├── webhook-server.ts # Servidor webhook para OpenAI
│ └── test-method2.ts # Test de integración automática
├── package.json # Dependencias y scripts
├── tsconfig.json # Configuración TypeScript
├── .env # Variables de entorno (crear)
└── README.md # Este archivo🛠️ Instalación
Instalar dependencias:
npm installConfigurar variables de entorno:
# Crear archivo .env echo "OPENAI_API_KEY=tu-api-key-aqui" > .envCompilar el proyecto:
npm run build
🚀 Uso
Paso 1: Iniciar el servidor webhook
npm run webhookPaso 2: Crear túnel de Cloudflare
En otra terminal:
cloudflared tunnel --url http://localhost:3000Paso 3: Actualizar la URL del túnel
Edita src/test-method2.ts y actualiza la URL:
const webhookUrl = "https://tu-nueva-url.trycloudflare.com/webhook/weather";Paso 4: Probar la integración
npm run test🎯 Cómo Funciona
Flujo Automático (Método 2)
Usuario pregunta: "¿Cuál es el clima en Bogotá?"
OpenAI detecta: Necesita información del clima
Tu código llama automáticamente: Tu webhook de Cloudflare
Tu MCP server responde: Con datos del clima
Tu código envía: La respuesta de vuelta a OpenAI
OpenAI presenta: La respuesta final naturalmente
Ejemplo de Salida
👤 Usuario: ¿Cuál es el clima en Bogotá?
🔧 Paso 1: OpenAI detecta que necesita información del clima
✅ OpenAI quiere llamar la función get_weather
🔄 Paso 2: Tu código llama automáticamente tu webhook
📋 Argumentos: { "city": "Bogotá" }
✅ Paso 3: Tu MCP server responde: Weather in Bogotá: 15°C, cloudy
🔄 Paso 4: Tu código envía la respuesta de vuelta a OpenAI
🤖 Paso 5: OpenAI presenta la respuesta final:
El clima en Bogotá es de 15°C, nublado.🔧 Scripts Disponibles
npm run build- Compilar el proyectonpm run webhook- Iniciar servidor webhooknpm run test- Probar integración automáticanpm run dev- Modo desarrollo
🎯 Ventajas de esta Integración
✅ Completamente automático - No necesitas intervención manual
✅ Tu código controla todo - Manejas la comunicación
✅ Escalable - Puedes agregar más herramientas fácilmente
✅ Producción lista - Listo para usar en aplicaciones reales
🔍 Archivos Esenciales
src/index.ts- Servidor MCP con herramienta de climasrc/webhook-server.ts- Servidor webhook para OpenAIsrc/test-method2.ts- Test de integración automática
📝 Notas
El servidor webhook debe estar corriendo en puerto 3000
El túnel de Cloudflare debe estar activo
La URL del túnel debe actualizarse en el script de test
Esta integración funciona completamente automática sin intervención manual
🎉 ¡Listo!
Tu servidor MCP personalizado está completamente integrado con OpenAI y funcionando automáticamente. Puedes hacer preguntas sobre el clima y obtener respuestas naturales sin intervención manual.
Available Tools
1 toolget_weatherC
Get current weather information for a specific city
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city to get weather information for | |
| unit | No | Temperature unit | celsius |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions 'Get current weather information,' which implies a read-only operation, but fails to describe error handling, rate limits, data sources, or response format. This leaves significant gaps in understanding the tool's behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose without any wasted words. It is appropriately sized for a simple tool and earns its place by clearly stating the action and target.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what weather information is returned (e.g., temperature, conditions), error scenarios, or any behavioral traits. For a tool with no structured support, this leaves the agent under-informed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, clearly documenting both parameters. The description adds minimal value beyond the schema by implying the 'city' parameter is used for location, but it doesn't provide additional context like format examples or edge cases. Baseline 3 is appropriate given the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('current weather information'), and specifies the target ('for a specific city'). It distinguishes what the tool does effectively, though there are no sibling tools to differentiate from, which prevents a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives, prerequisites, or exclusions. It simply states what the tool does without context for usage, leaving the agent with minimal direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
- First observed
get_weather
TDQS
Scored across 1 tool
With only one tool, there is no possibility of confusion or overlap between tools, making disambiguation perfect.
A single tool inherently has consistent naming, as there are no other tools to compare it against for patterns or deviations.
One tool is too few for a server named 'MCP Server with OpenAI Integration', as this suggests a broader scope beyond just weather, making the count inappropriate for the apparent purpose.
The server's name implies OpenAI integration, but the only tool is for weather, leaving a severe gap in functionality for the stated domain, making it highly incomplete.
Related MCP Connectors
Cloudflare Workers MCP server: ai-model-router
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
One AI endpoint to search and call 22k+ MCP servers; 50+ hosted tools work instantly, no key.
9 remote MCP servers on Cloudflare Workers for AI agents. Free tier + Pro API keys.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA server that integrates the MCP library with OpenAI's API, allowing users to interact with various tools, such as the weather tool, through natural language queries.MIT
- AlicenseBqualityDmaintenanceEnables AI agents to fetch real-time weather data for any location using the OpenWeatherMap API. Demonstrates how to build a simple MCP server that exposes weather information as a tool for LLMs.1GPL 3.0
- FlicenseNot gradedqualityDmaintenanceAn MCP server that provides weather and web search tools, orchestrated by a LangGraph agent with OpenAI for natural language interaction.8-
- FlicenseNot gradedqualityCmaintenanceA remote MCP server deployed on Cloudflare Workers without authentication, enabling integration with AI clients like Claude Desktop and Cloudflare AI Playground for tool execution.-