MA

muhammed-abdelghany/rest_api_mcp

API 开发

本页由 AI 翻译,技术细节请以原文为准。 查看原文

6 stars 3 forks 质量 71 趋势 14MIT

A Model Context Protocol (MCP) server for authenticated REST APIs. Drop it into any project, point it at your API, and let AI agents call endpoints — with , , , and — all without writing a single...

概览

A Model Context Protocol (MCP) server for authenticated REST APIs. Drop it into any project, point it at your API, and let AI agents call endpoints — with , , , and — all without writing a single line of auth code. No installation needed. Add this to your project's .vscode/mcp.json and VS Code will download and run the package automatically: This always uses the latest published version from npm. See VS Code mcp.json Examples for a full config. Add this to your project's .vscode/mcp.json: That's it. The agent can now: 1. Search for endpoints by keyword 2. Call any endpoint with automatic authentication 3. Fetch the full OpenAPI spec for schema inspection All configuration is done via environment variables in mcp.json. No code changes required. See Environment Variables Reference for the full list. Fuzzy-search the API spec by keyword. Returns matching endpoints with method, path, summary, tags, and required parameters.

README

以下为原文 README 节选,完整内容请查看原文。

rest-api-mcp

A Model Context Protocol (MCP) server for authenticated REST APIs.
Drop it into any project, point it at your API, and let AI agents call endpoints — with auto-login, 2FA support, Swagger spec fetch, and fuzzy endpoint search — all without writing a single line of auth code.


Table of Contents


Features

Capability Description
Auto-login Logs in automatically before every request; re-logins when token expires
Token caching 20-second TTL cache — survives rapid sequential calls
Auto-discovery Finds the login endpoint by scanning the Swagger spec (no config needed)
Auto token detection Tries 9 common token paths (data.access_token, accessToken, token, …)
AI-driven token detection inspect_login tool exposes raw responses + heuristic suggestions so the AI can pick the exact token path
2FA / OTP support Two-step auth: login → verify-otp, session identifiers forwarded automatically
Custom session fields Override hardcoded session candidates via verify_session_fields in request()
Extra login fields source, userRole, channel, device_id — any field, via JSON env var
Fuzzy endpoint search Find endpoints by keyword across path, summary, description, tags, operationId
Swagger spec fetch Retrieve and inspect the full OpenAPI spec
SSL bypass Optional for staging/dev environments with self-signed certs
Response truncation Configurable size limit to keep responses in context

Installation

No installation needed. Add this to your project’s .vscode/mcp.json and VS Code will download and run the package automatically:

{
  "command": "npx",
  "args": ["-y", "rest-api-mcp"]
}

This always uses the latest published version from npm. See VS Code mcp.json Examples for a full config.

Option B — Use locally (for development / offline)

git clone https://github.com/Muhammed-AbdelGhany/rest_api_mcp
cd rest_api_mcp
npm install && npm run build

Then point VS Code at the local build:

{
在 GitHub 查看完整 README

安装

npx -y rest-api-mcp
新手?先看 mcpskill.org 教程 →