Skip to content

Instantly share code, notes, and snippets.

@ynonp
Created July 31, 2025 08:57
Show Gist options
  • Save ynonp/03e0ef4e74ed439b5740c78393e8df42 to your computer and use it in GitHub Desktop.
Save ynonp/03e0ef4e74ed439b5740c78393e8df42 to your computer and use it in GitHub Desktop.

Write and Deploy Public MCP Server

Hi ;) Ynon Perek We Start at 10:00

MCP Server REST API get_tools() run_tool(tool_name) HTTP Streaming Server Sent Events Command line (stdio)

MCP Client VS Code ChatGPT Web Interface Claude Desktop

what's the weather today? => I don't know BUT if you run this code and give the result I will know and tell you get_weather()

=> MCP - decouple tools --- agent
  1. Intro & Tools

  2. Run in dev mode

  3. Add state

type State = { log: Array<string> };

export class MyMCP extends McpAgent<Env, State, {}> {
    initialState: State = {
        log: [] as Array<string>,
    }

    ...
    this.setState({ log: [...this.state.log, text] })
  1. Build something useful

    • AI logger
    • Use to log or notify important events during development
  2. Publish the tool

    • npm run deploy
    • demo: Use the tool from VS Code
  3. Add persistent data

    • npx wrangler kv namespace create MCP_LOG
    • add to code:
    interface Env {
          MCP_LOG: KVNamespace;  
    }
    
  4. Authentication

  5. Q & A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment