- Model Context Protocol (MCP) Server
Model Context Protocol (MCP) Server
Content
Model Context Protocol (MCP) Server
A simple MCP server built with FastAPI that processes numerical inputs by doubling them, with support for session management and API key authentication.
Setup
- Install the required dependencies:
pip install -r requirements.txt
- Start the server:
uvicorn main:app --reload
The server will be running at http://localhost:8000
API Endpoints
POST /mcp/process
Processes a list of numerical inputs by doubling each value.
Request Body:
{
"inputs": [1.0, 2.0, 3.0]
}
Headers (optional):
session_id: To maintain state between requestsapi_key: For authentication (demo key: "demo_key")
Response:
{
"outputs": [2.0, 4.0, 6.0],
"session_id": "generated-session-id"
}
Excel VBA Integration
You can use the following VBA code to integrate with the MCP server from Excel:
Sub CallMCPServer()
' Define the input range
Dim inputRange As Range
Set inputRange = Range("A1:A3")
' Create an HTTP request
Dim request As Object
Set request = CreateObject("MSXML2.XMLHTTP")
' Prepare JSON data
Dim jsonData As String
jsonData = "{""inputs"": ["
Dim cell As Range
Dim first As Boolean
first = True
For Each cell In inputRange
If Not first Then
jsonData = jsonData & ", "
End If
jsonData = jsonData & cell.Value
first = False
Next cell
jsonData = jsonData & "]}"
' Send the request
request.Open "POST", "http://localhost:8000/mcp/process", False
request.setRequestHeader "Content-Type", "application/json"
request.send jsonData
' Handle the response
If request.Status = 200 Then
Dim response As Object
Set response = ParseJson(request.responseText)
' Display the outputs
Dim outputStr As String
outputStr = "Processed outputs: " & vbCrLf
Dim i As Integer
For i = 1 To response.Item("outputs").Count
outputStr = outputStr & response.Item("outputs").Item(i) & vbCrLf
Next i
MsgBox outputStr, vbInformation, "MCP Server Response"
' Optionally store the session ID for future requests
Dim sessionId As String
sessionId = response.Item("session_id")
Else
MsgBox "Error: " & request.Status & " - " & request.responseText, vbExclamation
End If
End Sub
Function ParseJson(jsonString As String) As Object
' This is a simplified JSON parser for demo purposes
' For production use, consider a proper JSON library
Dim ScriptEngine As Object
Set ScriptEngine = CreateObject("ScriptControl")
ScriptEngine.Language = "JScript"
Dim JsonCode As String
JsonCode = "JSON.parse('" & Replace(jsonString, "'", "\'") & "');"
Set ParseJson = ScriptEngine.Eval(JsonCode)
End Function
For modern Excel with Office Scripts, you can use JavaScript/TypeScript with fetch API to make HTTP requests to the MCP server.
Notes
- The server includes CORS middleware to allow cross-origin requests from web-based Excel clients
- Session state is stored in memory and will be lost if the server restarts
- For production use, consider using a database for session storage and proper authentication
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Serper MCP ServerA Serper MCP Server
CursorThe AI Code Editor
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
WindsurfThe new purpose-built IDE to harness magic
DeepChatYour AI Partner on Desktop
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
ChatWiseThe second fastest AI chatbot™
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题;
Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Amap Maps高德地图官方 MCP Server