mcp-research

mcp-research

An incremental financial-data MCP server built on Cloudflare, currently offering a read-only Hono API for accounts, transactions, and analytics with D1 and Drizzle. Future plans include OAuth and MCP integration.

Category
访问服务器

README

MCP Research

A TypeScript monorepo containing a read-only financial API and stateless remote MCP server on Cloudflare. Both transports share the same user-scoped application services backed by Cloudflare D1 and Drizzle ORM. The MCP endpoint supports development bearer tokens and an OAuth 2.1 authorization-code flow with PKCE.

Requirements and setup

  • Node.js 24 LTS or newer
  • pnpm 10.33.0 (pinned through packageManager)
  • A Cloudflare account only when deploying
corepack enable
pnpm install
cp apps/finance-api/.dev.vars.example apps/finance-api/.dev.vars
pnpm --filter @mcp-research/finance-api db:migrate:local
pnpm --filter @mcp-research/finance-api db:seed:local
pnpm dev

The local Worker is then available at the URL printed by Wrangler. GET / is a public health check. Financial endpoints require one of the development-only bearer tokens configured in .dev.vars:

curl -H 'Authorization: Bearer dev-alice' \
  'http://localhost:8787/v1/transactions?from=2026-06-01&to=2026-06-30'

The development authentication mechanism refuses all requests unless ENVIRONMENT=development. It must be replaced with the OAuth authorization context before production deployment.

MCP

The Streamable HTTP MCP endpoint is available at:

POST /mcp

It exposes four read-only tools:

get_financial_overview
list_transactions
get_transaction
summarize_cashflow

For a quick local connection, start the Worker and run MCP Inspector:

pnpm dev
npx @modelcontextprotocol/inspector@latest

Connect the Inspector to http://localhost:8787/mcp. The OAuth flow signs in through GitHub, verifies the immutable numeric GitHub user ID against an owner allowlist, and then displays the MCP consent screen. Direct development protocol requests can instead use Authorization: Bearer dev-alice or Authorization: Bearer dev-bob.

The MCP server is stateless: every request creates a new MCP server and transport. Tool handlers call the same application services as the Hono routes and never make loopback HTTP requests.

OAuth

The Worker provides the MCP OAuth endpoints and discovery documents:

GET|POST /authorize
GET      /callback
POST     /token
POST     /register
GET      /.well-known/oauth-protected-resource
GET      /.well-known/oauth-authorization-server

Only the finance:read scope is supported. OAuth grants carry an internal userId; MCP tools derive ownership from that grant and never accept a user ID as input. The verified GitHub identity is mapped to the pre-existing financial owner through the identity_links table.

Create a GitHub OAuth App with http://localhost:8787/callback as its local callback URL, then configure these ignored .dev.vars values:

FINANCE_OWNER_USER_ID=usr_alice
GITHUB_ALLOWED_USER_ID=<immutable numeric GitHub user ID>
GITHUB_CLIENT_ID=<OAuth App client ID>
GITHUB_CLIENT_SECRET=<OAuth App client secret>

The authenticated GitHub ID must exactly match GITHUB_ALLOWED_USER_ID. On the first successful owner login, the server may create that one identity link to FINANCE_OWNER_USER_ID; it never creates financial users. All other valid GitHub accounts receive 403. Use a separate GitHub OAuth App with the deployed HTTPS callback URL for production, and store its client secret with wrangler secret put rather than in source control.

For a remote deployment, create a KV namespace for OAuth token and grant storage and replace the placeholder OAUTH_KV ID in apps/finance-api/wrangler.jsonc:

pnpm --filter @mcp-research/finance-api exec wrangler kv namespace create OAUTH_KV

If a browser-based MCP client uses a different origin, add it to the comma-separated MCP_ALLOWED_ORIGINS binding. Requests without an Origin header are supported; untrusted supplied origins receive 403.

API

All financial routes derive the user ID from the authenticated principal. No route accepts a caller-supplied user ID.

GET /v1/me
GET /v1/accounts
GET /v1/accounts/:accountId
GET /v1/balances
GET /v1/transactions?account_id=&from=&to=&cursor=&limit=
GET /v1/transactions/:transactionId
GET /v1/analytics/cashflow?from=&to=

Amounts are integers in minor currency units. Transaction listings use an opaque cursor and default to 50 results, with a maximum of 100.

Database

The Drizzle schema lives in apps/finance-api/src/db/schema.ts. After changing it, generate a migration with:

pnpm --filter @mcp-research/finance-api db:generate

The committed D1 identifier is a local placeholder. Before remote deployment, create the database and replace database_id in apps/finance-api/wrangler.jsonc with the returned ID:

pnpm --filter @mcp-research/finance-api exec wrangler d1 create finance-api-db
pnpm --filter @mcp-research/finance-api exec wrangler d1 migrations apply finance-api-db --remote
pnpm --filter @mcp-research/finance-api exec wrangler d1 execute finance-api-db --remote --file=./seed/production-bootstrap.sql

The deterministic development seed is for local development and integration tests only. The production bootstrap inserts the configured owner without adding sample financial data; keep its user ID aligned with FINANCE_OWNER_USER_ID.

Quality checks

pnpm test
pnpm format:check
pnpm lint
pnpm typecheck
pnpm build

The Worker test suite runs inside Cloudflare's Workers runtime and applies the D1 migrations to isolated local storage.

GET / returns:

{ "service": "mcp-research-finance-api", "status": "ok" }

Run pnpm --filter @mcp-research/finance-api types after changing wrangler.jsonc bindings; Wrangler generates apps/finance-api/worker-configuration.d.ts, which TypeScript consumes through the API tsconfig. Deploy with pnpm --filter @mcp-research/finance-api run deploy after configuring a real D1 database and production authentication.

Structure

apps/finance-api/src/         Hono routes, MCP tools, OAuth, services, repositories, and schema
apps/finance-api/migrations/  generated D1 migrations
apps/finance-api/seed/        deterministic development data
apps/finance-api/test/        Worker-runtime integration tests
tsconfig.base.json            shared strict TypeScript settings
turbo.json                    workspace task graph

The architecture is deliberately one Worker. /v1 and /mcp are transport adapters over shared finance services. Separate Workers or applications should be introduced only when operational or security boundaries justify them.

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

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

官方
精选