Skip to main content
Glama
shubhamimsr

APIMind AI MCP Server

by shubhamimsr

APIMind AI โ€” AI-Powered API Documentation Assistant

An AI-powered Retrieval-Augmented Generation (RAG) assistant that lets developers query OpenAPI/Swagger documentation using natural language, with Model Context Protocol (MCP) integration for use from tools such as VS Code Copilot.


๐Ÿš€ Project Overview

Developers often work with multiple API specifications spread across different OpenAPI/Swagger YAML or JSON files. Finding the correct endpoint, HTTP method, authentication details, request structure, and response information can become time-consuming.

APIMind AI solves this problem by ingesting API documentation into a searchable knowledge base and using a hybrid RAG pipeline to retrieve relevant documentation before asking an LLM to generate a grounded answer.

The project also exposes selected capabilities through an MCP server, allowing MCP-compatible clients such as VS Code Copilot to discover project files and ask questions about the uploaded API documentation.

Example questions

Which endpoint creates a customer?

How do I retrieve a specific GitHub repository?

What authentication does the Stripe API use?

Which endpoint creates a payment?

What HTTP method is used to update a repository?

Is there an endpoint for listing available models?

If the uploaded documentation does not contain enough evidence, the system is designed to respond with an appropriate "I don't know" response instead of relying on outside knowledge.


๐Ÿ—๏ธ Architecture

The system consists of two major flows:

Document ingestion

OpenAPI / Swagger YAML or JSON
              โ”‚
              โ–ผ
       FastAPI Upload API
              โ”‚
              โ–ผ
        Parser Service
              โ”‚
              โ–ผ
      Semantic Chunking
              โ”‚
              โ–ผ
       Embedding Service
              โ”‚
              โ–ผ
       OpenAI Embeddings
              โ”‚
              โ–ผ
     PostgreSQL + pgvector

Question answering / RAG

User Question
      โ”‚
      โ–ผ
   Chat API
      โ”‚
      โ–ผ
 Query Rewriting
      โ”‚
      โ–ผ
Document Resolution
      โ”‚
      โ–ผ
 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ”‚   Hybrid Retrieval    โ”‚
 โ”‚                       โ”‚
 โ”‚ Vector Search         โ”‚
 โ”‚ Keyword Search        โ”‚
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
             โ”‚
             โ–ผ
      RRF Fusion
             โ”‚
             โ–ผ
 Cross-Encoder Reranking
             โ”‚
             โ–ผ
    Top-K Relevant Chunks
             โ”‚
             โ–ผ
    Confidence Scoring
             โ”‚
             โ–ผ
      Prompt Construction
             โ”‚
             โ–ผ
        Groq LLM
             โ”‚
             โ–ผ
   Grounding Verification
             โ”‚
             โ–ผ
       Final Answer

๐Ÿง  RAG Pipeline

The core of APIMind AI is a hybrid RAG pipeline.

Related MCP server: Markdown RAG MCP

1. Document parsing

Uploaded OpenAPI/Swagger YAML or JSON files are parsed into structured API information.

The system extracts information such as:

  • Endpoint

  • HTTP method

  • API description

  • Request information

  • Response information

  • Authentication details

  • Parameters

  • API-specific documentation


2. Semantic chunking

Instead of treating an entire API specification as one large document, the documentation is divided into meaningful chunks.

Example:

POST /customers
Creates a new customer...
Request:
...
Response:
...

Metadata is retained with every chunk:

document_id
source_file
chunk_type
endpoint
method
chunk_text
embedding

3. Embeddings

The chunks are converted into vector embeddings.

The project uses an external embedding model through the embedding service and stores the resulting vectors in PostgreSQL using pgvector.


4. Hybrid retrieval

APIMind does not depend only on semantic similarity.

It performs two retrieval strategies:

Uses pgvector similarity search to find conceptually related documentation.

Uses PostgreSQL Full-Text Search to find exact terminology and API-specific keywords.

The two result sets are combined using:

Reciprocal Rank Fusion (RRF)

Vector Results
       +
Keyword Results
       โ”‚
       โ–ผ
   RRF Fusion
       โ”‚
       โ–ผ
Unified Ranking

5. Cross-Encoder reranking

The fused results are passed through a Cross-Encoder reranker.

Current model:

cross-encoder/ms-marco-MiniLM-L-6-v2

This provides a second-stage relevance check between:

Question โ†” Retrieved Documentation

The highest-ranked chunks are then passed to the LLM.


6. Confidence scoring

Before generating an answer, the retrieved context is evaluated using the project's confidence mechanism.

If the retrieved evidence is insufficient, the system avoids generating an unsupported answer.

Example:

I couldn't find enough evidence in the uploaded documentation
to answer this question.

7. Grounding verification

Generated answers can also be checked against the retrieved documentation.

The grounding verifier evaluates whether the answer is supported by the supplied context.

The goal is to reduce hallucinated API information.


๐Ÿค– LLM

The project uses the OpenAI-compatible client interface with:

Groq API
Llama 3.1 8B Instant

The LLM receives:

  • System instructions

  • User question

  • Conversation history

  • Retrieved documentation

The prompt explicitly instructs the model to use only the supplied documentation.


๐Ÿ”Œ MCP Integration

APIMind also includes a Model Context Protocol (MCP) server.

The MCP server exposes selected project capabilities as tools that can be consumed by MCP-compatible clients.

The primary tool is:

โญ ask_api_documentation

This is the main MCP tool for APIMind.

It allows an MCP client such as VS Code Copilot to ask questions about the indexed API documentation.

Conceptually:

VS Code Copilot
       โ”‚
       โ–ผ
MCP Client
       โ”‚
       โ–ผ
APIMind MCP Server
       โ”‚
       โ–ผ
ask_api_documentation
       โ”‚
       โ–ผ
FastAPI / RAG Backend
       โ”‚
       โ–ผ
Hybrid RAG Pipeline
       โ”‚
       โ–ผ
Grounded API Answer

๐Ÿ› ๏ธ MCP Tools

1. ask_api_documentation โญ

Purpose: Ask questions about the uploaded API documentation.

This is the primary APIMind MCP capability.

Example:

Which endpoint creates a Stripe customer?

or:

How do I retrieve a specific GitHub repository?

The tool sends the question through the APIMind RAG pipeline and returns the documentation-grounded result.

In VS Code Copilot, ask naturally:

Use APIMind to tell me which endpoint creates a customer.

or:

Ask the API documentation what HTTP method is used to retrieve a GitHub repository.

The MCP client can invoke the tool when appropriate.


2. list_project_files

Purpose: List files available inside the configured MCP workspace.

Example:

List the project files available to me.

The tool returns the files/directories visible within the configured workspace.

It is protected by workspace path validation.


3. read_project_file

Purpose: Read the contents of a text file inside the configured MCP workspace.

Example:

Read the OpenAPI file github.yaml.

The MCP server validates that the requested path remains inside the configured workspace.

Binary files and files exceeding the configured maximum file size are rejected.


4. hello_tool

A simple MCP connectivity/demo tool.

Example:

Use the hello tool with the name Developer.

Expected response:

Hello Developer, welcome to APIMind MCP Server!

This tool is mainly useful for verifying that the MCP server is connected correctly.


โš ๏ธ About generate_code

A generate_code MCP tool may exist in experimental/development code, but the dedicated code-generation service has not been implemented as part of the current RAG backend.

Therefore, it is intentionally not considered a supported APIMind feature in this README.

The current supported workflow is:

Question
   โ†“
ask_api_documentation
   โ†“
RAG Retrieval
   โ†“
Grounded Documentation Answer

Code generation can be added later as a dedicated service with its own retrieval and code-generation prompt.


๐Ÿ’ป Using APIMind with VS Code Copilot

The project includes an MCP server that can be connected to an MCP-compatible client such as VS Code Copilot.

1. Start the FastAPI backend

From the project root:

uvicorn app.main:app --reload

The FastAPI application will expose the APIMind REST APIs.

Swagger UI is normally available at:

http://127.0.0.1:8000/docs

2. Start the MCP server

Navigate to the MCP server directory:

cd mcp_server

Start the server:

python server.py

The current MCP server uses:

127.0.0.1:8000

and Streamable HTTP transport.

If your FastAPI application and MCP server are configured to use the same port, configure one of them to use another port before starting both simultaneously.


3. Connect the MCP server to VS Code

Use VS Code's MCP configuration / MCP-compatible tooling to register the APIMind MCP server.

Once connected, the available tools should include:

hello_tool
list_project_files
read_project_file
ask_api_documentation

The exact UI may vary depending on your VS Code and Copilot version.


๐Ÿงช Example VS Code Copilot Prompts

After connecting the MCP server, try:

API documentation

Use ask_api_documentation to find the endpoint that creates a Stripe customer.

GitHub API

Use ask_api_documentation to explain how to retrieve a specific GitHub repository.

Authentication

Use ask_api_documentation to tell me what authentication mechanism is documented for the Stripe API.

File listing

Use list_project_files to show the files available in the workspace.

Reading a file

Use read_project_file to read github.yaml.

Combined workflow

First inspect the available project files, then use APIMind to answer:
Which endpoint is used to create a repository?

๐Ÿ“ก REST API Endpoints

The FastAPI backend provides the core application functionality.

Typical capabilities include:

Endpoint / Capability

Purpose

POST /upload

Upload an OpenAPI/Swagger document

POST /chat

Ask a documentation question

Streaming chat

Stream an LLM response

Document management

List, inspect and delete uploaded documents

Code generation

Not currently implemented as a supported backend service

Refer to the automatically generated FastAPI Swagger documentation for the exact current endpoint paths and request/response schemas.


๐Ÿ—„๏ธ Database

APIMind uses PostgreSQL.

The database stores:

uploaded_documents
document_chunks
conversations
messages

document_chunks contains the vector embeddings used for semantic retrieval.

pgvector

pgvector enables similarity search directly inside PostgreSQL.

PostgreSQL's full-text search is used as the keyword retrieval component of the hybrid retrieval pipeline.


๐Ÿ” Safety and Guardrails

The project includes several mechanisms to reduce unsafe or unsupported responses.

Documentation-only prompting

The LLM is instructed to answer using only retrieved documentation.

Confidence threshold

Insufficient retrieval evidence can result in an explicit fallback response.

Grounding verification

Generated answers can be checked against retrieved context.

MCP workspace protection

Filesystem tools validate requested paths against the configured workspace.

File-size protection

Large files are rejected by the filesystem reader according to the configured limit.


๐Ÿ“ Project Structure

A simplified structure looks like:

AI_API_Documentation_QnA/
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”œโ”€โ”€ database/
โ”‚   โ”œโ”€โ”€ services/
โ”‚   โ”‚   โ”œโ”€โ”€ chat_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ retrieval_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ vector_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ embedding_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ reranker_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ query_rewriter.py
โ”‚   โ”‚   โ”œโ”€โ”€ confidence_service.py
โ”‚   โ”‚   โ”œโ”€โ”€ document_resolver.py
โ”‚   โ”‚   โ”œโ”€โ”€ ingestion_service.py
โ”‚   โ”‚   โ””โ”€โ”€ llm_service.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ prompts/
โ”‚   โ”œโ”€โ”€ config.py
โ”‚   โ””โ”€โ”€ main.py
โ”‚
โ”œโ”€โ”€ mcp_server/
โ”‚   โ”œโ”€โ”€ server.py
โ”‚   โ”œโ”€โ”€ tools/
โ”‚   โ”‚   โ”œโ”€โ”€ filesystem.py
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ””โ”€โ”€ path_utils.py
โ”‚   โ””โ”€โ”€ config.py
โ”‚
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ .env
โ””โ”€โ”€ README.md

โš™๏ธ Technology Stack

Category

Technology

Language

Python

API Framework

FastAPI

Database

PostgreSQL

Vector Database

pgvector

LLM Provider

Groq

LLM

Llama 3.1 8B Instant

Embeddings

External embedding model

Reranking

Sentence Transformers Cross-Encoder

API Documentation

OpenAPI / Swagger

RAG

Hybrid Retrieval

MCP

Model Context Protocol

MCP Transport

Streamable HTTP

Client Integration

VS Code / Copilot

ORM / DB Access

SQLAlchemy


๐Ÿ“ธ Project Glimpses

Add screenshots from your implementation here.

Recommended screenshots:

1. FastAPI Swagger UI

2. RAG Retrieval Logs

3. MCP Inspector

4. VS Code Copilot + MCP

5. PostgreSQL + pgvector

Glimpse of other MCP tool calls


๐Ÿš€ Future Enhancements

The current implementation focuses on the RAG + MCP foundation.

Possible future improvements:

  • Dedicated generate_code service

  • Language-specific code generation

  • Better API authentication extraction

  • More advanced document routing

  • Multi-document reasoning

  • Evaluation datasets and retrieval metrics

  • Automated RAG evaluation

  • Additional MCP tools

  • Authentication and user-level access control

  • Production deployment


๐ŸŽฏ Project Highlights

APIMind demonstrates practical implementation of:

  • Retrieval-Augmented Generation

  • Hybrid Search

  • Vector Similarity Search

  • PostgreSQL Full-Text Search

  • Reciprocal Rank Fusion

  • Cross-Encoder Reranking

  • Query Rewriting

  • Automatic Document Resolution

  • Confidence Scoring

  • Grounding Verification

  • LLM Integration

  • Model Context Protocol

  • MCP Tool Development

  • FastAPI

  • PostgreSQL + pgvector

The main objective is to make API documentation searchable, contextual, and accessible directly from developer tooling while keeping generated answers grounded in the uploaded documentation.


๐Ÿ‘จโ€๐Ÿ’ป Author

Shubham Raskar

AI / Backend Engineering Project


๐Ÿ“Œ Status

Core RAG

Completed

MCP Integration

Completed

ask_api_documentation

Primary MCP tool โ€” supported

Filesystem MCP tools

Supported

Code Generation

Future enhancement


APIMind AI โ€” Ask your API documentation instead of searching through it.

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

โ€“Maintainers
โ€“Response time
โ€“Release cycle
โ€“Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    Transforms Swagger/OpenAPI documented APIs into conversational interfaces, enabling natural language interaction with APIs through an MCP server for use with AI assistants.
    4
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Provides semantic search over markdown documentation using RAG, allowing natural language queries and integration with MCP clients.
    1
    MIT
  • F
    license
    -
    quality
    C
    maintenance
    Enables natural language queries on technical specifications and automated code compliance checks using local RAG with vector search, integrated via MCP.
  • F
    license
    -
    quality
    C
    maintenance
    Enables semantic search and AI-powered Q&A over ingested GitHub documentation repositories via MCP tools.

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/shubhamimsr/AI-Powered-API-Documentation-Assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server