Skip to content

avinashpancham/mcp-poc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Model Context Protocol: examples using STDIO and SSE

Google released a great tutorial on using Gemini together with the Model Context Protocol (MCP). It shows how easily you can connect Gemini to a tool, and how simple it is to modify for your use case.

STDIO

See stdio/main.py on how I used the code Google provides and slightly modify it to let Gemini connect to my local kubernetes cluster using an MCP extension for Kubernetes. Running it is done as follows and should give the following output:

# From the directory mcp-poc/stdio
export GEMINI_API_KEY="YOUR_KEY"
uv run main.py

sse

SSE

The only issue I found with the examples from Google is that the MCP servers run locally, meaning that every client has to run the server. It would be better to have a dedicated server clients can connect to. After looking into the modelcontextprotocol Github repo I found the mcp_simple_tool example that has an example of running your MCP server either locally using stdio or on a 'different' server which then allows connection with HTTP and Server Side Events (SSE).

I therefore took both the mcp_simple_tool example and the weather MCP @philschmidt made as inspiration and combined it to get a weather MCP that works with SSE. The code can be found in the directory sse. It runs as follows and should give the following output:

Terminal 1

# From the directory mcp-poc/sse
uv run server.py

Terminal 2

# From the directory mcp-poc/sse
export GEMINI_API_KEY="YOUR_KEY"
uv run main.py

sse

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages