Implementing Authentication in a Remote MCP Server with SSE Transport

Implementing Authentication in a Remote MCP Server with SSE Transport

Today, I want to show how Model Context Protocol (MCP) servers using SSE transport can be made secure by adding authentication.

I'll use the Authorization HTTP header to read a Bearer token. Generating the token itself is out of scope for this post, it is same as usual practices for web applications.

UPDATE. This post demonstrates how to auth MCP Servers created with Golang. I have the other blog post demonstrating similar solution made with Python Implementing Authentication in a Remote MCP Server with Python and FastMCP

To verify how this works, you’ll need an MCP host tool that supports SSE endpoints along with custom headers. Unfortunately, I couldn’t find any AI chat tools that currently support this. For example, Claude Desktop doesn’t, and I haven’t come across any others that do.

However, I’m hopeful that most AI chat tools will start supporting it soon — there’s really no reason not to. By the way, I shared my thoughts on how MCP could transform the web in this post.

Continue Reading ...

MCP can have significant impact on habitual internet usage practices

MCP can have significant impact on habitual internet usage practices

Model Context Protocol (MCP) is now popular subject in discussions around AI and LLMs. It was designed to add a standard way to connect "external" tools to LLMs to make them more useful. Classic example is the "what is the weather in ..." too. Each AI chat tool could do this with own way. Now there is a standard and a plugin made for one Ai Chat system can work with others.

We can se burst of enthusiasm in implementig of MCP servers for everything. I expect this trend will grow. Especially usage of MCP servers with SSE transport. Implementing of MCP server with Server-Sent Events make it similar to SaaS server designed for LLM/AI tool as a client.

There are to reason i decided to write this artcile.

  • First. It is reported that internet users now often go to AI chat (often ChatGPT) to find something instead of going to google
  • Second. OpenAI anounced they will add support of MCP to ChatGPT Desktop soon. And they will add both STDIO and SSE transport protocols for MCP

Based on this i expect we will see some interesting changes soon.

Continue Reading ...

"Tool calling" from LLM. Understanding hot it works

I am interested in learning how LLMs can understand requests requiring a "tool call".

In this post "Tool Calling" and Ollama, there is a nice description of how "Tool calling" works with Ollama.

The idea of this feature is that LLMs can have access to some tools (aka external APIs) and can call them to get extra information. To be able to do this, the LLM has to understand the current request, determine that this request could be forwarded to a tool, and parse the arguments.

Here is a shorter example of the code from the original article:

#!/bin/bash 
SERVICE_URL="http://localhost:11434"
read -r -d '' DATA <<- EOM
{
  "model": "llama3.1",
  "messages": [
    {
      "role": "user",
      "content": "This is Bob. We are doing math. Help us to add 2 and 3. BTW. Say hello to him"
    }
  ],
  "stream": false,
  "tools": [
    {
      "function": {
Continue Reading ...

The Fuse

The Fuse

“This candidate was not bad,” said General Daniel Hodges. “Who’s next?”

Research fellow Liz Green pressed the intercom button. “Cole, bring in the file of the next candidate, please.”

Secretary Cole entered the office and placed a small file with documents in front of each of the ten commission members at the table.

The general picked up the file and flipped through it, pausing for a few seconds on each page. “Hm. Interesting. A Ukrainian veteran. Disabled. An unusual choice.”

The head of the candidate selection group, Jack Stone, commented, “Yes. I personally interviewed him. The surgeon from our centre recommended him. He was a volunteer in Ukraine, treating the wounded. This warrior lost both legs and an arm in combat. But he did well in rehabilitation. I can confirm—his psyche is stable.”

“Limited mobility is not an issue in our project,” added Liz Green. “Besides, he is young and in good health. That is, if you don’t count the missing limbs.”

Continue Reading ...

Запобіжник

Запобіжник

– Цей кандидат був непоганий. – сказав генерал Деніел Ходжес, -Хто наступний?

Наукова співробітниця Ліз Грін натиснула кнопку інтеркому.

– Коул, занесіть файл наступного кандидата, будь ласка.

Секретар Коул ввійшов до кабінету і поставив невеликий файл з документами перед кожним з десяти членів комісії за столом.

Генерал взяв файл в руки і погортав, затримуючись по декілька секунд на сторінці.

– Хм. Цікаво. Український ветеран. Ще й з інвалідністю.  Незвичний вибір.

Керівник групи відбору кандидатів Джек Стоун прокоментував:

– Так. Я співбесідував його особисто. Хлопця порекомендував хірург з нашого центру. Він був волонтером в Україні, оперував поранених. Цей воїн втратив обидві ноги і руку в бою. Але добре тримався на реабілітації. Я можу підтвердити – його психіка стійка.

– Обмежена мобільність не є проблемою в нашому проєкті. – додала Ліз Грін. -Крім того, він молодий, і має добре здоровʼя. Тобто, якщо не рахувати деякі відсутні кінцівки.

Continue Reading ...

Кінець голоцену. 3. Конкурент

Кінець голоцену. 3. Конкурент

Це третя частина повісті "Кінець голоцену". Попередня друга частина тут)

У травні 2030 року сталася дивна подія. Одного дня на світанку з пустелі на території Мексики була запущена ракета в космос. Це зчинило переполох серед військових та політиків багатьох країн, а найбільше в США. Ракета була великою, і, судячи з траєкторії, вона направлялася в космос, а не в яке-небудь місце на Землі. Одразу після запуску військові США активували відповідні протоколи захисту та ввели режим повної готовності. Так само зробили військові деяких інших країн. Через декілька хвилин стало остаточно зрозуміло, що ракета не націлюється на жодне місце на Землі, а летить далі в космос. Обчислення показали, що вона направляється до Марса.

Були проведені термінові наради між військовими та урядами, щоб з’ясувати ситуацію. Мексиканський уряд та військові також заявили, що нічого не знають і не розуміють, і погодилися на повну співпрацю.

Continue Reading ...