loading…
Search for a command to run...
loading…
An MCP server hosted on AWS Lambda that provides tools for retrieving user profiles and loan details via API Gateway. It enables GPT models to interact with str
An MCP server hosted on AWS Lambda that provides tools for retrieving user profiles and loan details via API Gateway. It enables GPT models to interact with structured user and financial data using the Streamable HTTP transport.
Simple GPT app backend that exposes two MCP tools to GPT via a server running on AWS:
user_idloan_idThe backend is an MCP server on AWS Lambda behind API Gateway (HTTP API). GPT (OpenAI Responses API) talks to it using the Streamable HTTP MCP transport.
gpt_mcp/
├── src/
│ ├── handler.py # Lambda entrypoint
│ ├── requirements.txt # Lambda deps (for sam build)
│ └── mcp_server/
│ ├── __init__.py
│ └── server.py # MCP server + get_user_info, retrieve_loan_info
├── template.yaml # AWS SAM template (Lambda + HTTP API)
├── requirements.txt # Local dev deps
└── README.md
Create a venv and install deps:
python -m venv .venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # macOS/Linux
pip install -r requirements.txt
The tools use in-memory mock data in server.py. For local testing without Lambda, you can use the MCP Python SDK with stdio or run the Lambda handler via a local Lambda runtime (e.g. SAM CLI).
Install AWS SAM CLI
Install the AWS SAM CLI.
Build and deploy
cd c:\Users\Andrew\Documents\gpt_mcp
sam build
sam deploy --guided
Use the default stack name (or choose one), set Stage (e.g. dev), and accept defaults for the rest unless you need a different region or bucket.
Get the MCP server URL
After deploy, SAM prints the stack outputs. Use the McpApiUrl value, e.g.:
https://<api-id>.execute-api.<region>.amazonaws.com/mcp
If your HTTP API uses the $default stage, the URL might be:
https://<api-id>.execute-api.<region>.amazonaws.com/$default/mcp
Use the URL that works when you call it from the OpenAI API (see below).
Use the OpenAI Responses API with the mcp tool type and your deployed URL as server_url. GPT will discover and call get_user_info and retrieve_loan_info from your backend.
from openai import OpenAI
client = OpenAI()
resp = client.responses.create(
model="gpt-4o", # or another MCP-capable model
tools=[
{
"type": "mcp",
"server_label": "gpt-app",
"server_description": "User and loan info for the GPT app.",
"server_url": "https://<your-api-id>.execute-api.<region>.amazonaws.com/mcp",
"require_approval": "never",
}
],
input="What is the balance for loan_001?",
)
print(resp.output_text)
curl https://api.openai.com/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{
"model": "gpt-4o",
"tools": [{
"type": "mcp",
"server_label": "gpt-app",
"server_description": "User and loan info.",
"server_url": "https://<your-api-id>.execute-api.<region>.amazonaws.com/mcp",
"require_approval": "never"
}],
"input": "Get user info for user_001"
}'
Replace https://<your-api-id>.execute-api.<region>.amazonaws.com/mcp with your McpApiUrl from the SAM deploy output.
ChatGPT / GPT in the OpenAI UI
Remote MCP is used via the Responses API (or products built on it). In the ChatGPT UI you typically use Actions/connectors; for a custom backend like this you’d integrate via your own app that calls the Responses API with the mcp tool and this server_url.
Require approval
Set "require_approval": "always" if you want to approve each tool call; use "never" for automatic calls (only if you trust the MCP server).
Auth
If you add auth (e.g. API key or OAuth), pass it in the authorization field of the MCP tool config and protect your API Gateway (e.g. Lambda authorizer or API key).
| Tool | Description | Parameters |
|---|---|---|
get_user_info |
Get user profile by user ID | user_id |
retrieve_loan_info |
Get loan details (balance, terms…) | loan_id |
Mock data in src/mcp_server/server.py includes user_001, user_002, loan_001, and loan_002. Replace _get_user_from_store and _get_loan_from_store with DynamoDB, RDS, or your internal APIs for production.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"gpt-mcp-app-user-loan-info-tools": {
"command": "npx",
"args": []
}
}
}