No description available
A robust, free, ready-to-use Rails boilerplate for building AI-powered applications that integrate seamlessly with Claude AI using the Model Context Protocol (MCP). This boilerplate includes user authentication and OAuth2 provider capabilities out of the box.
git clone https://github.com/f/mcp-startup-boilerplate mcp-startup
cd mcp-startup
bundle install
yarn install
rails db:create db:migrate db:seed
Set your Stripe API keys in your environment:
export STRIPE_PUBLISHABLE_KEY="pk_test_your_key"
export STRIPE_SECRET_KEY="sk_test_your_key"
export STRIPE_WEBHOOK_SECRET="whsec_your_webhook_key"
For development, you can also update these in config/initializers/stripe.rb
rails server
Your application should now be running at http://localhost:3000
This application comes with built-in Stripe payment processing for MCP tools:
The application includes a PaidTool
base class that allows you to easily create tools that require payment:
class YourPaidTool < PaidTool
description "Your paid tool description"
# Custom pricing (optional, defaults to $0.05)
def price_cents
8 # $0.08 per call
end
def call
return { error: "User has no active subscription" } unless charge_user
# Your implementation here after charge
end
end
You can customize pricing and behavior by:
price_cents
to set custom pricing for specific toolsThis boilerplate comes with a complete OAuth2 server implementation powered by Doorkeeper. Key endpoints:
/oauth/authorize
/oauth/token
/oauth/applications
/oauth/revoke
The OAuth server supports:
This boilerplate is pre-configured to work with Claude AI through the Model Context Protocol, enabling AI applications to securely access your application's data and functionality.
users/me
- Access information about the authenticated userMeTool
- Get information about the currently authenticated user (do not delete it)FinancialCalculatorTool
- Example paid calculator toolTo connect your application with Claude:
{
"mcpServers": {
"your-server-name": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://your-server-url/mcp/sse"
]
}
}
}
For Claude Desktop, this file is located at:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
app/tools/
:class YourTool < ApplicationTool
description 'Your tool description'
arguments do
required(:param_name).filled(:string).description('Parameter description')
end
def call(param_name:)
# Your implementation
# Access the current authenticated user
user = current_user
# Do something with the user data
{ user_id: user.id, result: "Processed data for #{user.email}" }
end
end
app/resources/
:class YourResource < ApplicationResource
uri 'your/resource/path'
resource_name 'Your Resource'
description 'Your resource description'
mime_type 'application/json'
def content
# Access the current authenticated user
user = current_user
JSON.generate({
user_id: user.id,
email: user.email,
# Additional user-specific data
custom_data: user.custom_data
})
end
end
Both MCP Tools and Resources have access to the current_user
method, which returns the authenticated user from the OAuth token. This allows you to:
For security reasons, always verify user permissions before exposing sensitive data or performing critical operations.
This project is available under the MIT License.
Contributions, issues, and feature requests are welcome!
{ "mcpServers": { "mcp-startup-boilerplate": { "command": "npx", "args": [ "-y", "mcp-remote", "http://your-server-url/mcp/sse" ] } } }
Related projects feature coming soon
Will recommend related projects based on sub-categories