Skip to main content
Glama
binodrajpandey

MCP Server Example

MCP Server Example

A simple MCP (Model Context Protocol) server for learning the core primitives: Tools, Resources, and Prompts.

Setup

Prerequisites

  • Python 3.10+

  • uv

Install

uv sync

Related MCP server: MCP AI Chat LangChain

Test

uv run mcp dev server.py

Opens a browser UI at http://localhost:6274. From there you can:

  • Tools tab: call save_note, delete_note with custom inputs

  • Resources tab: read notes://list or notes://{name}

  • Prompts tab: run summarize_notes or brainstorm with arguments

Option 2 — CLI with mcp client

List all available tools:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | uv run python server.py

Connect to Claude Code (CLI)

Add the server to your Claude Code session:

claude mcp add learning-mcp -- uv run --directory /Users/binod/projects/mcp-example python server.py

Verify it's connected:

claude mcp list

Once added, Claude Code can call your tools directly in the chat — just ask it to, e.g. "save a note called 'ideas'".

Connect to Claude Desktop

Add this to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "learning-mcp": {
      "command": "uv",
      "args": [
        "run",
        "--directory", "/Users/binod/projects/mcp-example",
        "python", "server.py"
      ]
    }
  }
}

Then restart Claude Desktop.

Use programmatically (Python)

Use the mcp library to call tools, read resources, and fetch prompts from your own code:

from mcp import ClientSession
from mcp.client.stdio import stdio_client, StdioServerParameters
import asyncio

async def main():
    server = StdioServerParameters(
        command="uv", args=["run", "python", "server.py"]
    )
    async with stdio_client(server) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()

            # Read a resource
            notes = await session.read_resource("notes://list")
            print(notes)

            # Get a prompt
            prompt = await session.get_prompt("brainstorm", {"topic": "side projects"})
            print(prompt)

asyncio.run(main())

To let Claude (via Anthropic API) call your tools, add anthropic[mcp] to your dependencies and convert the tools:

from anthropic.lib.tools.mcp import async_mcp_tool
import anthropic

client = anthropic.AsyncAnthropic()
tools = [async_mcp_tool(t, session) for t in (await session.list_tools()).tools]

runner = client.beta.messages.tool_runner(
    model="claude-opus-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Save a note called ideas"}],
    tools=tools,
)
async for message in runner:
    for block in message.content:
        if hasattr(block, "text"):
            print(block.text)

What's inside

File

Description

server.py

MCP server with tools, resources, and prompts

pyproject.toml

Project dependencies

Tools (Claude can call these)

Tool

Description

save_note(name, content)

Save a note

delete_note(name)

Delete a note

Resources (Claude can read these)

URI

Description

notes://list

List all saved notes

notes://{name}

Read a specific note

Prompts (reusable templates)

Prompt

Description

summarize_notes

Summarize all saved notes

brainstorm(topic)

Brainstorm ideas on a topic

Available Tools

4 tools
addB

Add two numbers.

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the action ('Add') but gives no behavioral details such as error handling, computational limits, or output format. The description is minimal and lacks transparency about how the tool behaves beyond the basic operation.

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

Conciseness5/5

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

The description is extremely concise with a single sentence ('Add two numbers.') that directly states the purpose without any wasted words. It is front-loaded and efficiently communicates the core function, earning full marks for brevity and clarity.

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

Completeness3/5

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

Given the tool's low complexity (simple arithmetic), two parameters, and the presence of an output schema (which likely defines the result), the description is minimally adequate. However, with no annotations and 0% schema coverage, it lacks details on error cases or behavioral traits, making it incomplete for robust agent use.

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

Parameters3/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description 'Add two numbers' implies parameters 'a' and 'b' are numbers to be added, adding basic semantics beyond the schema's type definitions. However, it doesn't specify constraints like integer vs. float or handling of large numbers, leaving gaps.

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

Purpose4/5

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

The description 'Add two numbers' clearly states the tool's function with a specific verb ('Add') and resource ('two numbers'). It distinguishes from siblings like 'multiply' by specifying addition, though it doesn't explicitly contrast with other mathematical operations beyond the name.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'multiply' or non-mathematical siblings. It lacks context about use cases, prerequisites, or comparisons, leaving the agent to infer usage from the tool name alone.

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

delete_noteC

Delete a note by name.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.7/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool deletes a note, implying a destructive mutation, but doesn't cover critical aspects like permissions needed, whether deletion is reversible, error handling, or confirmation requirements. This leaves significant gaps in understanding the tool's behavior.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action and resource, making it easy to parse quickly, which is ideal for conciseness.

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

Completeness2/5

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

