TypeScript MCP server with SSE transport and Bearer authentication

TypeScript MCP server with SSE transport and Bearer authentication

mcp-sse-br-silvano•bybr-silvano

An MCP server implementation in TypeScript that uses Server-Sent Events for remote message transport and Bearer token authentication, exposing tools callable over the MCP protocol.

License: MIT License•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Serves MCP tools over a remote connection using Server-Sent Events transport.
  • •Authenticates incoming requests by verifying a Bearer token provided in the Authorization header.
  • •Registers four example tools performing the four basic math operations to demonstrate tool registration and execution.
  • •Uses a modular structure separating the MCP server, middlewares, routes and configuration, with an Express server exposing SSE and message endpoints.

BEST FOR

  • •Developers wanting a reference implementation of a remote MCP server with SSE and token-based authentication.
  • •Testing MCP tools live through the MCP inspector web interface.
  • •Debugging and development without precompilation by running the TypeScript sources directly with ts-node.

ABOUT MCP-SSE-BR-SILVANO

TypeScript MCP server with SSE transport and Bearer authentication is cataloged as an MCP server attributed to br-silvano. An MCP server implementation in TypeScript that uses Server-Sent Events for remote message transport and Bearer token authentication, exposing tools callable over the MCP protocol. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for TypeScript MCP server with SSE transport and Bearer authentication are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How does the server receive MCP messages from clients?

Clients establish an SSE connection and then post messages to the messages endpoint, which forwards them to the MCP server and returns responses over SSE.

What kinds of tools does the example server register?

It registers four simple tools that perform the four basic math operations.

上游原版 README

在 GitHub 查看同一版本原文

README.md · eafacd25761e · 采集于 2026-11-13 12:38:36 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MCP Server com SSE e Autenticação Bearer

Build

Este projeto é uma implementação de um MCP Server (Model Context Protocol) construído em TypeScript. Ele utiliza Server-Sent Events (SSE) para o transporte remoto de mensagens e autenticação baseada em Bearer Token, permitindo a comunicação segura e em tempo real com clientes, como hosts de LLM (ex.: Claude Desktop).


Índice


Visão Geral

Este projeto implementa um servidor MCP que expõe ferramentas (tools) para serem chamadas via protocolo MCP, utilizando SSE para comunicação em tempo real e autenticando requisições através de um token Bearer. Saiba mais sobre o protocolo MCP no site oficial


Arquitetura

A arquitetura do projeto é composta pelos seguintes módulos:

  • MCP Module: Responsável pela criação e configuração do servidor MCP, incluindo o registro de ferramentas.
  • Middlewares: Inclui o middleware de autenticação (Bearer Token) e o middleware condicional para o processamento de JSON, garantindo que o fluxo de dados no endpoint /messages não seja consumido indevidamente.
  • Rotas: Define os endpoints do Express para estabelecer a conexão SSE (/sse) e para a recepção de mensagens (/messages).
  • Config: Armazena configurações como token de autenticação e porta do servidor.
  • App: Centraliza a configuração do Express, integração dos middlewares e rotas, e o início do servidor.

Recursos e Funcionalidades

  • Transporte SSE: Conexão remota em tempo real usando Server-Sent Events.
  • Autenticação Bearer: Verificação de segurança via token fornecido no header Authorization.
  • Ferramentas de Exemplo: Quatro ferramentas simples que realizam as quatro operações básicas de matemática, demonstrando a estrutura de registro e execução de ferramentas no MCP Server.
  • Estrutura Modular: Separação de responsabilidades conforme os princípios SOLID e Clean Code.
  • Desenvolvimento com ts-node: Execução direta dos arquivos TypeScript sem necessidade de pré-compilação (ideal para desenvolvimento e debugging).

Requisitos

  • Node.js (versão 20 ou superior)
  • npm
  • TypeScript
  • ts-node (para desenvolvimento)
  • Ambiente compatível com WSL (se aplicável)

Instalação e Configuração

  1. Clone o repositório:

    git clone <URL_DO_REPOSITORIO>
    cd mcp-sse
    
  2. Instale as dependências:

    npm install
    
  3. Configuração:

    • Token de Autenticação: Crie um arquivo .env na raiz do projeto e defina o token Bearer:

      BEARER_TOKEN=meu-token-secreto
      PORT=3001
      
    • O projeto utiliza variáveis de ambiente para carregar essas configurações em runtime.


Execução

Usando ts-node

Durante o desenvolvimento, é possível executar o servidor sem pré-compilá-lo:

npm run dev

ℹ️ Nota: o script "start" no package.json está configurado para uso com node e exige build prévio via tsc.


Usando @modelcontextprotocol/inspector

Para visualizar e testar as ferramentas MCP em tempo real via interface web, execute:

npm run dev:inspect

💡 Esse comando utiliza ts-node para rodar o projeto sem build prévio. 🔐 A interface ficará disponível em: http://127.0.0.1:6274


Build e Execução em Produção

Para compilar os arquivos TypeScript:

npm run build

Depois, execute a versão compilada:

node dist/index.js

Diagrama de Sequência

O fluxo de comunicação e uso do MCP Server está ilustrado no diagrama abaixo:

@startuml

title "Fluxo de Comunicação do MCP Server com SSE e Autenticação Bearer"

actor "MCP Client" as Client

participant "Express Server" as Express
participant "Auth Middleware" as Auth
participant "Route /sse" as SSERoute
participant "SSE Server Transport" as SSE
participant "MCP Server" as MCP
participant "Route /messages" as MsgRoute

== Estabelecimento da Conexão ==
Client -> Express: GET /sse\n(Authorization: Bearer <token>)
Express -> Auth: Verifica header Authorization
Auth --> Express: Token válido\n(continua)
Express -> SSERoute: Rota /sse invocada
SSERoute -> SSE: Cria nova instância SSEServerTransport
note right of SSE: Armazena sessionId
SSE -> SSERoute: Retorna transport
SSERoute -> Express: Retorna resposta SSE
Express -> MCP: mcpServer.connect(transport SSE)
MCP -> SSE: Inicia comunicação\n(enviar mensagens iniciais)
SSE -> Client: Envia eventos SSE\n(ex.: lista de tools)

== Envio de Mensagem (POST /messages) ==
Client -> Express: POST /messages?sessionId=XYZ\n(Corpo da mensagem)
Express -> MsgRoute: Rota /messages invocada
MsgRoute -> SSE: Procura transporte pelo sessionId
SSE -> MsgRoute: Transport encontrado
MsgRoute -> SSE: transport.handlePostMessage(request)
SSE -> MCP: Encaminha mensagem recebida
MCP -> SSE: Processa mensagem e retorna resposta
SSE -> Client: Envia resposta via SSE

== Encerramento da Conexão ==
Client -> Express: Fecha conexão SSE
Express -> SSE: Detecta fechamento da conexão
SSE -> Express: Notifica desconexão
Express -> SSERoute: Remove transporte (sessionId)
@enduml

Nome Recomendado: "Diagrama de Sequência - Fluxo de Comunicação do MCP Server com SSE e Autenticação Bearer".


Contribuição

Contribuições são bem-vindas! Se você deseja melhorar este projeto:

  1. Faça um fork e clone o repositório.
  2. Crie uma branch para a sua feature ou correção.
  3. Submeta um Pull Request com suas alterações, seguindo as diretrizes de código e mantendo os princípios SOLID e Clean Code.

Licença

Este projeto está licenciado sob a MIT License.


Documentação atualizada em 15/04/2025.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for TypeScript MCP server with SSE transport and Bearer authentication from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-sse-br-silvano)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools