NH

napthaai/http-oauth-mcp-server

开发工具

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

110 stars 18 forks 质量 56 趋势 0MIT

napthaai/http-oauth-mcp-server 是从 https://github.com/napthaai/http-oauth-mcp-server. 导入的 MCP 服务器候选

概览

napthaai/http-oauth-mcp-server 是从 https://github.com/napthaai/http-oauth-mcp-server. 导入的 MCP 服务器候选

概述(AI 翻译)

引言

该仓库提供了一个参考实现,用于创建支持可流式HTTP和SSE传输的远程MCP服务器,该服务器由OAuth授权,基于MCP规范。

注意,该仓库中的MCP服务器在逻辑上与处理报告SSE + HTTP传输的应用程序以及OAuth是分开的。

因此,你可以轻松分叉这个仓库,插入自己的MCP服务器和OAuth凭证,打造一个有自己功能的SSE/HTTP + OAuth MCP服务器。

但是,为什么?

好问题!MCP规范于2025年3月25日添加了基于OAuth的授权规范。截至2025年5月1日:

  • Typescript SDK 包含许多实现 OAuth 授权的可流式 HTTP MCP 服务器的构建模块,但没有文档或教程
  • Python SDK 既不包含可流式 HTTP 传输的实现,也不包含 typescript SDK 中存在的 OAuth 构建模块的实现

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

README

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

🌊 HTTP + SSE MCP Server w/ OAuth

Introduction

This repo provides a reference implementation for creating a remote MCP server that supports the Streamable HTTP & SSE Transports, authorized with OAuth based on the MCP specification.

Note that the MCP server in this repo is logically separate from the application that handles the report SSE + HTTP transports, and from OAuth.

As a result, you can easily fork this repo, and plug in your own MCP server and OAuth credentials for a working SSE/HTTP + OAuth MCP server with your own functionality.

But, why?

Great question! The MCP specification added the authorization specification based on OAuth on March 25, 2025. At present, as of May 1, 2025:

  • The Typescript SDK contains many of the building blocks for accomplishing an OAuth-authorized MCP server with streamable HTTP, but there is no documentation or tutorial on how to build such a server
  • The Python SDK contains neither an implementation of the streamable HTTP transport, nor an implementation of the OAuth building blocks that are present in the typescript SDK
  • The Streamable HTTP transport is broadly unsupported by MCP host applications such as Cursor and Claude desktop, though it may be integrated directly into agents written in JavaScript using the JS/TS SDK’s StreamableHttpClientTransport class

At Naptha AI, we really wanted to build an OAuth-authorized MCP server on the streamable HTTP transport, and couldn’t find any reference implementations, so we decided to build one ourselves!

Dependencies

Bun, a fast all-in-one JavaScript runtime, is the recommended runtime and package manager for this repository. Limited compatibility testing has been done with npm + tsc.

Overview

This repository provides the following:

  1. An MCP server, which you can easily replace with your own
  2. An express.js application that manages both the SSE and Streamable HTTP transports and OAuth authorization.

This express application is what you plug your credentials and MCP server into.

Note that while this express app implements the required OAuth endpoints including /authorize and the Authorization Server Metadata endpoint (RFC8414), it does not implement an OAuth authorization server!

This example proxies OAuth to an upstream OAuth server which supports dynamic client registration (RFC7591). To use this example, you will need to bring your own authorization server. We recommend using Auth0; see the “Setting up OAuth” Section below.

Configuring your server

Notes on OAuth & Dynamic Client Registration

在 GitHub 查看完整 README

安装

npx mcp-remote --transport http-first https://some-domain.server.com/mcp
新手?先看 mcpskill.org 教程 →