Cover image
Try Now
2025-03-21

AI用途的简单模型上下文服务器(MCP)

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

MCP (Model Context Protocol)

by Gaurav Kabra

The Model Context Protocol (MCP) is a standardized way, introduced by Anthropic, for LLMs to interact with external tools and functions and injecting context in LLMs. It allows models to:

  • Request real-time information
  • Execute actions in external systems
  • Access specialized knowledge
  • Interact with APIs and services

→ Agents → MCP The 2nd figure is like this:

So we improve and get to the 3rd figure, which is similar to: The MCP is similar to USB hub in above picture. Due to it being a standard, changes become in a standard way. So less chances of API breaking since each MCP server is now being maintained by individual companies (Yahoo or Google etc.) and we just integrate with them.

An MCP server will expose 3 things:

Tool: Resource: includes knowledge base, DB, files etc. Prompt:

You can refer this for above images.

Setup From Scratch

mkdir mcpserver
npm init
npm install @modelcontextprotocol/sdk

See this for official documentation.

Now in Cursor IDE, click on Settings cog -> MCP. Create the file mcp.json and put below code:

{
    "mcpServers": {
        "Gaurav Kabra's MCP Server": {
        "command": "node",
        "args": ["/Users/gauravkabra/Desktop/MCPServer/index.js"]
        }
    }
}

Replace args with absolute path (full path) of index.js on your local.

And now it should show the add tool available:

You can find documentation here.

Do CMD + I and ask to add two numbers and you should see a response which we coded in index.js.

STDIO (Standard Input-Output) is ideal on local but for remote we use SSE transport (Server Sent Event). See this to know more.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

    Reviews

    1 (1)
    Avatar
    user_CYGCABS7
    2025-04-16

    MCP-Server-AI is an exceptional server tool developed by kabragaurav. Its functionality is impressive, providing seamless AI integration for various applications. The GitHub repository (https://github.com/kabragaurav/MCP-Server) is well-documented, making it easy to implement. Highly recommended for anyone looking to enhance their project with robust AI capabilities!