Skip to main content
Glama
zhenzp

Fund MCP Server

by zhenzp

fund.knoewledge

Search and retrieve financial fund information from a knowledge base using keywords, enabling users to query fund data through natural language.

Instructions

获取的知识库列表信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kwNo关键词,支持模糊查询
pageSizeNo每页数量,默认10
pageNumNo页码,默认1

Implementation Reference

  • The core handler function for the 'fund.knoewledge' tool. Parses input args, constructs API URL with query params, fetches from KB_API_URL, and returns the JSON response as standardized content.
    async function handleKnowledge(args: unknown) { const { kw = "", pageSize = 10, pageNum = 1 } = knowledgeSchema.parse(args); const url = new URL(KB_API_URL); url.searchParams.set("kw", kw); url.searchParams.set("pageSize", String(pageSize)); url.searchParams.set("pageNum", String(pageNum)); const response = await fetch(url.toString(), { method: "GET", headers: { Accept: "application/json", }, }); if (!response.ok) { throw new Error( `Knowledge API request failed: ${response.status} ${response.statusText}` ); } let data: any; try { data = await response.json(); } catch (e) { throw new Error("Knowledge API returned invalid JSON"); } // Normalize basic shape: { code, msg, result } console.log('handleKnowledge', data) return { content: [{ type: "text", text: JSON.stringify(data) }], }; }
  • Zod schema used in the handler to validate and parse input parameters for the knowledge query (kw, pageSize, pageNum).
    const knowledgeSchema = z.object({ kw: z.string().optional().default(""), pageSize: z.number().int().positive().optional(), pageNum: z.number().int().positive().optional(), });
  • Tool registration entry in getAllTools() array, defining name, description, and input schema for MCP tool discovery.
    { name: 'fund.knoewledge', description: '获取的知识库列表信息', inputSchema: { type: 'object', properties: { kw: { type: 'string', description: '关键词,支持模糊查询' }, pageSize: { type: 'number', description: '每页数量,默认10' }, pageNum: { type: 'number', description: '页码,默认1' } }, } },
  • Dispatch logic in handleToolRequest that routes 'fund.knoewledge' calls to the handleKnowledge function.
    if (name === "fund.knoewledge") { return await handleKnowledge(args); }
  • API endpoint URL configuration for the knowledge base query, with env var fallback.
    const KB_API_URL = process.env.FUND_KB_API_URL || "https://reportdev.haiyu.datavita.com.cn/api/admin/knowledge/query"
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhenzp/fund-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server