Skip to content

Instantly share code, notes, and snippets.

View vguhesan's full-sized avatar
💭
Greatest time in all of human history to be alive! Stay Thirsty, My Friend!

Venkatt Guhesan vguhesan

💭
Greatest time in all of human history to be alive! Stay Thirsty, My Friend!
View GitHub Profile
@vguhesan
vguhesan / README.md
Created February 16, 2026 23:43
MCP Server/Client as a proxy to existing Java Spring REST API

MCP Server/Client as a proxy to existing Java Spring REST API

In this example, we will build a MCP Server/Client as a proxy to existing Java Spring REST API.

Assume an existing Spring Boot REST API app with a ProductController exposing /products endpoints. We'll add MCP support using Spring AI.

  1. Add Dependencies (pom.xml):
// Filename: McpServerApp.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import org.springframework.ai.mcp.Tool;
import org.springframework.ai.mcp.ToolCallbacks;
@SpringBootApplication
@vguhesan
vguhesan / README.md
Created February 16, 2026 22:42
Example of existing API exposed as an MCP Server using annotations

MCP Server + Client Example (leveraging existing REST APIs)

To expose existing Python code as an MCP server, use fastMCP's decorators to annotate functions as tools or resources. This involves:

  • Wrapping existing functions with @mcp.tool for executable actions or @mcp.resource for data access.
  • Adding type hints and docstrings for automatic schema generation.
  • Handling context if needed (e.g., for logging or nested calls).

Assume existing code in existing_math.py with functions subtract and get_pi. (see file)

@vguhesan
vguhesan / README.md
Created February 16, 2026 22:26
MCP Server & Client Python Example Using fastMCP Framework

MCP Server & Client Python Example Using fastMCP Framework

In this example, we will be creating an example of a MCP Server & Client Python Example Using fastMCP Framework

fastMCP is a popular Python framework for building MCP servers and clients. It abstracts protocol details, allowing focus on logic via decorators like @tool and @resource. Below are step-by-step examples with full, working code.

MCP Server in Python Using fastMCP

@vguhesan
vguhesan / README.md
Last active February 17, 2026 00:50
RAG Implementation using LangChain, OpenAI, [ChromaDB or SingleStore]

RAG Implementation using LangChain, OpenAI, with ChromaDB or SingleStore

(LangChain, OpenAI, with ChromaDB or SingleStore)

This solutioning requires internet and API access to tools and services externally

A simple RAG system over a text document using LangChain, OpenAI for embeddings/LLM, and Chroma as the vector DB.

Prerequisites

Install packages

@vguhesan
vguhesan / README.md
Last active February 17, 2026 00:57
RAG Implementation / No Public API Services required / Locally Running LLM Model

RAG Implementation

No Public API Services required

Locally Running LLM Model

This is a RAG implementation example with no internet based API or tools.

Single-file RAG pipeline using:

  • LlamaIndex (open source)
  • Local Ollama (llama3 for both embeddings + generation)
  • SingleStore DB (local vector store)
@vguhesan
vguhesan / gist:0720251db8dc60a19a9d389a38b7a860
Created February 16, 2026 01:31
TamperMonkey / UserScripts for widening teh Grok results panel
// ==UserScript==
// @name Grok Wide Output Results Panel
// @namespace http://digitalriver.blog/grok-wide-output
// @version 2026-02-16
// @description Makes the Grok Results Output be wider
// @author Venkatt Guhesan
// @match https://grok.com/
// @icon https://grok.com/images/favicon.ico
// @grant none
// ==/UserScript==
@vguhesan
vguhesan / gist:9218edc81ba233bced88f0fe406f1ad0
Created February 16, 2026 01:30
Widen Grok Results Panel
// Run me in a developer JavaScript Console
// Need to place this in a TamperMonkey UserScripts soon
var targetElem = document.querySelector('html > body > div:nth-of-type(2) > div:nth-of-type(2) > div > div > main > div:nth-of-type(2)');
targetElem.style.setProperty("--content-max-width", "70rem");
@vguhesan
vguhesan / gist:b0e39e3ffa5744ade12c87a367833a7d
Created June 1, 2025 16:22
Prune / Remove all contents of node-modules directory in all subdirectories below current working directory
#!/bin/bash
# Delete all node_modules directories recursively
find . -type d -name "node_modules" -print0 | xargs -0 rm -rf
echo "All node_modules directories deleted."
@vguhesan
vguhesan / gist:db179f07fc41925c7286bed2ecf255bc
Created June 1, 2025 16:20
Space used in current directory
du -sh * | sort -h | tail -n 10