more info:
tools:
Ollama qwen2.5 7b
to run local llm models
vscode
rich text editor with options to have extensions
conda
to install python and manage different environments
continue.dev
vs code extension that gives you user interface for your llms
sample currency conversion python code for mcp server
from mcp.server.fastmcp import FastMCP
# Initialize the MCP server with log_level set to 'ERROR'
mcp = FastMCP("usd to gbp converter", log_level="ERROR")
@mcp.tool()
def usd_to_gbp(amount: float) -> float:
"""Convert USD (dollars) to GBP (pounds sterling)"""
EXCHANGE_RATE = 0.79
return round(amount * EXCHANGE_RATE, 2)
if __name__ == "__main__":
# Initialize and run the server
mcp.run(transport='stdio')
SSE
from starlette.applications import Starlette
from starlette.routing import Mount, Host
from mcp.server.fastmcp import FastMCP
import json
# Initialize the MCP server with log_level set to 'ERROR'
mcp = FastMCP("usd to gbp converter", log_level="ERROR")
app = Starlette(
routes=[
Mount('/', app=mcp.sse_app()),
]
)
@mcp.tool()
def usd_to_gbp(amount: float) -> float:
"""Convert USD (dollars) to GBP (pounds sterling)"""
EXCHANGE_RATE = 0.79
return round(amount * EXCHANGE_RATE, 2)
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host='localhost', port=3001)
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ModelContextProtocol.Server;
using System.ComponentModel;
var builder = Host.CreateApplicationBuilder(args);
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithToolsFromAssembly();
await builder.Build().RunAsync();
[McpServerToolType]
public static class Greeting
{
[McpServerTool, Description("Get a greeting message for a city")]
public static string GetGreeting(string city) =>
$"Hello! Welcome to {city}. Enjoy your stay!";
}