Skip to main content
Glama
pjqdyd

MCP-TS-DEMO

by pjqdyd

MCP-TS-DEMO TypeScript MCP服务案例Demo项目

介绍

  • 基于MCP协议,基于TypeScript语言开发简单实现

  • 支持本地Stdio MCP及远程Streamable HTTP MCP服务

  • 支持AI Agent,如Claude、Cline、LINGMA灵码等MCP智能工具

  • 本项目仅为MCP协议示例项目,可参考项目进行更多开发

  • 更多参考官方文档:https://modelcontextprotocol.io

  • 项目未来会持续迭代更多示例

项目依赖

@modelcontextprotocol/sdk
express

Install:

// node >= 18
// npm 安装
npm install

// 本地stdio调试启动
npm run start

// 本地http调试启动
npm run start-http

// 构建
npm run build

项目目录

 ├─dist                          构建输出目录
 ├─src                           源码目录
   ├─config                      配置文件
   ├─utils                       工具类
   └─server                      server目录
       ├─stdio.ts                本地Stdio MCP服务
       ├─http.ts                 远程Http MCP服务
       └─http_stateful.ts        远程Http MCP有状态服务
   └─index.ts                    入口文件
 ├─.env                          stdio 环境变量
 ├─.env.http                     http 环境变量
 ├─.env.http.stateful            http 有状态环境变量
 ├─tsconfig.json                 tsconfig文件
 └─package.json                  package.json文件

如何运行

  • 本地执行完npm run start-http命令后,就已经构建了本地stdio文件,及启动了http服务

  • 配置AI Agent MCP服务,这里以VSCode LINGMA灵码为例,其他智能工具可参考对应文档进行配置 其中mcp-ts-stdio-server为stdio服务,mcp-ts-http-server为http服务,注意本地路径args要正确

{
  "mcpServers": {
    "mcp-ts-stdio-server": {
      "command": "node",
      "args": [
        "/Users/zcy/pjqdyd/mcp-ts-demo/dist/index.js"
      ],
      "env": {
        "MCP_SERVER_NAME": "mcp-ts-server",
        "MCP_SERVER_VERSION": "1.0.0"
      }
    },
    "mcp-ts-http-server": {
      "type": "streamable_http",
      "url": "http://localhost:3000/mcp"
    }
  }
}
  • 配置完成后,AI工具将自动连接MCP服务,并识别出服务提供的工具

总结

  • MCP(模型上下文协议)是一个开源标准,用于将人工智能应用与外部系统连接起来。

  • MCP协议是一种用于构建智能工具和AI服务的协议,它允许工具和AI服务之间进行交互,并使用MCP协议进行数据传输。

  • 通过MCP,像Claude或ChatGPT这样的AI应用可以连接数据源(如本地文件、数据库)、工具(如搜索引擎、计算器)和工作流程(如专门提示)——使它们能够访问关键信息并执行任务。

  • 更多请参考官方文档:https://modelcontextprotocol.io

License

This project is licensed under the MIT license.

Available Tools

2 tools
say-helloD

Say hello to the world

ParametersJSON Schema
NameRequiredDescriptionDefault
nameNoWorld

TDQS

D1.3/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations and a minimal description, the description does not disclose any behavioral traits such as side effects, idempotency, or required permissions. The agent has no information about the tool's behavior beyond the generic verb 'say'.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely short, but this is under-specification rather than conciseness. It does not provide enough information to be useful, and every sentence is needed but missing.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema and no explanation of return values. The description is insufficient for an agent to understand how to invoke the tool or what to expect as a result, given the low schema coverage and lack of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, and the description does not explain the parameter 'name' at all. It only mentions 'the world' in the description, failing to clarify that 'name' customizes the greeting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Say hello to the world' is vague and does not specify what the tool actually does (e.g., returns a greeting or logs a message). With a sibling tool 'say-hi', there is no differentiation, making it hard for an agent to select the correct tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus the sibling 'say-hi' or in what context. The description lacks any usage context or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

say-hiD

Say Hi to the world

ParametersJSON Schema
NameRequiredDescriptionDefault
titleNoWorld

TDQS

D1.3/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, and the description fails to disclose any behavioral traits such as side effects, required permissions, or output format. The tool's behavior is completely opaque beyond a vague greeting.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The single sentence is brief but lacks content, resulting in under-specification rather than efficient conciseness. Important information is missing, so the brevity is a drawback.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description is severely inadequate. It does not explain what the tool returns or how to interpret its output, leaving critical gaps for correct usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema parameter 'title' is not mentioned in the description, despite 0% schema description coverage. The description adds no meaning or guidance on how to use the parameter correctly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Say Hi to the world' indicates a greeting action, but it is vague and does not differentiate from the sibling tool 'say-hello'. It lacks specificity about what 'say' means (e.g., return a string, print, etc.), making it unclear for an agent to understand the exact purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'say-hello'. There is no context about prerequisites, expected inputs, or suitable scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 2 tool updatesv1.0.0
    • First observedsay-hello
    • First observedsay-hi

TDQS

D1.7/5.0
Disambiguation1/5

Both tools 'say-hello' and 'say-hi' perform essentially the same greeting action with no meaningful distinction, making it impossible for an agent to choose correctly.

Naming Consistency5/5

Both tool names follow a consistent 'verb-noun' pattern with a hyphen, demonstrating a predictable naming convention.

Tool Count2/5

With only two tools that are semantically identical, the tool count is effectively one duplicated tool, which is too few for a coherent API surface.

Completeness2/5

The server offers only greeting operations with no other capabilities, leaving the tool surface severely limited and lacking in depth or breadth.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A demonstration MCP server built in TypeScript that shows how to implement stdio-based communication for integration with MCP clients. Serves as a template for building custom MCP servers with strong typing and maintainability.
    -
  • F
    license
    B
    quality
    D
    maintenance
    A demonstration TypeScript MCP server that showcases basic MCP concepts with simple tools (greeting, calculator), text resources, and prompt templates for learning the Model Context Protocol.
    2
    -
  • F
    license
    Not graded
    quality
    F
    maintenance
    A basic MCP server implementation using Node.js and TypeScript that bridges AI models with external tools and data sources via JSON-RPC.
    2
    -

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/pjqdyd/mcp-ts-demo'

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