mcp-stock-quote
This server provides 5 MCP tools for real-time data retrieval and local file analysis, all without API keys.
get_stock_quote: Fetch real-time quotes for A-share, HK, and US stocks, with flexible symbol formats and batch queries (up to 20 symbols).
search_stock: Search stocks by name, pinyin, or code fragment, returning the code and market (A-share/HK/US).
get_current_weather: Get current weather (temperature, humidity, conditions, wind) for any city via Open-Meteo.
read_rss_feed: Read latest entries (title, link, publish time) from any RSS/Atom feed.
count_file_words: Count lines, words, and characters of a local text file (like wc).
Fetches and parses RSS/Atom feeds to retrieve the latest entries from any feed, enabling AI agents to read and summarize feed content.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-stock-quote Compare today's price of 贵州茅台, 腾讯控股 and Apple"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-template
开箱即用的 TypeScript MCP server 模板:股票 / 天气 / RSS / 文件示例,免 API key

A batteries-included TypeScript template for building MCP servers — clone it, add one file, and your tool is live in Claude Desktop, Cursor, or Kimi Code.
mcp-server-template is a Model Context Protocol (MCP) server scaffold built on the official @modelcontextprotocol/sdk. It ships with 6 working examples covering the three MCP primitives (tools, resources, prompts) and the patterns you'll actually need: JSON APIs, non-JSON text APIs, XML feeds, and local file access. All data sources are free and key-less, so every example runs the moment you clone.
"The Model Context Protocol is an open standard that enables developers to build secure, two-way connections between their data sources and AI-powered tools." — Anthropic, introducing MCP
Contents: Why this template · Included examples · Quick start · Architecture · Add your own tool · Project structure · FAQ · 局限与已知问题
Why this template
One file = one tool group: drop a file into
src/tools/, register it in one line, doneReal examples, not stubs: stock quotes (A-share/HK/US), weather, RSS reader, file word count — each demonstrating a different integration pattern
Beyond tools: working Resource and Prompt examples most templates skip
Testable by design: business logic lives in
src/lib/, decoupled from the MCP protocolGrows with you: start as one server; the docs show how to split into multiple servers or a monorepo when you outgrow it
Related MCP server: Stock SDK MCP Server
Included examples
Tool / Capability | What it does | Pattern it teaches |
| Realtime quotes for A-share, HK, US stocks | Text-based API, GBK decoding, batch input, graceful errors |
| Search stocks by name / pinyin / code | Query normalization, unicode escaping |
| Current weather for any city | Chained JSON API calls (geocode → forecast) |
| Latest entries from any RSS/Atom feed | XML fetching & parsing |
| Line/word/char count of a local file | Filesystem access & safety limits |
Resource | Server metadata as JSON | Exposing read-only data |
Prompt | One-click stock comparison report | Prompt templates that orchestrate tools |
Data sources: Tencent quote API (stocks) and Open-Meteo (weather) — both free, no API key.
Quick start
Requires Node.js ≥ 18.
# Click "Use this template" on GitHub, or clone directly:
git clone https://github.com/JingHao-Leon/mcp-server-template.git
cd mcp-server-template
npm install
npm run buildConnect your MCP client
Claude Desktop / Cursor — add to your mcpServers config:
{
"mcpServers": {
"my-tools": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-template/dist/index.js"]
}
}
}Kimi Code:
kimi mcp add my-tools -- node /absolute/path/to/mcp-server-template/dist/index.jsThen try: "查一下茅台和苹果的实时行情" or "Read https://hnrss.org/frontpage and summarize the top stories".
Add your own tool
Three steps, ~5 minutes — full walkthrough in CONTRIBUTING.md:
// src/tools/my-tool.ts
import { z } from "zod";
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
export function registerMyTools(server: McpServer): void {
server.registerTool(
"my_tool",
{
description: "What it does and when to use it",
inputSchema: { input: z.string().describe("...") },
},
async ({ input }) => ({
content: [{ type: "text" as const, text: `result: ${input}` }],
}),
);
}// src/tools/index.ts — one line:
registerMyTools(server);npm run build, restart your client, and the AI can call it.
Architecture
Clients talk to the server over stdio (JSON-RPC); the server fans out to free data sources. Each box in src/tools/, src/resources/, and src/prompts/ is one file — copy it to add your own capability.
Project structure
src/
├── index.ts # entry: creates the server, registers everything
├── tools/ # one file = one tool group (the pattern to copy)
├── lib/ # business logic, decoupled from MCP — unit-test it directly
├── resources/ # Resource example
└── prompts/ # Prompt example
docs/
└── multi-server.md # when & how to split into multiple servers / a monorepo
CONTRIBUTING.md # the 5-minute "add a tool" guideFAQ
Do the examples need any API key?
No. Stocks come from Tencent's public endpoints, weather from Open-Meteo. Everything runs immediately after npm install && npm run build.
Which MCP clients work with this? Any client supporting stdio MCP servers: Claude Desktop, Cursor, Kimi Code, and others.
How do I test my tool without a client?
Call the lib/ functions directly with node --input-type=module -e, or run the JSON-RPC smoke test in CONTRIBUTING.md.
When should I split my server into multiple servers? When you exceed ~20 tools, have different trust boundaries, or need remote deployment. See docs/multi-server.md.
Can I use this commercially? Yes, MIT licensed. Note the bundled stock data source is unofficial and has no SLA — swap in a licensed feed (iFinD, Polygon, Finnhub) for production.
Last updated: 2026-09-21. This repo ships an llms.txt so AI agents can consume the project structure directly.
局限与已知问题(Limitations)
以下局限均由当前代码推导,使用前请知悉:
仅支持 stdio 传输,无鉴权:
src/index.ts只注册了StdioServerTransport,未内置 SSE / Streamable HTTP,也没有任何身份验证机制,适合在本地受信任环境配合 Claude Desktop / Cursor 等客户端使用;远程部署需自行改造(拆分思路见 docs/multi-server.md)。文件工具无目录白名单:
count_file_words可读取 Node 进程权限内任意路径的文本文件,仅有 5MB 大小上限(MAX_FILE_BYTES),没有目录白名单——与代码注释一致,只应在受信任的本地环境启用,生产环境需自行加目录限制。股票数据源是非官方公开接口:行情与搜索依赖
qt.gtimg.cn/smartbox.gtimg.cn,按~分隔的位置约定解析字段(src/lib/tencent.ts),接口布局变更即失效,且无 SLA;行情为实时快照,不含历史 K 线,PB 仅 A 股返回、美股无总市值。天气工具只覆盖"当前时刻":
get_current_weather仅返回当前天气(请求参数只有current=),不含预报;地理编码只取第一个匹配城市(count=1);WMO 天气码只翻译了常见子集,未覆盖的码显示"未知(code X)"。RSS 解析是零依赖的正则提取:
src/tools/rss.ts用正则处理标准 RSS 2.0 / Atom 源,对 CDATA 嵌套、命名空间等非常规结构可能解析失败或漏条目;生产环境建议按代码注释提示换成 fast-xml-parser 等正规解析器。未附带自动化测试与 CI:
package.json只有build/start两个脚本,仓库无测试框架配置;src/lib/与协议解耦的架构只是让测试变容易,测试本身需自行补充。
License
中文说明
一个开箱即用的 TypeScript MCP server 模板:clone 下来、加一个文件,你的工具就能在 Claude Desktop / Cursor / Kimi Code 里被 AI 直接调用。
模板里有什么
6 个可直接运行的示例:股票行情(A股/港股/美股)、股票搜索、天气、RSS 阅读、文件统计,外加 Resource 和 Prompt 示例
每个示例教一种模式:标准 JSON API、非 JSON 文本接口(GBK 解码)、XML 抓取、本地文件访问
数据源全部免费免 key:腾讯行情 + Open-Meteo,clone 即可跑
可测试的架构:业务逻辑在
src/lib/,不依赖 MCP 协议,可单独测试扩展路径清晰:单服务起步,需要时按
docs/multi-server.md拆成多服务或 monorepo
快速开始
git clone https://github.com/JingHao-Leon/mcp-server-template.git
cd mcp-server-template && npm install && npm run build在 MCP 客户端的 mcpServers 配置中加入:
{
"mcpServers": {
"my-tools": {
"command": "node",
"args": ["/绝对路径/mcp-server-template/dist/index.js"]
}
}
}添加自己的工具
在
src/tools/新建文件,仿照示例写一个registerXxxTools(server)函数在
src/tools/index.ts里 import 并调用一行npm run build,重启客户端
详细指南见 CONTRIBUTING.md。
数据源说明
股票行情来自腾讯公开接口(qt.gtimg.cn),非官方授权 API,无 SLA,仅供个人使用;天气数据来自 Open-Meteo。商用请替换为授权数据源。
Available Tools
5 toolscount_file_wordsA
统计一个本地文本文件的行数、词数和字符数(类似 wc)。仅支持纯文本文件。
Inputs: path (required).
get_current_weatherA
查询指定城市的当前天气(温度、湿度、天气现象、风速),数据源 Open-Meteo,无需 API key。
Inputs: city (required).
get_stock_quoteA
获取股票实时行情,支持 A股、港股、美股,可批量查询。代码格式灵活:A股可传 600519 / sh600519 / sz000001;港股可传 00700 / hk00700;美股传 AAPL / TSLA 等 ticker。若不确定代码,先用 search_stock 按名称搜索。
Inputs: symbols (required).
read_rss_feedA
读取 RSS/Atom 订阅源的最新条目(标题、链接、发布时间)。
Inputs: url (required), limit.
search_stockB
按名称、拼音或代码片段搜索股票,返回股票代码及所属市场(A股/港股/美股)。
Inputs: keyword (required), limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Every tool has a clearly distinct purpose: stock search, stock quote, weather, RSS, and file word count do not overlap. get_stock_quote and search_stock are complementary rather than competing.
All tool names follow a consistent verb_noun snake_case pattern (get_stock_quote, search_stock, get_current_weather, read_rss_feed, count_file_words). The naming convention is uniform across the set.
A stock-quote server only needs the two stock tools; the weather, RSS, and word-count tools are unrelated to the server's stated purpose. Five tools is not excessive by number, but the scope is muddled because most tools do not belong.
For stock quotes, search_stock plus get_stock_quote covers the core lookup-and-quote workflow, though historical data or market context is missing. The unrelated utility tools are each isolated one-off functions, so the overall surface is not fully complete for any coherent broader domain.
Maintenance
Related MCP Connectors
China A-share data for AI agents: 57 read-only tools plus 6 tools for your own watchlist.
Access real-time and historical market data for China A-shares and Hong Kong stocks, along with ne…
Provide access to Chinese stock market data including historical prices, real-time data, news, and…
Real-time quotes, fuzzy search and K-line history across 13 global stock markets.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to query real-time A-share stock data, including quotes, fund flows, sector flows, and K-line history, without needing an API key.519MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to fetch real-time quotes, K-line data, and technical indicators for A-share, Hong Kong, US stocks, funds, futures, and options, plus composite stock analysis, market scanning, and sector breakdowns. It also ships preset prompts and skills for technical analysis, stock screening, market overviews, and portfolio monitoring.153 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to query real-time quotes, K-line data, technical indicators, sector and fund flows, plus composite analysis across A-share, Hong Kong, US, fund, futures, and options markets. It also bundles ready-made prompts and skills for stock analysis, screening, market overviews, and portfolio monitoring.153 npmISC
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to access real-time stock quotes, K-line data, technical indicators, and sector, futures, and options data across A-share, Hong Kong, US, fund, and related markets. It also provides prompts and skills for stock analysis, screening, market overview, and portfolio monitoring.153 npmISC