MCP Server

MCP Server

A minimal Django project exposing MCP-style endpoints for listing and fetching records, and generating OpenAI responses via the Responses API using an in-memory store.

Category
Visit Server

README

MCP Server

This repository contains a minimal Django project that exposes Machine Control Protocol (MCP)-style endpoints for experimenting with OpenAI integrations. The project uses an in-memory store to emulate database records and forwards prompts to the OpenAI Responses API using environment-driven configuration.

Getting started

  1. Install the Python dependencies:

    pip install -r requirements.txt
    
  2. Configure the required environment variables (see below).

  3. Apply migrations and run the test suite to confirm the installation:

    python manage.py migrate
    python manage.py test
    
  4. Install the frontend dependencies and start the development servers in separate terminals:

    # Terminal 1 - Django API
    python manage.py runserver
    
    # Terminal 2 - React development server
    cd frontend
    npm install
    npm run dev
    

    The Vite dev server proxies API requests that start with /mcp/ to the Django backend running on port 8000, so no additional CORS configuration is required. Update frontend/.env.development if your backend runs on a different host or port.

  5. Visit http://127.0.0.1:5173/ to use the MCP client interface during development.

    The MCP endpoint remains available at http://127.0.0.1:8000/mcp/ and accepts JSON-RPC-style POST requests if you want to interact with it directly (for example via curl or Postman).

Environment variables

The project reads the following environment variables in mcp_server/settings.py:

Variable Description Default
OPENAI_API_KEY API key used to authenticate with OpenAI. Empty string (required for live requests)
OPENAI_BASE_URL Base URL for the OpenAI API. Override when routing through compatible gateways. https://api.openai.com/v1
OPENAI_MODEL Model identifier passed to the Responses API. gpt-4o-mini

At minimum you must provide OPENAI_API_KEY to generate real completions. The tests run without hitting the network by mocking the client.

Fake data model

The interactions app seeds a handful of InteractionRecord entries that mimic database-backed resources. The MCP view exposes operations to list the available records, fetch an individual record, and generate OpenAI-backed responses using either the provided prompt or the record's default prompt.

Frontend configuration

The frontend reads runtime configuration from .env files using the VITE_ prefix. Two presets are provided:

  • frontend/.env.development – defaults the API base URL to /mcp/ and proxies through http://localhost:8000.
  • frontend/.env.production – defaults the API base URL to /mcp/ when the React bundle is served by Django.

Override VITE_API_BASE_URL in these files (or create .env.local) to point at a different MCP host.

Building for production

Create an optimised React build and copy it into Django's static directory:

cd frontend
npm run build:django

The compiled assets are stored in mcp_server/static/frontend/. Django automatically serves the bundled interface from the root URL (/) when the build is present. If you prefer to deploy the frontend separately, run npm run build and host the contents of frontend/dist on your static hosting provider of choice.

Running tests

Execute the Django test runner:

python manage.py test

The unit tests exercise the MCP endpoint and ensure that OpenAI client calls are wired correctly via dependency injection and mocking.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured