mcp-server

m-code-ing/mcp-server

3.1

If you are the rightful owner of mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This document provides a structured overview of a Model Context Protocol (MCP) server integrated with OpenAI's GPT-4, designed to facilitate interaction with AI models through a standardized protocol.

Tools
1
Resources
0
Prompts
0

MCP Server with OpenAI Agent

A Model Context Protocol (MCP) server with OpenAI integration example.

Setup

  1. Install dependencies:

    npm install
    
  2. Set up environment variables:

    cp .env.example .env
    # Edit .env and add your OpenAI API key
    
  3. Run the MCP server:

    npm start
    
  4. Test the OpenAI agent:

    npm run agent
    
  5. Interactive testing:

    npm run test-agent
    

Features

  • MCP Server: Provides a getWeather tool
  • OpenAI Agent: Connects to MCP server and uses GPT-4 to call tools
  • TypeScript: Full type safety

Environment Variables

  • OPENAI_API_KEY: Your OpenAI API key

Security

  • Never commit your actual API keys
  • The .env file is gitignored
  • Use .env.example as a template