Official MCP SDKs

Choose the SDK that best fits your technology stack. All official SDKs provide complete support for resources, tools and prompts.

Python SDK

v1.0.0+

Official SDK for Python 3.11+. Ideal for MCP servers in Python, with complete support for resources, tools and prompts.

Installation:

pip install mcp

Requirements:

Python 3.11 or higher

Features:

  • Complete support for resources, tools and prompts
  • Intuitive decorators to define handlers
  • Strongly typed with type hints
  • stdio and SSE transport included
  • Excellent documentation and examples
View documentation

TypeScript SDK

v1.0.0+

Official SDK for Node.js and TypeScript. Perfect for MCP servers in the JavaScript/TypeScript ecosystem.

Installation:

npm install @model-context-protocol/sdk

Requirements:

Node.js 18+ or higher

Features:

  • Complete TypeScript with strict types
  • Support for ESM and CommonJS
  • stdio and SSE transport
  • Compatibility with Node.js and Deno
  • Integration with modern frameworks
View documentation

Kotlin SDK

v1.0.0+

Official SDK for Kotlin/JVM. Allows creating MCP servers in Kotlin for Android applications and backend.

Installation:

implementation("com.anthropic:mcp-sdk:1.0.0")

Requirements:

Kotlin 1.9+ / JVM 11+

Features:

  • Complete support for JVM and Android
  • Coroutines for asynchronous operations
  • Type-safe with Kotlin
  • Integration with Spring Boot
  • Excellent performance and concurrency
View documentation

Installation Guides

Follow these detailed steps to install and configure each SDK.

Installation: Python SDK

1

Check Python version

Make sure you have Python 3.11 or higher installed.

python --version
2

Install the SDK

Install the official MCP package from PyPI.

pip install mcp
3

Verify installation

Confirm that the installation was successful.

python -c "import mcp; print(mcp.__version__)"

Installation: TypeScript SDK

1

Check Node.js version

Make sure you have Node.js 18 or higher installed.

node --version
2

Create a project (optional)

Initialize a new Node.js project if needed.

npm init -y
3

Install the SDK

Install the official MCP package from npm.

npm install @model-context-protocol/sdk
4

Configure TypeScript (optional)

Install TypeScript and Node.js types for development.

npm install -D typescript @types/node

Installation: Kotlin SDK

1

Configure Gradle

Add the dependency in your build.gradle.kts file.

build.gradle.kts
2

Add the dependency

Include the MCP SDK in your project dependencies.

implementation("com.anthropic:mcp-sdk:1.0.0")
3

Sync the project

Sync and build the project to download dependencies.

./gradlew build

build.gradle.kts example:

dependencies {
    implementation("com.anthropic:mcp-sdk:1.0.0")
    // Otras dependencias...
}

Usage Examples

Here are basic examples of how to use each SDK to create a simple MCP server.

Example: Python SDK

Basic server with a "hello" tool

from mcp.server import Server
from mcp.types import Tool, TextContent
import mcp.types as types

app = Server("mi-servidor")

@app.list_tools()
async def list_tools() -> list[Tool]:
    return [
        Tool(
            name="hello",
            description="Saluda al usuario",
            inputSchema={
                "type": "object",
                "properties": {
                    "name": {"type": "string"}
                }
            }
        )
    ]

@app.call_tool()
async def call_tool(name: str, arguments: dict) -> list[TextContent]:
    if name == "hello":
        name = arguments.get("name", "Mundo")
        return [TextContent(
            type="text",
            text=f"¡Hola, {name}!"
        )]
    raise ValueError(f"Tool desconocida: {name}")

if __name__ == "__main__":
    from mcp.server.stdio import stdio_server
    stdio_server(app)

Example: TypeScript SDK

Basic server with a "hello" tool

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
  CallToolRequestSchema,
  ListToolsRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";

const server = new Server(
  {
    name: "mi-servidor",
    version: "0.1.0",
  },
  {
    capabilities: {
      tools: {},
    },
  }
);

server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: "hello",
      description: "Saluda al usuario",
      inputSchema: {
        type: "object",
        properties: {
          name: { type: "string" },
        },
      },
    },
  ],
}));

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name === "hello") {
    const name = request.params.arguments?.name || "Mundo";
    return {
      content: [
        {
          type: "text",
          text: `¡Hola, ${name}!`,
        },
      ],
    };
  }
  throw new Error(`Tool desconocida: ${request.params.name}`);
});

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
}

main();

Example: Kotlin SDK

Basic server with a "hello" tool

import com.anthropic.mcp.server.Server
import com.anthropic.mcp.types.Tool
import com.anthropic.mcp.types.TextContent
import kotlinx.coroutines.flow.flow

val server = Server(
    name = "mi-servidor",
    version = "0.1.0"
)

server.listTools { 
    listOf(
        Tool(
            name = "hello",
            description = "Saluda al usuario",
            inputSchema = mapOf(
                "type" to "object",
                "properties" to mapOf(
                    "name" to mapOf("type" to "string")
                )
            )
        )
    )
}

server.callTool { request ->
    when (request.name) {
        "hello" -> {
            val name = request.arguments?.get("name") as? String ?: "Mundo"
            listOf(
                TextContent(
                    type = "text",
                    text = "¡Hola, $name!"
                )
            )
        }
        else -> throw IllegalArgumentException("Tool desconocida: ${request.name}")
    }
}

fun main() {
    server.start()
}

Which SDK to Choose?

Python SDK

Choose Python if you already work with Python, need integration with scientific libraries, or prefer clear and readable syntax.

TypeScript SDK

Choose TypeScript if you work with Node.js, need integration with the JavaScript ecosystem, or develop modern web applications.

Kotlin SDK

Choose Kotlin if you develop for Android, work with JVM, or need integration with Spring Boot.

Ready to get started?

Explore more resources, tutorials and examples to master MCP.