GPT MCP App - User & Loan Info Tools

GPT MCP App - User & Loan Info Tools

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.

Category
访问服务器

README

GPT MCP App – User & Loan Info Tools

Simple GPT app backend that exposes two MCP tools to GPT via a server running on AWS:

  • get_user_info – Retrieve user profile by user_id
  • retrieve_loan_info – Retrieve loan details by loan_id

The 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.

Project layout

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

Run locally (optional)

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).

Deploy to AWS

  1. Install AWS SAM CLI
    Install the AWS SAM CLI.

  2. 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.

  3. 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).

Connect GPT to your MCP server

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.

Example (Python)

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)

Example (curl)

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).

Tools

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.

Security and production

  • Auth: Add API Gateway authorization (e.g. IAM, Lambda authorizer, or API key) and/or validate tokens inside the Lambda.
  • Data: Do not rely on in-memory data in production; use a real store and restrict access by identity.
  • HTTPS: API Gateway provides HTTPS; keep the MCP server URL on HTTPS when configuring GPT.

References

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选