Learn how to use Model Context Protocol (MCP) actions in a SpinAI application that can control Github using Smithery’s MCP
💡 Quick Start: If you want to skip the manual setup, you can select the GitHub MCP Agent
template instead of the default template. This will automatically configure everything we’ll cover in steps 1-5, and you can jump straight to running the agent (don’t forget to setup your environment variables, though!).
.env
file in your project root and add the following variables:
repo
access to create and manage repositoriesread:user
for basic profile information.env
file as the GITHUB_TOKEN
value.env
file to version control. It should belisted in your .gitignore
, but in case it’s not, make sure it is.
mcp-config.ts
file with the GitHub MCP configuration.
NOTE: It’s highly recommended to keep your GITHUB_TOKEN in your .env
and either import it in your mcp-config.ts, or in the next step.
src/index.ts
file and replace the boilerplate code with:
createActionsFromMcpConfig
translates our MCP configuration into SpinAI actionsinput
in your code to make the agent perform different GitHub tasks. For example: