Gritai Mcp Server Course
FreeNot checkedGritai Mcp Server Course — Model Context Protocol server
About
Gritai Mcp Server Course — Model Context Protocol server
README
This project provides a collection of example MCP (Model Context Protocol) servers built with the Python SDK and specifically FastMCP, designed to be educational and showcase different functionalities. All examples are based on a simple starter server, base_server_template.py.
Developing with Cursor
When using Cursor to develop MCP servers and clients, it is highly recommended to:
Add Documentation to Cursor:
- It's recommended to add the MCP documentation to Cursor's knowledge base:
- Add the MCP documentation (specifically for building with LLMs): https://modelcontextprotocol.io/llms-full.txt
- Add the Python SDK documentation to assist with server development and understanding the SDK: https://github.com/modelcontextprotocol/python-sdk/blob/main/README.md
Prompting:
Prompt Cursor to create your MCP server
Build an MCP server in Python using @MCPPythonDocs that: Exposes a tool method that returns a random motivational quote from our file-based JSON database @motivational_quotes.jsonYou can then iterate and ask Cursor to add more tool calls, even wrap API calls like this:
Help me implement the get_latest_incidents() function that will make use of the open external API that I can access here: curl -X 'GET' \ 'https://api.politiloggen.politiet.no/messages' \ -H 'accept: text/plain'
Best practices:
- Break down complex servers into smaller pieces
- Test each component thoroughly before moving on
- Keep security in mind - validate inputs and limit access appropriately
- Document your code well for future maintenance
- Follow MCP protocol specifications carefully
If you’re pulling data from APIs or databases, consider making your tools async using async def.
Project Structure
base_server_template.py: A minimal MCP server that acts as a template for creating new servers. It includes a basic "greeting" tool.examples/: This directory contains various example MCP servers, each in its own subdirectory.- Each example subdirectory (e.g.,
01_motivational_quotes/) contains the server script (e.g.,01_motivational_quotes_server.py) and any related files (like data files or utility scripts).
- Each example subdirectory (e.g.,
General Setup
- Clone the repository (if you haven't already).
- Ensure Python and
uvare installed.uv venv source .venv/bin/activate
Make sure uv is in your system PATH, or replace "command": "uv" with the full path to the uv executable.
- Install MCP CLI:
uv add "mcp[cli]"
Full documentation here: https://modelcontextprotocol.io/introduction
Navigate to the project directory:
cd /path/to/your/project/gritai-mcp-server-courseEnvironment Variables: Some servers require environment variables (e.g., API keys, AWS profiles, Azure credentials). These are typically loaded from a
.envfile in the root of this project or directly in your environment.Template: See
env.examplesfor a complete template of all environment variables used across examples. Copy it to.envand fill in your actual values:cp env.examples .env # Then edit .env with your actual valuesFor quick reference, here are the main environment variables:
# Example 4: API Key Auth ALPHAVANTAGE_API_KEY="YOUR_ALPHAVANTAGE_KEY" # Examples 5 & 6: AWS Services KNOWLEDGE_BASE_ID="YOUR_AWS_KB_ID" AWS_PROFILE="your-aws-sso-profile" AWS_REGION="your-aws-region" # Example 6: Local RAG with PostgreSQL # PGVECTOR_DB_NAME="vectordb" # PGVECTOR_DB_USER="your_db_user" # PGVECTOR_DB_PASSWORD="your_db_password" # PGVECTOR_DB_HOST="localhost" # PGVECTOR_DB_PORT="5432" # Example 7: Azure AI Search AZURE_SEARCH_ENDPOINT="https://your-service.search.windows.net" AZURE_SEARCH_INDEX="your-index-name" AZURE_SEARCH_KEY="your-api-key" # Optional - omit to use DefaultAzureCredential # Example 8: Azure OAuth Remote Server ENABLE_OIDC="1" # Set to "0" to disable OAuth AZURE_TENANT_ID="your-azure-tenant-id" OIDC_CLIENT_ID="your-azure-app-client-id" OIDC_CLIENT_SECRET="your-azure-app-client-secret" PUBLIC_BASE_URL="https://your-app-url.com" # Must match Azure App registration OIDC_REDIRECT_PATH="/auth/callback" # Optional, defaults to /auth/callback OIDC_ALLOWED_REDIRECT_URIS="http://localhost:*/*,http://127.0.0.1:*/*" # Optional OIDC_REQUIRED_SCOPES="User.Read email openid profile offline_access" # OptionalAWS configuration: Some of the servers make use of AWS services, like Bedrock Knowledge Bases or Embeddings. In order to use these you will need an AWS account, and you will need to use SSO to connect to AWS. The code examples uses the boto3 client. You will need to create an SSO profile, and make sure you are logged in with aws sso login --profile
aws configure sso is a one‑time wizard; afterwards only aws sso login is needed to renew the token.
- Local Vector Database Example 06_local_rag_server illustrates an MCP server running on top of a local Postgresql server with PGVECTOR. Details on the server and RAG pipeline to set up this server is found in the separate RAG project.
Running an Example Server
You can run any example server with the MCP Inspector directly using mcp dev <servername.py> from the gritai-mcp-server-course directory. For example, to run the motivational quotes server:
mcp dev examples/01_motivational_quotes/01_motivational_quotes_server.py
This will allow you to open the MCP Inspector at http://127.0.0.1:6274 🚀
MCP Client Examples
This repository includes example MCP clients demonstrating how to connect to MCP servers over HTTP.
simple_client.py
A basic FastMCP client that connects to a local HTTP MCP server. This example demonstrates:
- Connecting to an MCP server via HTTP
- Listing available tools, resources, and prompts
- Calling tools on the remote server
Usage:
# First, ensure your MCP server is running (e.g., on localhost:8000)
# Then run the client:
uv run simple_client.py
File: simple_client.py
- Description: Connects to
http://localhost:8000/mcpand demonstrates basic client operations - Dependencies:
fastmcp
Note: For OAuth-authenticated servers, use Client("http://localhost:8000/mcp", auth="oauth"). See simple_client_remote01.py and simple_client_remote02.py for examples connecting to remote OAuth-protected servers.
Integrating with Claude (or other MCP Host applications)
To use these example servers with an AI assistant like Claude or Cursor, that implements the MCP Client, you'll need to add a configuration to your LLM's tool settings. The command will typically be uv, and the args will point to the uv run command or mcp run for the specific server script.
Important: In the Claude configurations below, you MUST replace "/path/to/your/project/gritai-mcp-server-course" with the actual absolute path to the gritai-mcp-server-course directory on your system where uv will be executed.
On Windows, remember to use double backslash in your paths.
Alternatively, you can use the mcp install function - which will generate the config and add it to Claude for you.
mcp install examples/01_motivational_quotes/01_motivational_quotes_server.py
If you encounter issues with running your servers in Claude, you might try changing from the uv run approach to the mcp run approach, in particular if you get errors because of missing dependencies.
As an example (applicable to all the below server examples):
```json
"local-rag-server": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with",
"psycopg2-binary",
"--with",
"boto3",
"mcp",
"run",
"/path/to/your/project/gritai-mcp-server-course/examples/06_local_rag/06_local_rag_server.py"
],
"env": {
<variables goes here...>
}
}
```
Base Server Template
base_server_template.py
A very basic server with a hello tool. Serves as a boiler plate for any MCP server.
- File:
base_server_template.py - Description: Greets the user and demonstrates a minimal tool setup.
- Claude Config:
"greeting-server": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "base_server_template.py" ] }
Example Servers
1. Motivational Quotes Server
- Directory:
examples/01_motivational_quotes/ - Server File:
01_motivational_quotes_server.py - Data File:
motivational_quotes.json - Description: Provides a tool to fetch random motivational quotes and a prompt to make a quote funny. Reads quotes from the local
motivational_quotes.jsonfile. - Claude Config:
"motivational-quotes": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/01_motivational_quotes/01_motivational_quotes_server.py" ] }
2. Dummy Finance Tools Server
This server demonstrates MCP Tools, Prompts and Resources.
- Directory:
examples/02_dummy_finance_tools/ - Server File:
02_finance_tools_server.py - Description: Provides basic dummy finance-related tools and resources, such as fetching (mock) earnings for a stock, getting latest NVIDIA earnings (mock), summarizing earnings (prompt), and calculating CAGR.
- Claude Config:
"basic-finance-server": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/02_dummy_finance_tools/02_finance_tools_server.py" ] }
3. Connect to Public API (police-incidents) Server
- Directory:
examples/03_public_api_server/ - Server File:
03_public_api_server.py - Description: Fetches the latest police incidents from the Norwegian Police API. Includes tools to get all latest incidents or incidents by municipality.
- Dependencies:
requests - Claude Config:
"police-incidents": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/03_public_api_server/03_public_api_server.py" ] }
4. API Key Auth (Investment Data) Server
- Directory:
examples/04_apikey_auth/ - Server File:
04_apikey_auth_server.py - Description: Searches for stock tickers using the Alpha Vantage API, which requires an API key set via the
ALPHAVANTAGE_API_KEYenvironment variable. - Dependencies:
requests - Environment Variables:
ALPHAVANTAGE_API_KEY - Claude Config:
"investment-data": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/04_apikey_auth/04_apikey_auth_server.py" ], "env": { "ALPHAVANTAGE_API_KEY": "<your_key_here>" } }
5. AWS Knowledge Base Server
- Directory:
examples/05_aws_knowledge_base/ - Server File:
05_aws_knowledge_base_server.py - Description: Searches an AWS Bedrock knowledge base. Requires AWS credentials (e.g., via an AWS profile specified in
AWS_PROFILE) andKNOWLEDGE_BASE_IDandAWS_REGIONenvironment variables. - Dependencies:
boto3,python-dotenv - Environment Variables:
KNOWLEDGE_BASE_ID,AWS_REGION,AWS_PROFILE(used internally byboto3) - Claude Config:
"aws-knowledgebase-test": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/05_aws_knowledge_base/05_aws_knowledge_base_server.py" ], "env": { "KNOWLEDGE_BASE_ID": "<your_knowledge_base_id", "AWS_REGION": "<your_aws_region>", "AWS_PROFILE": "<your_aws_profile>" } }
In order to gracefully handle SSO token expiry, you will need to add logic to catch token expiry and can then trigger the SSO login flow by for instance calling:
subprocess.run(["aws", "sso", "login", "--profile", PROFILE], check=True)
6. Local RAG Server
- Directory:
examples/06_local_rag/ - Server File:
06_local_rag_server.py - Utility Script:
rag_pipeline.py - Description: A server that performs Retrieval Augmented Generation (RAG) by searching a local knowledge base (PostgreSQL with pgvector) using AWS Bedrock for embeddings. The
rag_pipeline.pyscript contains the core RAG logic. - Dependencies:
psycopg2-binary,boto3 - Environment Variables (for
rag_pipeline.py):AWS_REGION,AWS_PROFILE(for Bedrock embeddings)PGVECTOR_DB_NAME,PGVECTOR_DB_USER,PGVECTOR_DB_PASSWORD,PGVECTOR_DB_HOST,PGVECTOR_DB_PORT(for database connection)
- Claude Config:
"local-rag-server": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/06_local_rag/06_local_rag_server.py" ], "env": { "KNOWLEDGE_BASE_ID": "<your_knowledge_base_id", "AWS_REGION": "<your_aws_region>", "AWS_PROFILE": "<your_aws_profile>", "PGVECTOR_DB_NAME": "", "PGVECTOR_DB_PASSWORD": "", "PGVECTOR_DB_USER": "", "PGVECTOR_DB_HOST": "", "PGVECTOR_DB_PORT": "" } }
7. Azure AI Search Server
- Directory:
examples/07_azure_ai_search/ - Server File:
07_azure_ai_search_server.py - Description: Demonstrates integration with Azure AI Search service. Showcases dual authentication support: API Key (simplest) or DefaultAzureCredential (most secure for production). Performs simple text search with configurable result count.
- Dependencies:
azure-search-documents,azure-identity - Environment Variables:
AZURE_SEARCH_ENDPOINT(required) - Your Azure Search service endpointAZURE_SEARCH_INDEX(required) - Name of the search indexAZURE_SEARCH_KEY(optional) - API key for authentication. If not provided, uses DefaultAzureCredential (Azure CLI, Managed Identity, etc.)
- Claude Config (with API Key):
"azure-ai-search": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/07_azure_ai_search/07_azure_ai_search_server.py" ], "env": { "AZURE_SEARCH_ENDPOINT": "https://your-service.search.windows.net", "AZURE_SEARCH_INDEX": "your-index-name", "AZURE_SEARCH_KEY": "<your_api_key>" } } - Claude Config (with DefaultAzureCredential):
Note: When using DefaultAzureCredential, ensure you've run"azure-ai-search": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/07_azure_ai_search/07_azure_ai_search_server.py" ], "env": { "AZURE_SEARCH_ENDPOINT": "https://your-service.search.windows.net", "AZURE_SEARCH_INDEX": "your-index-name" } }az loginbefore starting Claude Desktop.
8. Azure OAuth Remote Server
- Directory:
examples/08_azure_auth_remote_server/ - Server File:
app.py - Data File:
motivational_quotes.json - Description: An HTTP-based MCP server with Azure Entra ID (Azure AD) OAuth authentication. This server runs as an ASGI application suitable for deployment with Gunicorn/Uvicorn (e.g., on Azure App Service). Demonstrates OAuth-protected tools, user authentication, and remote HTTP server patterns. Includes tools for getting authenticated user info, random quotes, searching quotes, and fetching specific quotes.
- Dependencies:
fastmcp,python-dotenv,starlette - Environment Variables:
ENABLE_OIDC(optional, default: "1") - Set to "0" to disable OAuthAZURE_TENANT_ID(required if OAuth enabled) - Your Azure Tenant IDOIDC_CLIENT_ID(required if OAuth enabled) - Your Azure App Registration Client IDOIDC_CLIENT_SECRET(required if OAuth enabled) - Your Azure App Registration Client SecretPUBLIC_BASE_URL(required if OAuth enabled) - Public URL of your deployed server (must match Azure App registration)OIDC_REDIRECT_PATH(optional, default: "/auth/callback") - OAuth callback pathOIDC_ALLOWED_REDIRECT_URIS(optional) - Comma-separated list of allowed redirect URIsOIDC_REQUIRED_SCOPES(optional) - Space-separated list of required OAuth scopes
- Running the Server:
# Using Uvicorn (development) # From project root: uvicorn examples.08_azure_auth_remote_server.app:app --host 0.0.0.0 --port 8000 # Or using Python module path: cd examples/08_azure_auth_remote_server uvicorn app:app --host 0.0.0.0 --port 8000 # Using Gunicorn (production) gunicorn examples.08_azure_auth_remote_server.app:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000 - Client Configuration: This server exposes an HTTP endpoint at
/mcp. Clients should connect tohttps://your-server-url.com/mcpwith OAuth authentication. Seesimple_client.pyandsimple_client_remote02.pyfor client examples. - Azure App Registration Setup:
- Create an Azure App Registration in Azure Portal
- Configure redirect URIs:
https://your-app-url.com/auth/callback - Set API permissions (scopes):
User.Read,email,openid,profile,offline_access - Create a client secret and note the Client ID, Tenant ID, and Secret
- Update your
.envfile with these values
Note: This server is designed for HTTP deployment, not stdio-based MCP clients like Claude Desktop. For stdio-based integration, use the other example servers. This example is ideal for web-based MCP clients or API integrations.
9. FastMCP UI Apps (Prefab)
Directory:
examples/09_fastmcp_uiapp/Description: Four servers exploring FastMCP 3.0's UI App capabilities using Prefab UI. All four share a common "10 years of random population data" theme and progressively demonstrate the UI App surface — from a plain tool, to a static chart, to an interactive form-driven app, to fully generative UI.
Dependencies:
fastmcp>=3.0.0,prefab-ui(install viauv add "fastmcp>=3.0" prefab-ui)Servers:
09_population_server.py— Plain FastMCP 3 tool returning 10 years of randomized population data. Baseline for comparison with the UI variants.09_population_uiapp_server.py— Same data, rendered as a static PrefabBarChartvia@mcp.tool(app=True). Returns aToolResultso the model also receives a text summary alongside the UI.09_population_fastmcpapp_server.py— Interactive app built withFastMCPApp. Uses the two-decorator pattern:@app.ui()exposes an entry point to the model,@app.tool()exposes a backendregenerate_populationtool that the UI calls from a form submission. State is managed reactively withRxandSetState. Demonstrates Interactive Apps.09_population_generative_server.py— Generative UI. Addsmcp.add_provider(GenerativeUI())which registersgenerate_prefab_uiandsearch_prefab_componentstools, letting the LLM discover components and write Python code that renders in a Pyodide sandbox. Also exposes the raw data tool, so the model can fetch data and render any UI it chooses.
Claude Config (example, repeat for each server):
"population-uiapp": { "command": "uv", "args": [ "--directory", "/path/to/your/project/gritai-mcp-server-course", "run", "examples/09_fastmcp_uiapp/09_population_uiapp_server.py" ] }Testing locally — browser preview: FastMCP 3 ships a built-in dev UI that renders Prefab views without needing an LLM host:
fastmcp dev apps examples/09_fastmcp_uiapp/09_population_uiapp_server.pyOpens a tool picker at
http://localhost:8080where you can invoke the tool directly and see the rendered UI. Works for all four servers; for09_population_generative_server.pyyou'll need to paste Python code into thecodeargument yourself (useful for verifying the sandbox + renderer, but not the full LLM-driven flow).Testing with Claude Desktop: Claude Desktop is the easiest way to exercise the full flow (LLM fetches data, optionally searches components, generates and invokes a Prefab UI). Prefer the
uv --directoryconfig pattern shown above overfastmcp install claude-desktop— the installer defaults touv run --with fastmcp ...which creates an ephemeral env withoutprefab-ui, so any UI App server will crash at import withModuleNotFoundError: No module named 'prefab_ui'. Using--directoryresolves against this project'spyproject.toml/uv.lockwhereprefab-uiis already a dependency.Notes:
- Requires FastMCP 3.x. Earlier 2.x releases do not support
@mcp.tool(app=True),FastMCPApp, orGenerativeUI. - The generative server needs Deno on
PATHfor server-side Pyodide validation (auto-installed on first use). The sandbox only includes the Python standard library and Prefab components — no NumPy/pandas/requests. - Host must support MCP UI resources for rendering (e.g. Claude Desktop with apps preview enabled).
FastMCPAppform submissions do not auto-forward input values to backend tools. Wire them explicitly:CallTool(fn, arguments={"country": Rx("form_country")}).
- Requires FastMCP 3.x. Earlier 2.x releases do not support
This README.md should provide a good overview of your project and how to use the examples. Remember to replace /path/to/your/project/gritai-mcp-server-course in the Claude configurations with the actual path on your system.
Installing Gritai Mcp Server Course
This server has no published package — it is built from source. Open the repository and follow its README.
▸ github.com/astensby/gritai-mcp-server-courseFAQ
Is Gritai Mcp Server Course MCP free?
Yes, Gritai Mcp Server Course MCP is free — one-click install via Unyly at no cost.
Does Gritai Mcp Server Course need an API key?
No, Gritai Mcp Server Course runs without API keys or environment variables.
Is Gritai Mcp Server Course hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Gritai Mcp Server Course in Claude Desktop, Claude Code or Cursor?
Open Gritai Mcp Server Course on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
GitHub
PRs, issues, code search, CI status
by GitHubFilesystem
Secure file operations with configurable access controls.
Memory
Knowledge graph-based persistent memory system.
Template MCP Server
A CLI tool to create a new Model Context Protocol server project with TypeScript support, dual transport options, and an extensible structure
by mcpdotdirectCompare Gritai Mcp Server Course with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All development MCPs
