Tools

extract_endpoints

Extract and document REST API endpoints from web frameworks

The extract_endpoints tool scans your codebase for REST API endpoint definitions and extracts them into structured documentation. It supports multiple web frameworks and can export to OpenAPI or Postman formats for API documentation and testing.

How It Works

Stellarion uses regex pattern matching optimized for each supported framework to detect route definitions. It extracts HTTP methods, paths, handlers, parameters, and middleware. The framework is auto-detected from your project configuration, or you can specify it explicitly.

When to Use

  • Documenting API endpoints: Create an inventory of all endpoints
  • Generating API specifications: Export to OpenAPI for documentation tools
  • Creating Postman collections: Generate ready-to-use API test collections
  • Understanding API structure: Get an overview of your API surface
  • API auditing: Review all exposed endpoints for security or completeness

Parameters

ParameterTypeRequiredDefaultDescription
pathstringNo.Directory to scan
frameworkstringNoautoauto, express, fastapi, spring, django, flask, or rails
outputFormatstringNojsonjson, openapi, or postman
groupBystringNo-Group by method, path, or resource
pathPrefixstringNo-Filter endpoints by path prefix
includeParametersbooleanNofalseExtract route parameters
includeHandlersbooleanNofalseInclude handler function names
includeMiddlewarebooleanNofalseInclude middleware chain
includeAuthbooleanNofalseInclude authentication requirements
includeStatisticsbooleanNofalseInclude endpoint statistics

MCP Command Syntax

mcp__stellarion__extract_endpoints framework:express outputFormat:openapi includeParameters:true

Supported Frameworks

FrameworkDetection Patterns
Expressapp.get(), router.get(), app.post(), etc.
FastAPI@app.get(), @router.get(), @app.post(), etc.
Spring@GetMapping, @PostMapping, @RequestMapping, etc.
DjangoURL patterns, class-based views, path(), re_path()
Flask@app.route(), blueprints, @blueprint.route()
Railsroutes.rb definitions, resources, get, post, etc.

Examples

Basic Extraction

Natural Language:

Extract all API endpoints from this project

Direct MCP Call:

mcp__stellarion__extract_endpoints

Returns: List of all detected endpoints with methods and paths


Express Endpoints

Natural Language:

Find all Express routes in the api directory

Direct MCP Call:

mcp__stellarion__extract_endpoints framework:express path:src/api/

With Parameters and Handlers

Natural Language:

Extract endpoints and show their route parameters and handler functions

Direct MCP Call:

mcp__stellarion__extract_endpoints includeParameters:true includeHandlers:true

Generate OpenAPI Specification

Natural Language:

Generate an OpenAPI specification from my API endpoints

Direct MCP Call:

mcp__stellarion__extract_endpoints outputFormat:openapi includeParameters:true

Returns: OpenAPI 3.0 specification document


Create Postman Collection

Natural Language:

Create a Postman collection for testing my API

Direct MCP Call:

mcp__stellarion__extract_endpoints outputFormat:postman includeParameters:true

Returns: Postman Collection v2.1.0 ready for import


Group by Resource

Natural Language:

Show me endpoints grouped by resource (users, products, orders, etc.)

Direct MCP Call:

mcp__stellarion__extract_endpoints groupBy:resource includeStatistics:true

Filter by Path Prefix

Natural Language:

Extract only the API endpoints (paths starting with /api)

Direct MCP Call:

mcp__stellarion__extract_endpoints pathPrefix:/api includeStatistics:true

Include Authentication Info

Natural Language:

Show me all endpoints with their authentication requirements

Direct MCP Call:

mcp__stellarion__extract_endpoints includeAuth:true includeMiddleware:true

FastAPI Endpoints

Natural Language:

Extract all FastAPI endpoints with their parameters

Direct MCP Call:

mcp__stellarion__extract_endpoints framework:fastapi includeParameters:true includeHandlers:true

Output Formats

JSON (Default)

Standard JSON with endpoint details:

{
  "endpoints": [
    {
      "method": "GET",
      "path": "/api/users/:id",
      "handler": "getUser",
      "file": "src/routes/users.ts",
      "line": 45,
      "parameters": [
        { "name": "id", "type": "path", "required": true }
      ]
    }
  ],
  "statistics": {
    "total": 24,
    "byMethod": { "GET": 12, "POST": 6, "PUT": 4, "DELETE": 2 }
  }
}

OpenAPI 3.0

Complete OpenAPI specification compatible with Swagger UI, Redoc, and other documentation tools:

openapi: 3.0.0
info:
  title: API Documentation
  version: 1.0.0
paths:
  /api/users/{id}:
    get:
      operationId: getUser
      parameters:
        - name: id
          in: path
          required: true

Postman Collection v2.1.0

Ready-to-import Postman collection:

{
  "info": {
    "name": "API Collection",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "item": [...]
}

Output Details

Each endpoint includes:

FieldDescription
HTTP methodGET, POST, PUT, DELETE, PATCH
Path patternRoute path with parameters
Handler functionName of the handler (when enabled)
File locationSource file path
Line numberWhere the route is defined
Route parametersPath and query parameters (when enabled)
MiddlewareMiddleware chain (when enabled)
AuthenticationAuth requirements (when enabled)

Statistics

When includeStatistics: true:

MetricDescription
Total countNumber of endpoints
By methodBreakdown by HTTP method
By prefixEndpoints grouped by path prefix
CoverageFiles scanned vs. files with routes

Grouping Options

Group ByDescription
methodGroup by HTTP method (GET, POST, etc.)
pathGroup by path prefix (/api/users, /api/products)
resourceGroup by extracted resource name (users, products)

Tips for Best Results

  1. Use framework: "auto" for automatic detection - usually works well
  2. Filter with pathPrefix: "/api" to focus on API routes only
  3. Use outputFormat: "openapi" for documentation tools
  4. Use outputFormat: "postman" for API testing
  5. Include includeParameters: true for complete endpoint information

Common Workflows

API Documentation

# Extract endpoints with full details
mcp__stellarion__extract_endpoints outputFormat:openapi includeParameters:true includeHandlers:true

# Save the OpenAPI spec for documentation tools

Security Audit

# List all endpoints with auth info
mcp__stellarion__extract_endpoints includeAuth:true includeMiddleware:true groupBy:path

# Review which endpoints are protected

API Testing Setup

# Generate Postman collection
mcp__stellarion__extract_endpoints outputFormat:postman includeParameters:true

# Import into Postman for testing