For a destructive tool with no annotations, 0% schema coverage, and an output schema (which helps but isn't described), the description is incomplete. It lacks details on behavior, parameters, and usage context, making it inadequate for safe and effective tool invocation by an agent.

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?

Schema description coverage is 0%, and the description only mentions 'by name' without explaining what 'name' refers to (e.g., note title, ID, filename), its format, or constraints. With one undocumented parameter, the description fails to compensate for the lack of schema details, providing minimal semantic value.

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

Purpose4/5

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

The description clearly states the action ('Delete') and resource ('a note'), making the purpose unambiguous. It doesn't distinguish from siblings like 'save_note', but it's specific enough to understand the basic function without being tautological.

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

Usage Guidelines2/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 'save_note' or other sibling tools. The description only states what it does, not when it should be selected, leaving the agent without context for decision-making.

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

multiplyA

Multiply two numbers.

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Multiply two numbers' implies a mathematical operation but does not disclose traits like error handling (e.g., for non-numeric inputs), performance, or side effects. It adds minimal context beyond the basic action.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It is appropriately sized and front-loaded, directly stating the tool's function without unnecessary elaboration.

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

Completeness4/5

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

Given the tool's low complexity (simple multiplication), two parameters with no schema descriptions, and the presence of an output schema (which handles return values), the description is mostly complete. However, it lacks usage guidelines and behavioral details, which are minor gaps for this straightforward tool.

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

Parameters4/5

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

The description adds meaning beyond the input schema by specifying that the parameters are 'two numbers,' clarifying their purpose. With schema description coverage at 0% (parameters 'a' and 'b' have no descriptions in the schema), this compensates well, though it does not detail constraints like integer vs. decimal.

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

Purpose5/5

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

The description 'Multiply two numbers' clearly states the specific verb ('multiply') and resource ('two numbers'), distinguishing it from sibling tools like 'add' (addition), 'delete_note' (deletion), and 'save_note' (saving). It is precise and unambiguous.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It does not mention use cases, prerequisites, or comparisons to sibling tools like 'add' for addition, leaving the agent to infer usage based on the tool name alone.

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

save_noteC

Save a note with a given name.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYes
contentYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.4/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a write operation ('save') but doesn't specify permissions, whether it overwrites existing notes, or what happens on success/failure. This is inadequate for a mutation tool with zero annotation coverage.

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

Conciseness4/5

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

The description is a single, efficient sentence with no wasted words. It's appropriately sized for a simple tool, though it could be more informative without sacrificing brevity.

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

Completeness2/5

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

For a 2-parameter mutation tool with no annotations and 0% schema coverage, the description is incomplete. It lacks details on behavior, parameters, and usage context. While an output schema exists, the description doesn't address key aspects like what 'save' entails or how it differs from siblings.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter details. The description mentions 'name' but doesn't explain its role or format, and omits 'content' entirely. It adds minimal value beyond the schema, failing to compensate for the coverage gap.

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

Purpose3/5

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

The description 'Save a note with a given name' clearly states the action (save) and resource (note), but it's vague about scope and doesn't distinguish from siblings like 'add' or 'delete_note'. It doesn't specify whether this creates new notes or updates existing ones, which limits clarity.

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

Usage Guidelines2/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 'add' or 'delete_note'. The description lacks context about prerequisites, such as whether a note must exist or if this creates new notes, leaving usage unclear.

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. 4 tool updatesv0.1.0
    • First observedadd
    • First observeddelete_note
    • First observedmultiply
    • First observedsave_note

TDQS

C2.6/5.0
Disambiguation2/5

The tools fall into two unrelated domains (arithmetic and note management) with no overlap within each domain, but the set as a whole is confusing because add/multiply and delete_note/save_note serve completely different purposes. An agent might struggle to understand why these tools are grouped together, though individual tools are distinct.

Naming Consistency2/5

Naming is inconsistent across the set: add and multiply use simple verbs without objects, while delete_note and save_note follow a verb_noun pattern. This mixed convention lacks a predictable pattern, making the tool set harder to navigate.

Tool Count3/5

With 4 tools, the count is reasonable for a small server, but it feels thin and poorly scoped because it covers two unrelated domains. For either arithmetic or note management alone, 4 tools would be appropriate, but combined, it suggests an incomplete or mismatched purpose.

Completeness2/5

For arithmetic, basic operations like subtraction and division are missing, leaving gaps. For note management, there's no way to list or retrieve notes, creating dead ends. The server lacks a clear domain, making completeness hard to assess, but obvious gaps exist in both inferred areas.

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 implementation of a Model Context Protocol server that provides simple mathematical tools (add, subtract) and personalized greeting resources.
    -
  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A demonstration MCP server that provides calculator tools for arithmetic operations, personalized greeting resources, and code review prompt templates. Enables users to perform basic math calculations, generate dynamic greetings, and access reusable code review templates through the Model Context Protocol.
    -

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/binodrajpandey/mcp-example'

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