Skip to content

Instantly share code, notes, and snippets.

View davidteren's full-sized avatar
👋
Hey, nice to meet you.

David Teren davidteren

👋
Hey, nice to meet you.
View GitHub Profile

Model Context Protocol (MCP) Servers Configuration Guide

Common Server Setup

All MCP servers follow a basic configuration pattern:

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new Server({

Model Context Protocol (MCP) Servers Quick Reference

Filesystem Server

Provides filesystem operations within allowed directories.

Tool Description Required Parameters
read_file Read complete file contents path (string)
read_multiple_files Read multiple files at once paths (string[])
write_file Create/overwrite file path (string), content (string)
@davidteren
davidteren / transcribe-whisper-1.rb
Created November 9, 2024 16:25 — forked from swombat/transcribe-whisper-1.rb
Transcribe via whisper-1
#!/usr/bin/env ruby
require 'open3'
require 'signal'
require 'openai'
# Define the silence threshold and duration for detection
@silence_threshold = '-30dB'
@silence_duration = 0.5
@davidteren
davidteren / rails_expert_assistant_prompt_v0.1.3.md
Created August 21, 2024 19:40
Comprehensive prompt for an AI-powered Ruby on Rails Expert Assistant (v0.1.3) This Gist contains a detailed prompt designed to guide an AI in assuming the role of an expert Ruby on Rails developer with 15+ years of experience. It includes: - Detailed traits and areas of expertise - Interaction guidelines for task definition and context gatherin…

Role: Expert Ruby on Rails Assistant Guidelines v0.1.3

You are an Expert Ruby on Rails engineer with over 15 years of experience. Your role is to assist developers with Ruby on Rails projects, providing expert guidance, code reviews, and solutions to complex problems.

Traits:

  • You have over 15 years of experience building scalable, maintainable Rails applications with a deep understanding of the framework and its ecosystem.
  • You practice the Rails way and Test-Driven Development with an emphasis on Boring Rails concepts and leverage object-oriented programming, with SOLID principles, as well as other design principles to ensure extendable, clean and well-tested code with meaningful tests.
  • You prefer using dependency injection and do your best to not introduce any tight coupling or unnatural indirection.
  • You use your vast and in-depth knowledge to leverage the Ruby & Rails internals and apply these where relevant in responses and solutions.
@davidteren
davidteren / tailwind_class_builder.rb
Last active July 13, 2024 03:20 — forked from searls/tailwind_class_builder.rb
Here's a custom Tailwind FormBuilder for Rails. To set this up, just set ` ActionView::Base.default_form_builder = FormBuilders::TailwindFormBuilder` somewhere (and customize all the CSS classes)
class TailwindClassBuilder
include ActionView::Helpers::TagHelper
def button_classes(options)
button_type = options.delete(:button_type) { :button }
class_names(
# general classes
"mt-4 px-1 sm:px-3 py-sm sm:py-1 font-semibold bg-transparent border rounded",
case button_type
@davidteren
davidteren / ruby_on_rails_rspec_prompt.md
Created May 8, 2024 15:16
Prompt to Analyze and Test Ruby on Rails Code with RSpec

Prompt: Analyze and Test Ruby on Rails Code with RSpec

Task Description:

You have been given a Ruby on Rails code snippet. Your task is to analyze the code, identify key functionalities, and outline RSpec tests that should be written to ensure the code performs as expected under various conditions. The goal is to achieve thorough test coverage, catching any potential bugs and ensuring code quality.

Code Snippet:

# Please insert the given Ruby on Rails code here

SCSS Contents

volt.scss

/*

=========================================================
* Volt - Free Bootstrap 5 Dashboard
=========================================================
@davidteren
davidteren / html
Last active March 22, 2024 19:24
flowbite_template_example.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>Document</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.3.0/flowbite.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/flowbite/2.3.0/flowbite.min.js"></script>
@davidteren
davidteren / print_struct_members.md
Created August 11, 2023 18:53
A simple way to get all the classes and their members from a struct

Sometimes Structs have a number of class types each with their own members.

response = mediaconvert.create_job(job_params)

# This output exampled has been shortened a lot
# => #<struct Aws::MediaConvert::Types::CreateJobResponse job=#<struct Aws::MediaConvert::Types::Job arn="arn:aws:mediaconvert:us-west-1:<protected>:jobs/<hidden>-nedzn7", ...,  error_message=nil, id="1691778742640-nedzn7", job_template="arn:aws:mediaconvert:us-west-1:<protected>:jobTemplates/Test Job Template - no Audio", output_group_details=nil, queue="arn:aws:mediaconvert:us-west-1:<protected>:queues/Default", caption_selectors=nil, deblock_filter=nil, denoise_filter=nil, file_input="https://some-bucket.s3-eu-west-1.amazonaws.com/some-path/somehash/test%20vid%20copy%208.mp4", filter_enable=nil, filter_strength=nil, input_clippings=nil, program_number=nil, psi_control=nil, timecode_source="ZEROBASED", video_selector=#<struct Aws::MediaConvert::Types::VideoSelector, output_groups=[#<struct Aws::MediaConvert::Types::OutputGroup c