A Model Context Protocol (MCP) server with OpenAI integration example.
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env # Edit .env and add your OpenAI API key -
Run the MCP server:
npm start
-
Test the OpenAI agent:
npm run agent
-
Interactive testing:
npm run test-agent
- MCP Server: Provides a
getWeathertool - OpenAI Agent: Connects to MCP server and uses GPT-4 to call tools
- TypeScript: Full type safety
OPENAI_API_KEY: Your OpenAI API key
- Never commit your actual API keys
- The
.envfile is gitignored - Use
.env.exampleas a template