CM

chawengwit/mcp

API 开发

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

0 stars 0 forks 质量 69 趋势 4

Phases 1–9.5 shipped — stdio, HTTP, OAuth 2.0 Authorization Server (RFC 8414/7591/7636/9728), per-user multi-tenant sessions, CORS, STDIO keyring auth, and LLM-facing endpoint metadata.

概览

Phases 1–9.5 shipped — stdio, HTTP, OAuth 2.0 Authorization Server (RFC 8414/7591/7636/9728), per-user multi-tenant sessions, CORS, STDIO keyring auth, and LLM-facing endpoint metadata. Verified end-to-end against (STDIO + natural language) and (HTTP + OAuth dance against a real Service API). . Public-deploy recipe (Phase 10) is the next milestone. See docs/testing-user-ux.md for the test playbook, the Development Roadmap, or docs/plan.md. A Python-based that acts as a unified data gateway, enabling Claude (and other MCP clients) to send and receive data across multiple external APIs through a single, secure interface. This MCP server provides: - for multiple data types - supporting any REST or GraphQL endpoint - via an operator-run scripts/oauth_login.py (PKCE flow, 127.0.0.1 callback) - using system keyring - evolution in the future Files marked exist today. Files marked are upcoming phases. Per-module responsibilities and detailed module-by-module breakdown: docs/plan.

README

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

MCP Data Gateway

Status: OAuth Provider live. Phases 1–9.5 shipped — stdio, HTTP, OAuth 2.0 Authorization Server (RFC 8414/7591/7636/9728), per-user multi-tenant sessions, CORS, STDIO keyring auth, and LLM-facing endpoint metadata. Verified end-to-end against Claude Desktop (STDIO + natural language) and MCP Inspector (HTTP

A Python-based Model Context Protocol (MCP) server that acts as a unified data gateway, enabling Claude (and other MCP clients) to send and receive data across multiple external APIs through a single, secure interface.

Overview

This MCP server provides:

  • Generic data handling for multiple data types
  • Generic API gateway supporting any REST or GraphQL endpoint
  • OAuth 2.0 authentication via an operator-run scripts/oauth_login.py (PKCE flow, 127.0.0.1 callback)
  • Secure credential storage using system keyring
  • Foundation for MCP App evolution in the future

Features

Feature Description
Multi-API Support Connect to any number of external services through unified configuration
REST + GraphQL Native support for both REST and GraphQL APIs
OAuth 2.0 Full authorization code flow + PKCE, run once via scripts/oauth_login.py
Token Refresh Silent refresh inside Credentials.get() when ≤ 5 min from expiry
Secure Storage Credentials stored in OS keyring (Keychain / Credential Manager / Secret Service)
Generic Data Models Flexible schemas to handle any data shape
Predictable Auth Surface Tools return AUTH_REQUIRED when no token; operator runs scripts/oauth_login.py to obtain one

Architecture

Files marked (implemented ✓) exist today. Files marked (planned) are upcoming phases.

MCP/
├── src/
│   ├── server.py              # MCP server entry point (implemented ✓)
│   ├── auth/                  # OAuth 2.0 + keyring (implemented ✓)
│   │   ├── oauth.py           # PKCE auth-code flow, callback server bound to 127.0.0.1
│   │   └── credentials.py     # Keyring-backed store with peek/get/store/clear
│   ├── gateway/               # REST/GraphQL HTTP client (implemented ✓)
│   │   ├── api_client.py      # RestClient + GraphQLClient with retry, redacted logging
│   │   └── handlers.py        # Response normalization, size enforcement, error mapping
│   ├── models/                # Pydantic data models (planned)
│   │   └── data_models.py
│   ├── tools/                 # MCP tool definitions (implemented ✓)
│   │   ├── builtin.py         # list_apis tool
│   │   ├── registry.py        # ToolRegistry / ToolSpec
│   │   ├── context.py         # ToolContext dependency container
在 GitHub 查看完整 README

安装

npx @modelcontextprotocol/inspector
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "data-gateway": { "command": "/path/to/mcp-data-gateway/.venv/bin/python", "args": ["/path/to/mcp-data-gateway/src/server.py"] } } }